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 Jul 13, 2017 · 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_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.

  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