GithubHelp home page GithubHelp logo

b0rg / capistrano-multiconfig Goto Github PK

View Code? Open in Web Editor NEW

This project forked from railsware/capistrano-multiconfig

0.0 3.0 0.0 68 KB

Capistrano extension that allows to use multiple configurations

License: MIT License

capistrano-multiconfig's Introduction

capistrano-multiconfig

Description

Capistrano extension that allows to use multiple configurations.

Multiconfig 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-multiconfig

Add to Capfile

set :config, 'path/to/your/configurations'
require 'capistrano/multiconfig'

Example

Assume we need next configurations:

  • services:billing:production
  • services:billing:qa
  • blog:production
  • blog:staging
  • dev:wiki

Choose configuration root directory for example config/deploy

Create configuration files:

config/deploy/services/billing/production.rb
config/deploy/services/billing/qa.rb
config/deploy/blog/production.rb
config/deploy/blog/staging.rb
config/deploy/dev/wiki.rb

Add to Capfile:

set :config_root, 'config/deploy'
require 'capistrano/multiconfig'

Put related capistrano configuration to each file according to file meaning.

Check tasks:

$ cap -T
cap services:billing:production # Load services:billing:production configuration
cap services:billing:qa         # Load services:billing:qa configuration
cap blog:production             # Load blog:production configuration
cap blog:staging                # Load blog:staging configuration
cap wiki                        # Load wiki configuration
cap invoke                      # Invoke a single command on the remote servers.
cap shell                       # Begin an interactive Capistrano session.

Let's try to run task without specified configuration:

$ cap shell
triggering start callbacks for `shell'
  * executing `multiconfig:ensure'
No configuration specified. Please specify one of:
  * wiki:production
  * wiki:staging
  * blog:production
  * blog:staging
(e.g. `cap wiki:production shell')

So we must provide configuration as first task:

$ cap services:billing:qa shell

Configuration Loading

Configuration task loads not only configuration associated with it filename. It also recursively load configurations from all namespaces.

For example for :config_root config/deploy task cap apps/blog/qa.rb loads with order next configuration files (if they exist):

  • config/deploy/apps.rb
  • config/deploy/apps/blog.rb
  • config/deploy/apps/blog/qa.rb

So it's easy to put shared configuration.

License

capistrano-multiconfig's People

Contributors

ayanko avatar

Watchers

Tejas R. Mandke avatar James Cloos avatar Kevin Tham avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.