Environments

Environments are application instances that are independent of one another. An environment can consist of one or more physical systems. One or more physical systems can support one or more environments as well. The key point of an environment is its independence and isolation from other environments. Rails has built-in support for environments in its configuration system, and Capistrano can be configured to deploy an application to more than one environment.

Historically, supporting multiple environments with the ease that Rails and Capistrano provide has been a very difficult endeavor on all but the most mature frameworks. The result is that many web applications are developed and deployed in less than ideal circumstances.

Development and Testing

Rails has the fastest development and testing environment setup that I’ve ever seen. Once Rails is installed on your system, all you need to do to get a well-written Rails application running in development mode is:

  1. Check out code from the repository

  2. Change to the top-level directory of the application

  3. Create DB user and blank schema to match config/database.yml (development and testing)

  4. Type rake migrate to install Schema and static data

  5. Type rake to run unit and functional tests

  6. Debug from output, install missing gems, and repeat step 5

  7. Open the browser and access http://127.0.0.1:3000 to use the application

You now have an isolated development and testing environment that is running the current code at the time of checkout. If your ...

Get Capistrano and the Rails Application Lifecycle now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.