This article is about CodeShip Basic.

Deploy With Capistrano

You will need about one minute to read this article.

You can deploy any kind of application with Capistrano. For detailed information about Capistrano check Don’t forget to include Capistrano in your projects as it’s not preinstalled on our build servers.

Capistrano with a custom script deployment

To setup a Capistrano deployment on CodeShip, first create a new custom script deployment. From there you can add any commands you need, including installing and calling your Capistrano deployment.

gem install capistrano
bundle exec cap $STAGE deploy

Common Errors

Authentication fails

Usually Capistrano relies on a SSH connection to copy files and execute remote commands. If connecting to your server fails with an error message (e.g. asking for a password), please take a look at our documentation on authenticating via SSH public keys for more information.

Capistrano is not installed by default

If you don’t have Capistrano in your Gemfile you need to install it first. Simply add the following command to a script based deployment which runs before the Capistrano deployment.

gem install capistrano

Deployment fails because of detached checkout

Because CodeShip only fetches the last 50 commits as well as checks out your repository in detached head mode, Capistrano may fail the deployment. If this is the case for your setup, please add the following two commands to your deployment script. They will fetch the full history of the repository and switch to the branch you are currently testing.

git fetch --unshallow || true
git checkout "${CI_BRANCH}"

Need more help?

Contact our support team or post on Stack Overflow using the tag #codeship. Did you check the status page and changelog?

There are also several code examples and sample projects available for you to get started with.

Article not helpful?

Does this article need improvement? If so, please send feedback or submit a pull request!