Mina multideploy
Useful tool for parallel deploying on multiple servers with mina.
How it works
This gem will help you deploy the application on multiple servers in parallel. It takes original mina deploy.rb
file, changes application_name
, domain
and starts deploying process.
Installation
Add this line to your application's Gemfile:
gem 'mina-multideploy'
And then execute:
bundle install
Or install it yourself as:
gem install mina-multideploy
Getting Started
Start off by generating a configuration file:
bundle exec rails multideploy:init
It should give you a file in:
config/initializers/multideploy.rb
It should look something like this:
return unless defined? Mina::Multideploy
Mina::Multideploy.configure do |config|
config.servers = {}
# Default velues
# config.original = 'config/deploy.rb'
# config.w_dir = 'tmp/deploy'
end
Configuration
servers
- hash at format domain
=> array of application_name's
.
Example:
config.servers = {
'84.155.207.209' => %w[carghana caryange cartanzania]
'105.87.69.69' => %w[poster]
'48.84.207.183' => %w[codica timebot]
}
It means that your code will be deployed to 3 servers, and there can be several applications on one server.
original
- path to the original mina deploy.rb
file which will be taken as a basic.
w_dir
- path to directory where temoporary files and logs will be created.
Available features
After you have configured servers at config/initializers/multideploy.rb
you can start deploying in two ways.
Semi-automatic deploy (recomended for first deploy)
Run this command:
bundle exec rails multideploy:prepare
You will get file servers_deploy.rb
at working directory (tmp/deploy by default). Check it and run ruby ./tmp/deploy/server_deploy.rb
.
Automatic deploy
Run this command:
bundle exec rails multideploy:start
It will make the same as multideploy:prepare
, but the deployment will start automatically.
Additional information
- all scripts are updated according config file before launch
multideploy:prepare
andmultideploy:start
- add public SSH key, so you can login to server without password. Run
ssh-copy-id user@$host
License
Mina multideploy is released under the MIT License