Skip to content
This repository has been archived by the owner on Nov 18, 2020. It is now read-only.

Capistrano Deploy Notes

cam156 edited this page Oct 29, 2014 · 20 revisions

This Wiki Page includes both Normal Deployment and Update ruby version for a given project

Normal Deployment

Deploy command where environment is one of qa|staging|demo|production: cap [environment] deploy

Other helpful deployment options

  • deploy to staging environment: cap staging deploy
  • deploy a specific branch, develop to qa environment: cap -s branch=develop qa deploy
  • 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 -s tag=my_tag production deploy

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.

  1. log into the system you will deploy from
  2. 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.
  3. 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.
  4. Profit.

Update ruby version for a given project

  • 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).

    • 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

Clone this wiki locally