Deploying a new Rails application

Here are our instructions for how to deploy a new rails application. This does not include any information about rails development; it describes only the various things we do in order to set up an application.

Please fill in any missing steps, or steps that are incomplete, or make any other corrections that are necessary.

Create a new account to run the application.

We run each rails application under a user account in the apps group; the user account is named for the application being run. We run the application from the home directory for that account (meaning that we check the code out of the subversion repository from the application's account, and aim our web server at the application account's home directory).

See the file /root/admin/README.accounts for instructions regarding making new accounts on oink.

Set the appropriate permissions to allow access to the new account's home directory

Look at the permissions for the 'cvdb' account's directory /home/cvdb, and match them. If you forget to do this, Apache will refuse to serve your application; one sign of this error is the message

Symbolic link not allowed or link target not accessible: /usr/local/apache2/htdocs/<application name>

in the SSL log file for the server.

Create a new Subversion repository

Create a new subversion repository to host your project. This is done with svnadmin, which you must run as root.

TODO: Get a writeup of exactly how to do this, and link to it.

This step also includes making the repository accessible through Apache. To do this, modify the file /usr/local/apache2/conf/extras/httpd-repos.conf; copy one of the existing repository declaration blocks, and change the paths to match the name of the new repository. You also need to add the application account to the SVN authorization file. Do this by modifying /usr/local/apache2/passwd/users.txt (you must have root privs to do this), adding the new command that adds the username and password to the access.svn file. Then actually run the command.

The Apache server must be restarted after modifying the configuration files.

Check out the application code into the account directory

root privs are required for this action. Log in to the application account, and check out the code from your new repository into the home directory of the application account.

Configure passenger to serve the development and production instances of the application

This means adding some stanzas to the /usr/local/apache2/conf/extra/httpd-railsapp.conf file.