Skip to content

imGraetzl/im_graetzl

Repository files navigation

Build Status Dependency Status

imGrätzl

Geo-data backed Ruby on Rails social network app Vienna.

Table of Contents

  1. Getting Started
  2. Development
  3. Deployment

Getting Started

Dependencies

Test dependencies

Development

Setup on OSX

Assuming you are on the correct Ruby version

# install dependencies with homebrew
$ brew install geos proj postgres postgis phantomjs imagemagick

# make sure postgres is running
$ brew services start postgresql

# create postgres user (if not existing)
$ createuser postgres

# install gems
$ bundle install

# setup database
$ rake db:setup

# populate database with sample data
$ rake db:populate

Adapt your Procfile.dev based on your local database settings (see Procfile.dev.example) and you can start the development server with auto-reloading using:

bundle exec foreman -f Procfile.dev

Setup with Vagrant

Prerequisites

  1. Install the latest version of VirtualBox for your OS
  2. Install the latest version of Vagrant for your OS

Setup VM

In the project directory, run:

$ vagrant up

This will spin up a new VM and install all required dependencies.

Once the VM is ready, in the project directory run:

# ssh into the VM and change to the mounted project directory
$ vagrant ssh
$ cd /vagrant

# set up the database
$ rails db:setup

# populate the database with sample data
$ rails db:populate

#### Run the application

To run the server:

```sh
$ rails server -b 0.0.0.0   # this makes the application available on http://localhost:3000

Use CTRL + c to shut down the server again.

Run the tests

To run the tests:

$ rspec spec

Shut down VM

To exit your ssh session in the VM, simply run:

$ exit

To shut down the VM, run:

$ vagrant halt   # $ vagrant up will continue at the state you left the VM

Deployment

The app is hosted on Amazon Elastic Beanstalk (single instance type running Ruby 2.3, Puma, Nginx). Config in .ebextensions folder. Files are executed in alphabetical order:

  • 01options.config - Set Rails specific Elastic Beanstalk variables
  • 02packages.config - Install yum packages
  • 03nginx.config - Configure webserver
  • 04cron.config - Load automated tasks in crontab
  • 05eb_housekeeping.config - Remove old application versions
  • 06permissions.config - Set file permissions
  • 07sitemap.config - Refresh sitemap

See the wiki for further instructions and tutorials.