magic_recipes_two 0.0.93 → 0.0.94
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/capistrano/magic_recipes/version.rb +1 -1
- data/lib/capistrano/tasks/sidekiq_six.rake +1 -1
- data/lib/capistrano/tasks/thin.rake +1 -1
- data/lib/capistrano/tasks/thin_sysd.rake +41 -15
- data/lib/generators/capistrano/magic_recipes/templates/thin.service.erb +5 -5
- data/lib/generators/capistrano/magic_recipes/templates/thin_app_yml.erb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b50067781cfa8d65ac3c4ae487d5fa03dbe28ef2d26e7941219df9cee775a0cf
|
4
|
+
data.tar.gz: a9c3c528b5786f54ce9c239f74eb4f1a067fb5706b788bfc593b44d96ca65054
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1009790183b10583e375dfaed183b921d422ae90118bc6b6b06b2b423696b1dbacc080c00476652cb44fbc4065085578c34a2f2cc935477dbe281307e8203bc
|
7
|
+
data.tar.gz: d8c692af47aa1e66249a1ebd6d0d453ac61d509cb37a2e708aee2f2682bb71757d500d2daa0ddb6effe0755c666e69215e60e7c1447b89b73b515ce185482f98
|
@@ -26,7 +26,7 @@ namespace :load do
|
|
26
26
|
|
27
27
|
set :sidekiq_six_ruby_vm, -> { :system } # ( :rvm | :rbenv | :system )
|
28
28
|
|
29
|
-
set :sidekiq_six_user, -> { 'deploy' }
|
29
|
+
set :sidekiq_six_user, -> { fetch(:user, 'deploy') } # role-user
|
30
30
|
set :sidekiq_six_log_lines, -> { 100 }
|
31
31
|
|
32
32
|
end
|
@@ -13,13 +13,17 @@ namespace :load do
|
|
13
13
|
set :thin_require, -> { [] }
|
14
14
|
set :thin_wait, -> { 90 }
|
15
15
|
set :thin_onebyone, -> { true }
|
16
|
-
|
16
|
+
# https://help.cloud66.com/rails/how-to-guides/rack-servers/thin-rack-server.html
|
17
|
+
# You should not daemonize the custom_web process !!!
|
18
|
+
set :thin_daemonize, -> { false }
|
17
19
|
set :thin_hooks, -> { true }
|
18
20
|
|
19
|
-
set :
|
20
|
-
set :
|
21
|
-
set :
|
22
|
-
set :
|
21
|
+
set :thin_daemon_ruby_vm, -> { :system } # ( :rvm | :rbenv | :system )
|
22
|
+
set :thin_daemon_file, -> { "thin_#{fetch(:application)}_#{fetch(:stage)}" }
|
23
|
+
set :thin_daemon_path, -> { "/lib/systemd/system" }
|
24
|
+
set :thin_daemon_template, -> { :default }
|
25
|
+
set :thin_daemon_log_lines, -> { 100 }
|
26
|
+
set :thin_daemon_user, -> { fetch(:user, 'deploy') } # role-user
|
23
27
|
|
24
28
|
end
|
25
29
|
end
|
@@ -27,17 +31,31 @@ end
|
|
27
31
|
|
28
32
|
namespace :thin do
|
29
33
|
|
30
|
-
def
|
31
|
-
if fetch(:
|
34
|
+
def upload_thin_daemon
|
35
|
+
if fetch(:thin_daemon_template, :default) == :default
|
32
36
|
magic_template("thin.service", '/tmp/thin.service')
|
33
37
|
else
|
34
|
-
magic_template(fetch(:
|
38
|
+
magic_template(fetch(:thin_daemon_template), '/tmp/thin.service')
|
35
39
|
end
|
36
|
-
execute :sudo, :mv, '/tmp/thin.service', "#{ fetch(:
|
40
|
+
execute :sudo, :mv, '/tmp/thin.service', "#{ fetch(:thin_daemon_path) }/#{ fetch(:thin_daemon_file) }.service"
|
37
41
|
end
|
38
42
|
|
39
43
|
|
40
|
-
|
44
|
+
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
|
45
|
+
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
|
46
|
+
|
47
|
+
|
48
|
+
desc 'Create and upload thin daemon file'
|
49
|
+
task :upload_daemon do
|
50
|
+
on roles fetch(:thin_roles) do
|
51
|
+
within current_path do
|
52
|
+
upload_thin_daemon()
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
desc "Create and upload thin config file"
|
41
59
|
task :reconf do
|
42
60
|
on release_roles fetch(:thin_roles) do
|
43
61
|
within current_path do
|
@@ -55,7 +73,9 @@ namespace :thin do
|
|
55
73
|
desc "#{cmnd.capitalize} thin service"
|
56
74
|
task cmnd.gsub(/-/, '_') do
|
57
75
|
on roles fetch(:thin_roles) do
|
58
|
-
|
76
|
+
within current_path do
|
77
|
+
execute :sudo, :systemctl, cmnd, fetch(:thin_daemon_file)
|
78
|
+
end
|
59
79
|
end
|
60
80
|
end
|
61
81
|
end
|
@@ -63,14 +83,18 @@ namespace :thin do
|
|
63
83
|
desc "Quiet thin service"
|
64
84
|
task :quiet do
|
65
85
|
on roles fetch(:thin_roles) do
|
66
|
-
|
86
|
+
within current_path do
|
87
|
+
execute :sudo, :systemctl, 'kill -s TSTP', fetch(:thin_daemon_file)
|
88
|
+
end
|
67
89
|
end
|
68
90
|
end
|
69
91
|
|
70
92
|
desc "Get logs for thin service"
|
71
93
|
task :logs do
|
72
94
|
on roles fetch(:thin_roles) do
|
73
|
-
|
95
|
+
within current_path do
|
96
|
+
execute :sudo, :journalctl, '-u', fetch(:thin_daemon_file), '-rn', fetch(:thin_daemon_log_lines, 100)
|
97
|
+
end
|
74
98
|
end
|
75
99
|
end
|
76
100
|
|
@@ -78,15 +102,17 @@ namespace :thin do
|
|
78
102
|
desc "check thin service status"
|
79
103
|
task :check_status do
|
80
104
|
on roles fetch(:thin_roles) do
|
105
|
+
within current_path do
|
81
106
|
puts "#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#"
|
82
107
|
puts "#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#"
|
83
|
-
puts fetch(:
|
108
|
+
puts fetch(:thin_daemon_file)
|
84
109
|
puts "#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#"
|
85
|
-
output = capture :sudo, "systemctl status", fetch(:
|
110
|
+
output = capture :sudo, "systemctl status", fetch(:thin_daemon_file)
|
86
111
|
output.each_line do |line|
|
87
112
|
puts line
|
88
113
|
end
|
89
114
|
puts "#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#"
|
115
|
+
end
|
90
116
|
end
|
91
117
|
end
|
92
118
|
|
@@ -1,20 +1,20 @@
|
|
1
1
|
[Unit]
|
2
|
-
Description=<%= fetch(:
|
2
|
+
Description=<%= fetch(:thin_daemon_file) %>
|
3
3
|
After=syslog.target
|
4
4
|
After=network.target
|
5
5
|
|
6
6
|
[Service]
|
7
7
|
Type=forking
|
8
8
|
|
9
|
-
User=<%=
|
10
|
-
Group=<%=
|
9
|
+
User=<%= fetch(:thin_daemon_user) %>
|
10
|
+
Group=<%= fetch(:thin_daemon_user) %>
|
11
11
|
|
12
12
|
WorkingDirectory=<%= current_path %>
|
13
|
-
<% if fetch(:
|
13
|
+
<% if fetch(:thin_daemon_ruby_vm) == :rbenv %>
|
14
14
|
ExecStart=/bin/bash -lc 'exec /home/deploy/.rbenv/shims/bundle exec thin -C config/thin_app_<%= fetch(:stage) %>.yml start'
|
15
15
|
ExecStop=/bin/bash -lc 'exec /home/deploy/.rbenv/shims/bundle exec thin -C config/thin_app_<%= fetch(:stage) %>.yml stop'
|
16
16
|
ExecReload=/bin/bash -lc 'exec /home/deploy/.rbenv/shims/bundle exec thin -C config/thin_app_<%= fetch(:stage) %>.yml restart'
|
17
|
-
<% elsif fetch(:
|
17
|
+
<% elsif fetch(:thin_daemon_ruby_vm) == :rvm %>
|
18
18
|
ExecStart=<%= fetch(:rvm_path) %>/bin/rvm <%= fetch(:rvm_ruby_version) %> do bundle exec thin -C config/thin_app_<%= fetch(:stage) %>.yml start
|
19
19
|
ExecStop=<%= fetch(:rvm_path) %>/bin/rvm <%= fetch(:rvm_ruby_version) %> do bundle exec thin -C config/thin_app_<%= fetch(:stage) %>.yml stop
|
20
20
|
ExecReload=<%= fetch(:rvm_path) %>/bin/rvm <%= fetch(:rvm_ruby_version) %> do bundle exec thin -C config/thin_app_<%= fetch(:stage) %>.yml restart
|
@@ -15,5 +15,5 @@ wait: <%= fetch(:thin_wait) %>
|
|
15
15
|
servers: <%= fetch(:app_instances) %>
|
16
16
|
# user: <%= fetch(:user) %>
|
17
17
|
socket: /tmp/thin.<%= fetch(:application) %>.<%= fetch(:stage) %>.sock
|
18
|
-
daemonize: <%= fetch(:
|
18
|
+
daemonize: <%= fetch(:thin_daemonize) %>
|
19
19
|
onebyone: <%= fetch(:thin_onebyone) %>
|