A useful tool for parallel deployment on multiple servers with mina.
This gem will help you to deploy the application on multiple servers simultaneously. It takes original mina deploy.rb
file, changes application_name
, domain
and starts the deployment process.
Add this line to your application's Gemfile:
gem 'mina-multideploy', '~> 1.1.0'
And then execute:
bundle install
Or install it yourself as:
gem install mina-multideploy
Start 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
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.
After you have configured servers at config/initializers/multideploy.rb
you can start deploying in two ways.
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
.
Run this command:
bundle exec rails multideploy:start
It will make the same as multideploy:prepare
, but the deployment will start automatically.
Use command as argument for multideploy:run
bundle exec rails "multideploy:run[rake[db:migrate]]"
- 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
mina-multideploy is Copyright © 2015-2019 Codica. It is released under the MIT License.
mina-multideploy is maintained and funded by Codica. The names and logos for Codica are trademarks of Codica.
We love open source software! See our other projects or hire us to design, develop, and grow your product.