Deploying Your Application

From RAD Lab

Jump to: navigation, search

Deploy lessons learned (what can wrong and how to correct it.)

Contents

Special instructions for Windows

Now windows is ready to go.

General instructions and corrections

  • Make sure you have capistrano installed:
    • cap -V
      • Should respond with Capistrano v2.0.0

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.

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

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.

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'

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.

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.

Personal tools