Deployment Instructions

Version 5 (J. Simmons, 11/03/2011 12:16 am)

1 1 Matthew Sears
h1. Deployment Instructions
2 1 Matthew Sears
3 2 Matthew Sears
Open Design Engine (ODE) uses "Capistrano":http://capistranorb.com for code deployment. Capistrano is a developer tool for deploying web applications. It is typically installed on a workstation, and used to deploy code from your source code management (SCM) to one, or more servers.
4 2 Matthew Sears
5 2 Matthew Sears
h1. Getting started
6 2 Matthew Sears
7 2 Matthew Sears
In order to deploy code to production servers, you must first have authorization to access the server.  The simplest way to achieve access is to use SSH public/private key pairs so that you don't have to type the password each time. Because SSH is the transport for other services such as SCP (secure copy), SFTP (secure file transfer), and other services (SVN, etc), this can be very convenient and save you a lot of typing.
8 2 Matthew Sears
9 5 J. Simmons
If your local username is different from your remote username, add @-s user=<remote_user>@ to the beginning of the Capistrano commands.
10 5 J. Simmons
11 2 Matthew Sears
h1. Quick Deploy
12 2 Matthew Sears
13 2 Matthew Sears
To deploy, simply run:
14 2 Matthew Sears
15 2 Matthew Sears
<pre>
16 2 Matthew Sears
cap production deploy
17 2 Matthew Sears
</pre>
18 2 Matthew Sears
19 2 Matthew Sears
This command executes the following steps:
20 2 Matthew Sears
21 2 Matthew Sears
* Pulls in the latest code from the repository
22 2 Matthew Sears
* Copies any configuration data needed by the application.
23 2 Matthew Sears
* Runs the any new database migrations (including plugins).
24 2 Matthew Sears
* Performs a database backup if the database schema changed since the last deploy.
25 2 Matthew Sears
* Restarts the application server.
26 2 Matthew Sears
27 2 Matthew Sears
h1. Rolling Back
28 2 Matthew Sears
29 2 Matthew Sears
If something goes wrong with the deployment, we can rollback to the previous release:
30 2 Matthew Sears
31 1 Matthew Sears
<pre>
32 4 Matthew Sears
cap production deploy:rollback
33 2 Matthew Sears
</pre>
34 2 Matthew Sears
35 2 Matthew Sears
The deployment script will keep the last 5 releases as apart of it's deployment process.
36 2 Matthew Sears
37 3 Matthew Sears
h1. Database Backup
38 2 Matthew Sears
39 2 Matthew Sears
We can perform a database backup at anytime:
40 1 Matthew Sears
41 1 Matthew Sears
<pre>
42 4 Matthew Sears
cap produciton db:dump 
43 1 Matthew Sears
</pre>
44 4 Matthew Sears
45 4 Matthew Sears
h1. Archiving
46 4 Matthew Sears
47 4 Matthew Sears
We can archive by tarring the current release directory with the archive command:
48 4 Matthew Sears
49 4 Matthew Sears
<pre>
50 4 Matthew Sears
cap production archive name=0.1.0
51 4 Matthew Sears
</pre>
52 4 Matthew Sears
53 4 Matthew Sears
This process with tar the current release directory and copy the tar file to the shared directory.  In addition, it will download the tar file to your local tmp/ directory.