-
Notifications
You must be signed in to change notification settings - Fork 24
Capistrano Deploy Notes
This Wiki Page includes both Normal Deployment and Update ruby version for a given project
Deploy command where environment is one of qa_new|stage_new|prod_new:
cap [environment] deploy
This is not to be confused with Rails' environment such as development, test, production. Capistrano deploys to Rails' production environment, but using a server environment of our choosing.
Other helpful deployment options
- deploy to stage environment:
cap stage_new deploy
- deploy a specific branch, develop to qa environment:
cap qa deploy BRANCH_NAME=develop
- deploy a specific revision, in this case c9800f1, to staging environment:
cap -s revision=c9800f1 staging deploy
- deploy a specific tag, my_tag, to production environment:
cap production deploy REVISION=my_tag
Note Prior to deploying for the first time, you need to setup your ssh key. The public key will be installed on the deployment systems to allow for access.
- log into the system you will deploy from
- create the ssh key:
ssh-keygen -f ~/.ssh/id_deploy_rsa
. Use a secure password, that is different from your normal login password. Be sure to remember this, you'll need it everytime you deploy. - Securely give a copy of the file
~/.ssh/id_deploy_rsa.pub
to a DevOps Team member so that they may install it on the required systems. - Profit.
-
Before you update via Capistrano remotely you must make some changes locally first.
-
Update the projects .ruby-version file
-
Update rbenv / ruby so that the required version is available to install (if needed).
-
For Linux:
cd ~/.rbenv/plugins/ruby-build/ git pull
-
For Mac: (https://github.com/sstephenson/rbenv#homebrew-on-mac-os-x)
brew update brew upgrade rbenv ruby-build
-
-
Update ruby
-
For Development machine
cd [into project directory] rbenv install [ will automatically install the version listed in your file: .ruby-version]
-
For Server (before cap deploy of new code)
rbenv install [version you want to install] rbenv local [version you want to install] gem install bundler
-
-
Install bundler:
gem install bundler rbenv rehash bundle install
-
-
Push changes to your repository.
-
Now you can update your applications remote installations of rbenv & ruby:
cap [environment] rbenv:update cap [environment] rbenv:setup
-
Continue on with normal deployment.
-
These steps were condensed from https://github.com/sstephenson/rbenv