Skip to content

Deploy using Capistrano

Thomas Scherz edited this page Feb 28, 2022 · 2 revisions

First Time Use (When previously using Bamboo)

  1. Move the current application directory (probably curate_uc) to a different directory (curate_uc_old).
  2. Put the variables file in scholar_capistrano/static.

Important

  • If you deploying to a protected server (can't access externally), then you need to setup a tunnel to deploy. To do so simply ssh [email protected] -L 2222:SERVER_NAME:22. Make sure that you dont close this session, or the deploy won't work. For QA and Dev use the following tunnel command ssh [email protected] -L 2222:SERVER_NAME.private:22 -L 2223:SERVER_NAME.private:22
  • If you are doing a local deploy, you need to make sure that you can ssh into your machine. It will make a tmux session called localhost when deploying, which you can access by tmux attach -t localhost.

Deployment

  1. Make sure that the branch you want to deploy has Capistrano functionality.
  2. Determine where you want to deploy to (available options are in config/deploy).
  3. Make sure all changes have been saved and commited to GitHub. If they are not, Capistrano will use what is currently committed.
  4. Run the command cap DEPLOY_SERVER deploy. This will prompt you for the credentials for the user to deploy with. After that, the deploy should start.
  5. At the end of the deploy, you should get a green sentence that says that the deploy was successful.

Notes

  • Most settings to use for deploys can be changed in their deploy file (Located in config/deploy).
  • You can have multiple tunnels by appending -L before each server using the SSH command listed above.
  • Capistrano will not change the current release until right before it runs the script at the end. If it fails before then, it will continue to function as normal.