mina-multideploy 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aca7ad4690b9550048d60ca01c629d187bd788722558ec41a528b3518e662087
4
- data.tar.gz: 52671874308ad8cd188ecdc2f086107b09eb7fe31483ced6b91b1fa44fcb2418
3
+ metadata.gz: 83038c5571c7b1b342091907f32da513b9b33dde67e1612a9ab07a4f6f5bea52
4
+ data.tar.gz: b70f2ecb90eb13e48441c7a97924ebad9bc92c589c5b78b7ce8aa550ab89ed95
5
5
  SHA512:
6
- metadata.gz: a45f632fec2ac0689d50d3cc76e592966412892e8658b3feffda14a46a321f182719318a0b7e7a0c88c0f063b5b94a2ddcbe3672c75dd271365fa84462c7bc36
7
- data.tar.gz: ed2f1996a3032daa0f915416f4a2c31b3dff15781ee8c2a365230071fe5ebb9d1ab0c3fb9d307fa45cf9260a5263687527465cc241014b87372b72d37292e477
6
+ metadata.gz: 145dedec4c592fbee992859d632a7f6dc58b27acb617ca78ba005685cda1ced4c9a4d204c015b0bc48b0ea7ec4568de5fb7edc32e1601540139a666388eb117e
7
+ data.tar.gz: '085f33473bfc8c248659317e69ebd6a46f2e58d6e02995586b988fbfd19a43ef5810d62f8985d5a410153edef2b452cb039dead74eaade0516f339768965f85b'
data/README.md CHANGED
@@ -1,15 +1,17 @@
1
1
  # Mina multideploy
2
2
 
3
- Useful tool for parallel deploying on multiple servers with [mina](https://github.com/mina-deploy/mina).
3
+ A useful tool for parallel deployment on multiple servers with [mina](https://github.com/mina-deploy/mina).
4
4
 
5
5
  ## How it works
6
- 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.
6
+ ![How it works](https://raw.githubusercontent.com/codica2/mina-multideploy/master/docs/images/how-it-works.gif)
7
+
8
+ 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.
7
9
 
8
10
  ## Installation
9
11
  Add this line to your application's Gemfile:
10
12
 
11
13
  ```ruby
12
- gem 'mina-multideploy'
14
+ gem 'mina-multideploy', '~> 1.1.0'
13
15
  ```
14
16
 
15
17
  And then execute:
@@ -23,7 +25,7 @@ gem install mina-multideploy
23
25
  ```
24
26
 
25
27
  ## Getting Started
26
- Start off by generating a configuration file:
28
+ Start by generating a configuration file:
27
29
  ```
28
30
  bundle exec rails multideploy:init
29
31
  ```
@@ -64,7 +66,7 @@ It means that your code will be deployed to 3 servers, and there can be several
64
66
  ## Available features
65
67
  After you have configured servers at `config/initializers/multideploy.rb` you can start deploying in two ways.
66
68
 
67
- ### Semi-automatic deploy (recomended for first deploy)
69
+ ### Semi-automatic deploy (recommended for first deploy)
68
70
  Run this command:
69
71
  ```ruby
70
72
  bundle exec rails multideploy:prepare
@@ -78,14 +80,25 @@ bundle exec rails multideploy:start
78
80
  ```
79
81
  It will make the same as `multideploy:prepare`, but the deployment will start automatically.
80
82
 
83
+ ### Runing mina or rake tasks
84
+ Use command as argument for `multideploy:run`
85
+
86
+ ```ruby
87
+ bundle exec rails "multideploy:run[rake[db:migrate]]"
88
+ ```
89
+
90
+
81
91
  ## Additional information
82
92
  * all scripts are updated according config file before launch `multideploy:prepare` and `multideploy:start`
83
93
  * add public SSH key, so you can login to server without password. Run `ssh-copy-id user@$host`
84
94
 
85
95
  ## License
86
-
87
- Mina multideploy is released under the [MIT License](https://opensource.org/licenses/MIT)
96
+ mina-multideploy is Copyright © 2015-2019 Codica. It is released under the [MIT License](https://opensource.org/licenses/MIT).
88
97
 
89
98
  ## About Codica
90
99
 
91
100
  [![Codica logo](https://www.codica.com/assets/images/logo/logo.svg)](https://www.codica.com)
101
+
102
+ mina-multideploy is maintained and funded by Codica. The names and logos for Codica are trademarks of Codica.
103
+
104
+ We love open source software! See [our other projects](https://github.com/codica2) or [hire us](https://www.codica.com/) to design, develop, and grow your product.
@@ -15,18 +15,25 @@ module Multideploy
15
15
 
16
16
  private
17
17
 
18
- def working_dir
19
- c.w_dir
20
- end
21
-
22
18
  def create_dir
23
19
  FileUtils.mkdir_p(working_dir)
24
20
  end
25
21
 
22
+ def working_dir
23
+ c.w_dir
24
+ end
25
+
26
26
  def deploy_file
27
27
  'servers_deploy.rb'
28
28
  end
29
29
 
30
+ def write_ruby_script
31
+ File.open("#{working_dir}/#{deploy_file}", 'w+') do |f|
32
+ f.write(ruby_script)
33
+ end
34
+ FileUtils.chmod 0o755, "#{working_dir}/#{deploy_file}"
35
+ end
36
+
30
37
  def ruby_script
31
38
  template_path = File.join(File.dirname(__FILE__), "./templates/#{deploy_file}")
32
39
  script = File.read(template_path)
@@ -34,12 +41,5 @@ module Multideploy
34
41
  script = script.gsub('ORIGINAL_DEPLOY_FILE_TO_REPLACE', c.original)
35
42
  script = script.gsub('CUSTOM_W_DIR_TO_REPLACE', c.w_dir)
36
43
  end
37
-
38
- def write_ruby_script
39
- File.open("#{working_dir}/#{deploy_file}", 'w+') do |f|
40
- f.write(ruby_script)
41
- end
42
- FileUtils.chmod 0o755, "#{working_dir}/#{deploy_file}"
43
- end
44
44
  end
45
45
  end
@@ -10,6 +10,7 @@ SERVERS = SERVERS_TO_REPLACE
10
10
  w_dir = Dir.pwd
11
11
  c_dir = "#{w_dir}/CUSTOM_W_DIR_TO_REPLACE/config"
12
12
  l_dir = "#{w_dir}/CUSTOM_W_DIR_TO_REPLACE/log"
13
+ command_argument = ARGV[0] || 'deploy'
13
14
 
14
15
  original_deploy_config = File.read("#{w_dir}/ORIGINAL_DEPLOY_FILE_TO_REPLACE")
15
16
  max_ip_length = SERVERS.keys.map(&:length).max + 1
@@ -36,13 +37,14 @@ Parallel.each(SERVERS, in_threads: SERVERS.length) do |ip, names|
36
37
  FileUtils.rm "#{l_dir}/#{l_file_name}" if File.exist?("#{l_dir}/#{l_file_name}")
37
38
  File.write("#{c_dir}/#{c_file_name}", custom_deploy_config)
38
39
 
39
- cmd = "mina deploy -f #{c_dir}/#{c_file_name}"
40
+ cmd = "mina #{command_argument} -f #{c_dir}/#{c_file_name}"
40
41
  cmd = `#{cmd}`
41
42
 
42
43
  logger = Logger.new("#{l_dir}/#{l_file_name}")
43
44
  logger.info(cmd)
44
45
 
45
- report += "#{site} ✗ " if cmd.include?('ERROR: Deploy failed.')
46
+ report += "#{site} ✗ " if cmd.include?('ERROR')
47
+
46
48
  bar.advance(report: report)
47
49
  end
48
50
  end
@@ -1,5 +1,5 @@
1
1
  module Mina
2
2
  module Multideploy
3
- VERSION = '1.1.0'.freeze
3
+ VERSION = '1.2.0'.freeze
4
4
  end
5
5
  end
@@ -15,9 +15,16 @@ namespace :multideploy do
15
15
  end
16
16
 
17
17
  desc 'Prepare deploy scripts and start deploying'
18
- task start: :environment do
18
+ task :start :environment do
19
19
  c = Mina::Multideploy.configuration
20
20
  Multideploy::CreateScripts.call
21
21
  exec "ruby ./#{c.w_dir}/servers_deploy.rb"
22
22
  end
23
+
24
+ desc 'Runing mina or rake tasks'
25
+ task :run, [:task_arg] => [:environment] do |task, args|
26
+ c = Mina::Multideploy.configuration
27
+ Multideploy::CreateScripts.call
28
+ exec "ruby ./#{c.w_dir}/servers_deploy.rb #{args[:task_arg]}"
29
+ end
23
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mina-multideploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Volkov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-22 00:00:00.000000000 Z
11
+ date: 2019-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,6 +98,7 @@ files:
98
98
  - Rakefile
99
99
  - bin/console
100
100
  - bin/setup
101
+ - docs/images/how-it-works.gif
101
102
  - lib/mina/multideploy.rb
102
103
  - lib/mina/multideploy/base_service.rb
103
104
  - lib/mina/multideploy/create_scripts.rb
@@ -126,8 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
127
  - !ruby/object:Gem::Version
127
128
  version: '0'
128
129
  requirements: []
129
- rubyforge_project:
130
- rubygems_version: 2.7.7
130
+ rubygems_version: 3.0.6
131
131
  signing_key:
132
132
  specification_version: 4
133
133
  summary: Parallel deploying on multiple servers with mina.