Wednesday, March 16, 2011

What little things do I need to do before deploying a rails application

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

From stackoverflow
    • 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
    • Check the slow query log, and add any indexes to your models which are causing full-table traverses.

    • Also

      grep -ril FIXME

    Ben Scofield : even better for the also: rake notes:fixme
    • Include google analytics snippet (or other analytics)
  • 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...

    • 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
  • 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.
  • I found a very good article for deploying rails app using ubuntu. You may visit http://bit.ly/lvFp9 for more info

0 comments:

Post a Comment