Deploying Your Application
From RAD Lab
Deploy lessons learned (what can wrong and how to correct it.)
Contents |
[edit]
Special instructions for Windows
- Install subversion command line: http://subversion.tigris.org/files/documents/15/39559/svn-1.4.5-setup.exe
- Install putty: http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.60-installer.exe
- Run the installers
- Generate a key using PuTTYgen
- After wiggling your mouse around, copy the public key in the upper part of the dialog and mail it to me along with your group number and save your public and private keys on your machine.
- If I'm not around Alex and Author can also add. (wsobel (at) eecs dot berkeley dot edu)
- Start Pagent and add your private key.
Now windows is ready to go.
[edit]
General instructions and corrections
- Make sure you have capistrano installed:
- cap -V
- Should respond with Capistrano v2.0.0
- cap -V
- Install the rorclassify plugin:
- svn export http://svn.rorclass.org/repos/plugins/rorclassify/trunk/rorclassify/ vendor/plugins/rorclassify
- capify your current project
- capify .
[edit]
Edit your config/deploy.rb file
- Delete everything in the file
- Change it to read as follows:
set :application, "<your_app_name>" set :group_num, <your_group_number> set :user, '<group_user_name>' set :local_user, '<your_svn_user_name>' # Only used for the initial import. load 'vendor/plugins/rorclassify/rorclassify.rb'
- The application name (<your_app_name>) is the domain name that we registered for your application.
- The group number (<your_group_number>) is the number of your group in pbwiki. For example, twigg is 7
- The group user name (<group_user_name>) is the user the application is deployed as. For example, twigg is cs198-gg
- The local user is the user the you will be doing the import as. For me this is wsobel.
- You can find your group number and account on: http://rorclass-fall07.pbwiki.com/
[edit]
We're now ready to import your code to subversion.
- Run the following command:
cap svn:import
- If import all your code and then check it out into a new directory with the same name as your current directoy with _work appended.
- If this fails on the password check, reset the group password in the admin application.
- Make sure you look at the account it's asking for when it asks for your password.
- Make sure you cd to ../<dir_name>_work to continue
[edit]
Now you need to setup the server directories
- run the following command from the new directory
cap deploy:setup
- If the mysql command fails, you may need to ssh to the server and remove the .my.cnf file from the group account home directory
- These files were left behind and cause problems.
- If you cannot connect to the server, make sure you're running ssh-agent
eval `ssh-agent` ssh-add ~/.ssh/id_rsa
- On mac I would suggest getting SSHKeychain: http://www.sshkeychain.org/
- If you have a passphrase on your key, enter it when it asks for your passcode.
- On windows, use Pagent and add your private key.
- Try the deploy again if it did not work. Deploy will just create config files and directories if they don't exit.
[edit]
Ok, your're almost done, deploy the app
- Now you're ready to deploy. If the setup went well, you should be able to deploy without any problems.
cap deploy:cold
- This will create the initial version of the application on the server and start the mongrels.
- When it asks for the password during the deploy for the group account (cs198-g?), give the password you gave when you added the group account to the admin application. If you didn't, use 'ror'
[edit]
Restart Apache
Your application is now up and running, but apache needs to find the new configuration file. ssh as the group account to the correct machine:
- group 1-4 are on r3.millennium.berkeley.edu
- group 5-8 are on r4.millennium.berkeley.edu
- group 8-12 are on r5.millennium.berkeley.edu
sudo apache2ctl restart
Note: that is the only command you can sudo with the group account.
Try to nagivate to your app using the browser.
That's it.
[edit]
Comments
If anything here does not work, please send me comments and I will make corrections to the instuctions.
wsobel (at) eecs dot berkeley dot edu
If you want to change your app name for the domain, send me the new app name and I'll register it for you. Currently I've received names from everyone except for groups 2 and 10. They have been defaulted to gb and gj.
