Chat with Thomas | Profile

Welcome to the Modern Web Design.

Deployment

Deploying options

So what server we can use to host rails app?

Heroku getting started guide

Dedicated Server

There are quite a lot tutorials discussing how to deploy the rails app to linode. I found this one helpful to me.

https://gist.github.com/jpantuso/1031946

Although the steps are based on linode, it should be quite similar to deploy on the other self-managed server.

Monitoring Exceptions

# https://github.com/smartinez87/exception_notification
gem 'exception_notification', :require => 'exception_notifier'

Deployment database config

We set the database connection configuration in the database.yml file. This is convenient in development environment. But in production, we would better put the database connection and secret out of the database configuration file. We can do that by putting the value in environment variable and use ENV to access them.

production:
  adapter: postgresql
  encoding: unicode
  pool: 5
  database: <%= ENV['APP_DATABASE'] %>
  username: <%= ENV['APP_USERNAME'] %>
  password: <%= ENV['APP_PASSWORD'] %>
  host: <%= ENV['APP_HOST'] %>
  port: <%= ENV['APP_PORT'] %>