Deploy to Capistrano
This how-to guide covers an example CircleCI configuration to deploy to Capistrano.
Introduction
This page provides a configuration example for deployment to Capistrano. Once your project is set up to use Capistrano, you can run deployment commands within your CircleCI job as required.
Configuration example
version: 2.1
workflows:
build-deploy:
jobs:
- build-job
- deploy-job:
requires:
- build-job # Only run deploy job once build job has completed
filters:
branches:
only: main # Only run deploy job when commit is on the main branch
jobs:
# build and test jobs go here - not included for brevity
deploy-job:
docker:
- image: <docker-image-name-tag>
working_directory: ~/repo
steps:
- checkout
- run:
name: Bundle Install
command: bundle check || bundle install
- run:
name: Deploy if tests pass and branch is Main
command: bundle exec cap production deploy
Track your deployments with deploy markers
Deploy markers provide a way to track and manage your Capistrano deployments in the CircleCI web app. When you add deploy markers to your deployment job, you can view a timeline of all deployments, track their status, and enable rollback and deploy pipelines.
You have two options for setting up deploy markers:
-
In-app setup: Use the guided setup in the CircleCI web app when configuring a Rollback Pipeline or Deploy Pipeline. The setup will walk you through adding deploy markers to your configuration. If you are using GitHub and have the CircleCI GitHub App installed, you can use AI to generate the deploy marker configuration automatically.
-
Manual setup: Add deploy marker commands directly to your
.circleci/config.ymlfile by following the Configure Deploy Markers guide.
Both approaches will enable you to track deployment history and manage rollbacks directly from the CircleCI web app.