Mina::Proteus
Plugin for Mina that adds support for multiple stages and multiple apps to Mina, specifically built for Hanami ruby framework. This gem is based on endoze's mina-multistage gem, huge thanks to him!
Installation & Usage
Add this line to your application's Gemfile:
gem 'mina-proteus', require: false
And then execute:
$ bundle install
Or install it yourself as:
$ gem install mina-proteus
Require mina/proteus
in your config/deploy.rb
:
# config/deploy.rb
require 'mina/proteus'
require 'mina/bundler'
require 'mina/git'
...
task setup: do
...
end
desc 'Deploys the current version to the server.'
task deploy: do
...
end
You then need to specify your hanami apps like this:
# config/deploy.rb
set :hanami_apps, %w(app1 app2 app3)
That's the only required parameter, optional parameters are:
# config/deploy.rb
set :stages, %w(staging production) #specify your stages
set :stages_dir, 'config/deploy' #specify which directory will have all the configurations files
set :default_stage, 'staging' #specify your default stage
#this is used to deploy a single application in a specific environment
set :bundle_prefix, -> { %{HANAMI_ENV="#{fetch(:current_stage)}" HANAMI_APPS="#{fetch(:current_app)}" #{fetch(:bundle_bin)} exec} }
Note that current_stage
and current_app
are respectively the stage and the application being called.
Then to create every file run:
$ bundle exec mina proteus:init
This will create config/deploy/staging.rb
and config/deploy/production.rb
stage files and
config/deploy/staging/app1.rb
, config/deploy/staging/app1.rb
, etc.
Use them to define stage and app specific configuration.
Now you can deploy the default stage with:
$ mina <APP-NAME> deploy # this deploys to :default_stage
Or specify a stage explicitly:
$ mina staging <APP-NAME> deploy
$ mina production <APP-NAME> deploy
Maintenance and Contribution
I'll be rarely maintaining this source code due to lack of time, but i will do as much as i can to resolve any open issues. If you want to contribute, feel free to fork it, branch it and to create a pull request.