Skip to content

Production Deployment

jrochkind edited this page Jan 11, 2012 · 16 revisions

Starting a rails app with rails server works fine for development and quick-and-dirty demo, but is not the way you'd want to do a production deployment or expose the app to the world.

We'll cover some basics of Rails 'environments', mention Passenger as one easy way to deploy a Rails app, and then discuss a few specific issues of Umlaut. Those already very familiar with Rails deployment may still want to check out the Umlaut section at the bottom.

Rails environments

Rails apps are set up to be run under a number of 'environments' -- by default, development, test, and production. See more at the Rails Getting Started Guide.

Databases

If you look in your ./config/database.yml, you'll see you (potentially) have a database defined for each environment. You'd generally want a different db for development and production, not share the same db.

When you ran rake db:migrate to create the Umlaut db schema, it by default ran under the development app environment. To create the app's schema in the configured production database, you set the RAILS_ENV env variable before running the command, like so:

RAILS_ENV=production rake db:migrate
  • If you have installed a new version of Umlaut with new schema changes, you can run this again.
  • But it may be tricky to do that in production with zero downtime, although it can be done with very minimal downtime. Run the migrations in the new version of the app, then immediately restart the app (see below under Passenger).

Config

As in all standard Rails apps, some environment-specific config can be found in ./config/environments/development.rb or ./config/environments/production.rb, respectively. You can look in there to see how standard Rails apps are configured differently in development vs production, and change settings if desired.

(You can create your own new environment, like 'staging', pretty much simply by creating a ./config/environments/staging.rb and referencing a db in ./config/database.yml).

Asset Pipeline

Testing setup under production environment

Passenger

restart with touch ./tmp/restart.txt.

passenger-status

set number of instances started up.

Umlaut-Specific Concerns

number of instances

database connections

concurrency

service logging

Clone this wiki locally