No commit activity in last 3 years
No release in over 3 years
Capistrano plugin that prompt a text menu to choose target host.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

capistrano-hostmenu

A capistrano plugin which allows you to choose one or more server to deploy via a text menu.

Here's an example:

In you deploy config:

server 'example1.com', user: "#{fetch(:deploy_user)}", roles: %w{web app}
server 'example2.com', user: "#{fetch(:deploy_user)}", roles: %w{web app}

when you run cap deploy or cap deploy:start or other deploy tasks, you will see a menu:

Please choose which server(s) to deploy:
  [1] example1.com
  [2] example2.com
  [3] all (default)
Please enter host_numbers (3):

you can answer with:

  • 1 for choosing server example1.com,
  • 2 for example2.com,
  • 3 or 1,2 for both.

Installation

gem install capistrano-hostmenu

or put this in your Gemfile then run bundle install:

gem 'capistrano-hostmenu', require: false

After the gem is installed, put this in your Capfile:

require 'capistrano/hostmenu'

Then you will see host selecting menu any time before deploying.

Configurations

set these variables in your deploy config (commonly deploy.rb)

set :host_menu_default_selection,         :all # or :first, 1
set :host_menu_prompt_msg,                'Please choose which server(s) to deploy:'.blue
set :host_menu_caption_of_all,            'all'
set :host_menu_caption_of_default,        '(default)'
set :host_menu_invalid_range_msg,         'Please provide a number in (1..%d)'.red
set :host_menu_invalid_multi_choose_msg,  'Do you mean to choose all servers?'.red
set :host_menu_role_to_filter,            :all
set :host_menu_env_key,                   :rails_env