No commit activity in last 3 years
No release in over 3 years
Capistrano multimarket
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.9.11.4

Runtime

>= 2.0.0
 Project Readme

capistrano-multimarket

NOTE

Forked from capistrano-multiconfig. But this extension loads both .yml and .rb files. Use the main project if you want to load only rb files ;-)

Description

Capistrano extension that allows to use multiple configurations(Ruby and YAML files).

MultiMarket extension is similar to multistage extenstion. But it's not only about 'stage' configurations. It's about any configuration that you may need. Extension recursively builds configuration list from configuration root directory. Each configuration loads recursively configuration from it namespace files and own configuration file.

Usage

Install gem

$ gem install capistrano-multimarket

Add to Capfile

set :market_root, 'path/to/your/markets'
require 'capistrano/multimarket'

Example

Assume we have the following configurations:

$ tree config/
config/
└── deploy
    └── markets
        ├── production
        │   ├── blog
        │   │   ├── site1.rb
        │   │   └── site2.yml
        │   └── blog.rb
        ├── production.rb
        └── staging
            └── blog
                ├── site1.rb
                └── site1.yml

Check tasks:

$ cap -f check.rb -T
cap invoke                # Invoke a single command on the remote servers.
cap production:blog:site1 # Load production:blog:site1 configuration
cap production:blog:site2 # Load production:blog:site2 configuration
cap shell                 # Begin an interactive Capistrano session.
cap staging:blog:site1    # Load staging:blog:site1 configuration

Let's try to run task without specified configuration:

$ cap -f check.rb shell
    triggering start callbacks for `shell'
  * executing `multimarket:ensure'
No configuration specified. Please specify one of:
  * production:blog:site1
  * staging:blog:site1
  * production:blog:site2
(e.g. `cap production:blog:site1 shell')

So we must provide configuration as first task:

$ cap -f check.rb staging:blog:site1 shell
  * executing `staging:blog:site1'
    triggering start callbacks for `shell'
  * executing `multimarket:ensure'
  * executing `shell'

Example of YAML config:

$ cat examples/config/deploy/markets/staging/blog/site1.yml
variables:
  application: 'market1'
  app_servers:
    - web1.example.com
    - web2.example.com
roles:
  app:
    - "app1.example.com"
    - "app2.example.com"
  db:
    - "app1.example.com"
    - {primary: true}
string: |
  set :branch, :master
  role(:web) { fetch(:app_servers) }