Question

EDIT

What small things which are too easy to overlook do I need to do before deploying a rails application?

I have set up another question for any task that takes more than a minute or two, and so ought to be scheduled into a deployment process. In this question I'm mostly concerned with on-line config options and similar, that can be done, but are often left out in during the development cycle because they don't make any difference until deployment

Was it helpful?

Solution

  • Freeze the gems you are using rake gems:unpack
  • Change the secret in config/environment.rb
  • Filter sensitive informtion like passwords: in app/controllers/application.rb filter_parameter_logging :password, :password_confirmation

OTHER TIPS

  • Ensure the DB is setup on your production server
  • Set up capistrano to deploy your app properly
    • Run a capistrano dry-run
  • Ensure Rails is packed into your vendor/rails folder
  • Ensure all gems are frozen in your app or installed on your prod server
  • Run your tests on the production machine
  • Include google analytics snippet (or other analytics)
  • Check the slow query log, and add any indexes to your models which are causing full-table traverses.

  • Also

    grep -ril FIXME

Set up the files and folders to be shared between deployed copies of the app, including (but not limited to) view caches, database config, maintenance page...

These aren't really Rails-specific deployment-tasks, but I have seen them overlooked too many times for deployed systems:

  • Backups; admittedly, this can end up being a big task, but it need not be. Simply scheduling nightly backups of the database and software is often sufficient.
  • Testing the restoration procedure
  • Log rotation and archiving
  • Exception notification
  • Make sure that the place you are deploying to has the RAILS_ENV variable properly set. Either through the environment, or through a capistrano callback.
  • Make sure your tests are all passing by running rake spec, shoulda, unit tests, or whatever you are using to test.
  • Unpack your gems using rake gems:unpack
  • Decide whether you need to freeze Rails. rake rails:freeze:gems
  • Double check that dependencies are installed on the server if you need more than just gems (memcached, mail server, etc)
  • If you are using MySQL, compile and install the C-based MySQL library on the server (this could take longer than a few minutes, but typically is fairly quick if all dependencies are satisfied).
  • If you are using git, push your code to the master branch. Tag it if necessary.
  • If you are using SVN, tag the release.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top