Skip to content

Complete Production Installation

Luke Baker edited this page Sep 18, 2015 · 9 revisions

If you haven’t completed the Installing instructions do, complete those first.

Set up the mysql database

Open config/database.yml in the allourideas.org directory and add a production block in the file, making sure the user (perhaps root) has access. The production block should look something like:

production:
  <<: *default
  database: aoi_production
  host: localhost
  username: root
  password: my_password

Create the database with RAILS_ENV=production ./bin/rake db:create and then RAILS_ENV=production ./bin/rake db:schema:load

Install and start the server

Install apache or nginx through your operating system’s package manager. We recommend using Phusion Passenger with either Apache or nginx. You’ll need to configure nginx or Apache with a host that’ll serve the pairwise site. The specifics of how you do that will depend on your particular needs.

config/config.yml contains some references to environment variables. You could changes those to hard code the configuration or you could set the environment variables in Passenger.

The application occasionally needs to write to the public/ directory, so the user that runs the application server (e.g., Passenger) should be able to write to the directories and files within the public/ directory.

Create an authorized ‘allourideas’ user on the pairwise site.

Since the pairwise api server authenticates each request we make to it, we’ll need to create an allourideas user and photocracy user on the pairwise site. These commands should be run on your install of the pairwise API.

cd ../pairwise-api
RAILS_ENV=production ./bin/rake util:useradd[[email protected],wheatthins]
RAILS_ENV=production ./bin/rake util:useradd[[email protected],saltines]

Add entry to local hosts file (photocracy only)

To trigger photocracy, the code checks for the string “photocracy” in the URL. You could setup a server alias in Apache or nginx for photocracy.example.com (using whichever domain you used for the allourideas installation).

Start Delayed Job Workers

If you want to enable the export results as CSV feature, you’ll need a delayed_job worker for All Our Ideas code and pairwise. RAILS_ENV=production bundle exec ./script/delayed_job start

Setup Email Delivery

If you want to send via SMTP, update the settings in config/initializers/mail.rb to instruct Rails how to connect and authenticate with your SMTP server. If you have sendmail or equivalent mail service setup on your server already, you may update the config.action_mailer.delivery_method setting in config/environment.rb to be :sendmail. If you need more details, check out the Rails documentation.