Oct
30
2008
30
2008
Assumptions:
Capistrano is installed
You are using a Capistrano supported version control system
You are using Ruby on Rails as the application framework and it is all installed and working
- First you need to create the Capistrano configuration files by moving to the root of you rails application and typing ‘capify .‘ (include the space and dot) this created the Capfile in the root and deploy.rb in the config directory
- Edit deploy.rb to set up Capistrano for your application: you will need to change or set the following values:
- set :application, “myNewApplication” #put your application name here – this is the directory your app will end up in
- set :repository, “pathToYourRepository” #this can be a local full file path eg ‘/home/me/repository/myNewApplication’ or a path to an external repo ‘bzr+ssh://me@example.com/repo/myNewApplication’
- set :scm, :bzr #set this to :bzr, :git etc as appropriate if you are not using subversion
- set :deploy_to, “/var/www” #set this to the directory you want your apps to land in, the application name listed above will be created as a sub directory of this one
- role :app “myserver.example.com” #set this to the domain name of your server, it is used to connect to your server so it must resolve to the ip of the server
- role :web “myserver.example.com”
- role :db “myserver.example.com” , :primary =>true
- ssh_options[:port] = 20000 #if you are not using the standard ssh port (22) you must specify the correct value here
- set :user, “me” #if you use a different username to log into the remote machine you need to specify it here
- set :use_sodu, false #you will probably want to use this else everything will be owned by root and the application probably won’t run, I found this did not for cap deploy:setup
- Set up the directory structure by running ‘cap deploy:setup‘
- Check the app skeleton by running ‘cap deploy:check‘ you may need to change the owner for the directories created above
- Deploy your app with ‘cap deploy:update‘ if everything went OK the app will be deployed from the repository to the application directory structure
You still need to create and deploy the database and start the application itself, you can use Capistrano and rake tasks do these things.
You must be logged in to post a comment.
