No commit activity in last 3 years
No release in over 3 years
A capistrano 3 plugin which provides locking feature for deployment
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0

Runtime

 Project Readme

Gem Version Build Status

Capistrano::DeployLocker

A capistrano plugin to make deployment with exclusive lock.

In other words, this protects any two processes from running cap deploy command at the same time.

Installation

Add this line to your application's Gemfile:

gem 'capistrano-deploy_locker'

And then execute:

$ bundle

Or install it yourself as:

$ gem install capistrano-deploy_locker

Configuration

Set Capistrano variables with set name, value.

Name Default Description
deploy_lock_key "#{fetch(:application)}.#{fetch(:stage)}" String to specify lock target
deploy_lock_dir ./.lock Directory to write lockfile or other info
deploy_lock_user ENV['USER'] || ENV['LOGIN'] Who locks deploy
deploy_lock_reason "#{$0} #{ARGV}" Why deploy is locked

You can provide :deploy_lock_user and :deploy_lock_reason to show infomation of your deployment for other operators who try to get lock in fail.

Usage

Edit Capfile:

# Load DSL and Setup Up Stages
require 'capistrano/setup'

# Includes default deployment tasks
require 'capistrano/deploy'

# Includes tasks from other gems included in your Gemfile
require 'capistrano/deploy_locker'

Edit your config/deploy.rb:

before 'deploy:starting', 'deploy:lock'
after 'deploy:finished', 'deploy:unlock'
after 'deploy:failed', 'deploy:unlock'

Alternatives

Here is a list of other libraries which provides similar functionarily:

License

Available as open source under the terms of the MIT License.

Copyright (c) 2017 DeNA Co., Ltd., IKEDA Kiyoshi