magic_recipes_two 0.0.91 → 0.0.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/capistrano/magic_recipes/backup.rb +1 -0
- data/lib/capistrano/magic_recipes/sidekiq_six.rb +1 -0
- data/lib/capistrano/magic_recipes/thin_sysd.rb +1 -0
- data/lib/capistrano/magic_recipes/version.rb +1 -1
- data/lib/capistrano/tasks/backup.rake +38 -0
- data/lib/capistrano/tasks/db.rake +29 -0
- data/lib/capistrano/tasks/lets_encrypt.rake +31 -6
- data/lib/capistrano/tasks/monit.rake +30 -13
- data/lib/capistrano/tasks/secrets.rake +18 -0
- data/lib/capistrano/tasks/sidekiq_six.rake +199 -0
- data/lib/capistrano/tasks/thin.rake +2 -1
- data/lib/capistrano/tasks/thin_sysd.rake +113 -0
- data/lib/generators/capistrano/magic_recipes/templates/monit/website.erb +0 -8
- data/lib/generators/capistrano/magic_recipes/templates/monit/websiteX.erb +23 -0
- data/lib/generators/capistrano/magic_recipes/templates/redirect_page.html.erb +2 -2
- data/lib/generators/capistrano/magic_recipes/templates/sidekiq.docu-service.erb +79 -0
- data/lib/generators/capistrano/magic_recipes/templates/sidekiq.service.erb +33 -0
- data/lib/generators/capistrano/magic_recipes/templates/thin.service.erb +33 -0
- data/lib/generators/capistrano/magic_recipes/templates/thin_app_yml.erb +1 -1
- metadata +17 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: de82290a078d6de6dd0db27958456070b1cb88ef998c46bd84472743bf252983
|
4
|
+
data.tar.gz: c326693d2f0a94bb3ec60c5d3abd47ebc2ae63f9179186511322bf4931e4f1e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8de6f633599241a991d78fc9741b4a0829f1accfb43357002332ec9c497a2aba8a24871f77a36a145b53678217748bf9b2af06017b295b59176064c072d0373a
|
7
|
+
data.tar.gz: 3caf010043617bb8cdf99332bf12d6e3da066875042b53d061c182c9740ae1fa9df75d1eb32a776810bd7a1f76e7cb4fc7c3215e0889efec90d5af20733ddb6b
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../../tasks/backup.rake", __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../../tasks/sidekiq_six.rake", __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
load File.expand_path("../../tasks/thin_sysd.rake", __FILE__)
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'capistrano/magic_recipes/base_helpers'
|
2
|
+
include Capistrano::MagicRecipes::BaseHelpers
|
3
|
+
|
4
|
+
|
5
|
+
namespace :load do
|
6
|
+
task :defaults do
|
7
|
+
|
8
|
+
set :backup_attachment_roles, -> { :web }
|
9
|
+
set :backup_attachment_name, -> { 'dragonfly' }
|
10
|
+
set :backup_attachment_remote_path, -> { "#{host.user}@#{host.hostname}:#{shared_path}/public/system/dragonfly/live" }
|
11
|
+
set :backup_attachment_local_path, -> { "backups/#{ fetch(:backup_attachment_name) }/#{ fetch(:stage) }" }
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
namespace :backup do
|
19
|
+
|
20
|
+
desc "download attachment files from server"
|
21
|
+
task :get_attachments do
|
22
|
+
on roles fetch(:backup_attachment_roles) do
|
23
|
+
run_locally do
|
24
|
+
execute :mkdir, "-p #{fetch(:backup_attachment_local_path)}"
|
25
|
+
end
|
26
|
+
run_locally { execute "rsync -av --delete #{ fetch(:backup_attachment_remote_path) }/ #{ fetch(:backup_attachment_local_path) }" }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "upload attachment files from local machine"
|
31
|
+
task :push_attachment do
|
32
|
+
on roles fetch(:backup_attachment_roles) do
|
33
|
+
run_locally { execute "rsync -av --delete #{ fetch(:backup_attachment_local_path) }/ #{ fetch(:backup_attachment_remote_path) }" }
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
end
|
@@ -34,6 +34,35 @@ namespace :db do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
|
38
|
+
desc "upload data.yml to server and load it = DELETES EXISTING DATA"
|
39
|
+
task :upload_and_replace_data do
|
40
|
+
on roles fetch(:db_roles) do
|
41
|
+
puts()
|
42
|
+
puts()
|
43
|
+
puts(" ! ! ! C A U T I O N ! ! ! ! ")
|
44
|
+
puts()
|
45
|
+
puts()
|
46
|
+
puts("This will upload 'local-App/db/data.yml' and load it in current DB")
|
47
|
+
puts()
|
48
|
+
puts("This will DELETE ALL DATA in your #{ fetch(:stage) } DB!!")
|
49
|
+
puts()
|
50
|
+
ask(:are_you_sure, 'no')
|
51
|
+
if fetch(:are_you_sure, 'no').to_s.downcase == 'yes'
|
52
|
+
local_dir = "./db/data.yml"
|
53
|
+
remote_dir = "#{host.user}@#{host.hostname}:#{release_path}/db/data.yml"
|
54
|
+
puts(".. uploading db/data.yml")
|
55
|
+
run_locally { execute "rsync -av --delete #{local_dir} #{remote_dir}" }
|
56
|
+
puts(".. loading data.yml in #{ fetch(:stage) } DB")
|
57
|
+
within release_path do
|
58
|
+
execute :bundle, :exec, :rake, "db:data:load RAILS_ENV=#{fetch(:stage)}"
|
59
|
+
end
|
60
|
+
else
|
61
|
+
puts(".. stoped process ..")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
37
66
|
end
|
38
67
|
|
39
68
|
namespace :deploy do
|
@@ -14,6 +14,7 @@ namespace :load do
|
|
14
14
|
# set :lets_encrypt_renew_hour, -> { "3" }
|
15
15
|
set :lets_encrypt_cron_log, -> { "#{shared_path}/log/lets_encrypt_cron.log" }
|
16
16
|
set :lets_encrypt_email, -> { "ssl@example.com" }
|
17
|
+
set :lets_encrypt_client, -> { "certbot-auto" } # "new: certbot" / "certbot-auto"
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
@@ -23,8 +24,16 @@ namespace :lets_encrypt do
|
|
23
24
|
task :install do
|
24
25
|
on release_roles fetch(:lets_encrypt_roles) do
|
25
26
|
within fetch(:lets_encrypt_path) do
|
26
|
-
|
27
|
-
|
27
|
+
if fetch(:lets_encrypt_client) == "certbot-auto"
|
28
|
+
execute "wget https://dl.eff.org/certbot-auto"
|
29
|
+
execute "chmod a+x certbot-auto"
|
30
|
+
else
|
31
|
+
execute :sudo, "snap install core"
|
32
|
+
execute :sudo, "snap refresh core"
|
33
|
+
execute :sudo, "snap install --classic certbot"
|
34
|
+
execute :sudo, "ln -s /snap/bin/certbot /usr/bin/certbot"
|
35
|
+
execute :sudo, "snap set certbot trust-plugin-with-root=ok"
|
36
|
+
end
|
28
37
|
end
|
29
38
|
end
|
30
39
|
end
|
@@ -34,7 +43,11 @@ namespace :lets_encrypt do
|
|
34
43
|
task :certonly do
|
35
44
|
on release_roles fetch(:lets_encrypt_roles) do
|
36
45
|
# execute "./certbot-auto certonly --webroot -w /var/www/example -d example.com -d www.example.com -w /var/www/thing -d thing.is -d m.thing.is"
|
37
|
-
|
46
|
+
if fetch(:lets_encrypt_client) == "certbot-auto"
|
47
|
+
execute :sudo, "#{ fetch(:lets_encrypt_path) }/certbot-auto --non-interactive --agree-tos --allow-subset-of-names --email #{fetch(:lets_encrypt_email)} certonly --webroot -w #{current_path}/public #{ Array(fetch(:lets_encrypt_domains)).map{ |d| "-d #{d.gsub(/^\*?\./, "")}#{ fetch(:lets_encrypt__www_domains,false) ? " -d www.#{d.gsub(/^\*?\./, "")}" : "" }" }.join(" ") }"
|
48
|
+
else
|
49
|
+
execute :sudo, "certbot --non-interactive --agree-tos --allow-subset-of-names --email #{fetch(:lets_encrypt_email)} certonly --webroot -w #{current_path}/public #{ Array(fetch(:lets_encrypt_domains)).map{ |d| "-d #{d.gsub(/^\*?\./, "")}#{ fetch(:lets_encrypt__www_domains,false) ? " -d www.#{d.gsub(/^\*?\./, "")}" : "" }" }.join(" ") }"
|
50
|
+
end
|
38
51
|
end
|
39
52
|
end
|
40
53
|
|
@@ -46,7 +59,11 @@ namespace :lets_encrypt do
|
|
46
59
|
# execute :sudo, "echo '42 0,12 * * * root (#{ fetch(:lets_encrypt_path) }/certbot-auto renew --quiet) >> #{shared_path}/lets_encrypt_cron.log 2>&1' | cat > #{ fetch(:lets_encrypt_path) }/lets_encrypt_cronjob"
|
47
60
|
# execute :sudo, "echo '#{ fetch(:lets_encrypt_renew_minute) } #{ fetch(:lets_encrypt_renew_hour) } * * * root #{ fetch(:lets_encrypt_path) }/certbot-auto renew --no-self-upgrade --allow-subset-of-names --post-hook \"#{fetch(:nginx_service_path)} restart\" >> #{ fetch(:lets_encrypt_cron_log) } 2>&1' | cat > #{ fetch(:lets_encrypt_path) }/lets_encrypt_cronjob"
|
48
61
|
# just once a week
|
49
|
-
|
62
|
+
if fetch(:lets_encrypt_client) == "certbot-auto"
|
63
|
+
execute :sudo, "echo '0 0 * * 0 root #{ fetch(:lets_encrypt_path) }/certbot-auto renew --no-self-upgrade --allow-subset-of-names --post-hook \"#{fetch(:nginx_service_path)} restart\" >> #{ fetch(:lets_encrypt_cron_log) } 2>&1' | cat > #{ fetch(:lets_encrypt_path) }/lets_encrypt_cronjob"
|
64
|
+
else
|
65
|
+
execute :sudo, "echo '0 0 * * 0 root certbot renew --no-self-upgrade --allow-subset-of-names --post-hook \"#{fetch(:nginx_service_path)} restart\" >> #{ fetch(:lets_encrypt_cron_log) } 2>&1' | cat > #{ fetch(:lets_encrypt_path) }/lets_encrypt_cronjob"
|
66
|
+
end
|
50
67
|
execute :sudo, "mv -f #{ fetch(:lets_encrypt_path) }/lets_encrypt_cronjob /etc/cron.d/lets_encrypt"
|
51
68
|
execute :sudo, "chown -f root:root /etc/cron.d/lets_encrypt"
|
52
69
|
execute :sudo, "chmod -f 0644 /etc/cron.d/lets_encrypt"
|
@@ -58,7 +75,11 @@ namespace :lets_encrypt do
|
|
58
75
|
task :dry_renew do
|
59
76
|
on release_roles fetch(:lets_encrypt_roles) do
|
60
77
|
# execute :sudo, "#{ fetch(:lets_encrypt_path) }/certbot-auto renew --dry-run"
|
61
|
-
|
78
|
+
if fetch(:lets_encrypt_client) == "certbot-auto"
|
79
|
+
output = capture(:sudo, "#{ fetch(:lets_encrypt_path) }/certbot-auto renew --dry-run")
|
80
|
+
else
|
81
|
+
output = capture(:sudo, "certbot renew --dry-run")
|
82
|
+
end
|
62
83
|
puts "#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#"
|
63
84
|
output.each_line do |line|
|
64
85
|
puts line
|
@@ -97,7 +118,11 @@ namespace :lets_encrypt do
|
|
97
118
|
task :certonly_expand do
|
98
119
|
on release_roles fetch(:lets_encrypt_roles) do
|
99
120
|
# execute "./certbot-auto certonly --webroot -w /var/www/example -d example.com -d www.example.com -w /var/www/thing -d thing.is -d m.thing.is"
|
100
|
-
|
121
|
+
if fetch(:lets_encrypt_client) == "certbot-auto"
|
122
|
+
execute :sudo, "#{ fetch(:lets_encrypt_path) }/certbot-auto --non-interactive --agree-tos --allow-subset-of-names --email #{fetch(:lets_encrypt_email)} certonly --webroot -w #{current_path}/public #{ Array(fetch(:lets_encrypt_domains)).map{ |d| "-d #{d.gsub(/^\*?\./, "")}#{ fetch(:lets_encrypt__www_domains,false) ? " -d www.#{d.gsub(/^\*?\./, "")}" : "" }" }.join(" ") } --expand"
|
123
|
+
else
|
124
|
+
execute :sudo, "certbot --non-interactive --agree-tos --allow-subset-of-names --email #{fetch(:lets_encrypt_email)} certonly --webroot -w #{current_path}/public #{ Array(fetch(:lets_encrypt_domains)).map{ |d| "-d #{d.gsub(/^\*?\./, "")}#{ fetch(:lets_encrypt__www_domains,false) ? " -d www.#{d.gsub(/^\*?\./, "")}" : "" }" }.join(" ") } --expand"
|
125
|
+
end
|
101
126
|
end
|
102
127
|
end
|
103
128
|
|
@@ -14,7 +14,7 @@ namespace :load do
|
|
14
14
|
## Status
|
15
15
|
set :monit_active, -> { true }
|
16
16
|
set :monit_main_rc, -> { true }
|
17
|
-
# set :monit_processes, -> { %w[nginx pm2 postgresql pwa redis sidekiq thin website] }
|
17
|
+
# set :monit_processes, -> { %w[nginx pm2 postgresql pwa redis sidekiq thin website website2 website3] }
|
18
18
|
set :monit_processes, -> { %w[nginx postgresql thin website] }
|
19
19
|
set :monit_name, -> { "#{ fetch(:application) }_#{ fetch(:stage) }" }
|
20
20
|
## Mailer
|
@@ -61,6 +61,18 @@ namespace :load do
|
|
61
61
|
set :monit_website_check_content, -> { false }
|
62
62
|
set :monit_website_check_path, -> { "/" }
|
63
63
|
set :monit_website_check_text, -> { "<!DOCTYPE html>" }
|
64
|
+
## Website2
|
65
|
+
set :monit_website2_check_domains, -> { [] }
|
66
|
+
set :monit_website2_check_ssl, -> { false }
|
67
|
+
set :monit_website2_check_content, -> { false }
|
68
|
+
set :monit_website2_check_path, -> { "/" }
|
69
|
+
set :monit_website2_check_text, -> { "<!DOCTYPE html>" }
|
70
|
+
## Website3
|
71
|
+
set :monit_website3_check_domains, -> { [] }
|
72
|
+
set :monit_website3_check_ssl, -> { false }
|
73
|
+
set :monit_website3_check_content, -> { false }
|
74
|
+
set :monit_website3_check_path, -> { "/" }
|
75
|
+
set :monit_website3_check_text, -> { "<!DOCTYPE html>" }
|
64
76
|
## M/Monit
|
65
77
|
set :monit_mmonit_url, -> { false }
|
66
78
|
|
@@ -103,7 +115,7 @@ namespace :monit do
|
|
103
115
|
# invoke "monit:redis"
|
104
116
|
# invoke "monit:thin"
|
105
117
|
# invoke "monit:configure_website"
|
106
|
-
%w[nginx pm2 postgresql pwa redis sidekiq thin website].each do |command|
|
118
|
+
%w[nginx pm2 postgresql pwa redis sidekiq thin website website2 website3].each do |command|
|
107
119
|
invoke "monit:configure_#{command}" if Array(fetch(:monit_processes)).include?(command)
|
108
120
|
end
|
109
121
|
if fetch(:monit_webclient, false) && fetch(:monit_webclient_domain, false)
|
@@ -124,10 +136,11 @@ namespace :monit do
|
|
124
136
|
end
|
125
137
|
|
126
138
|
%w[nginx pm2 postgresql redis sidekiq thin].each do |process|
|
139
|
+
namespace process.to_sym do
|
127
140
|
|
128
141
|
%w[monitor unmonitor start stop restart].each do |command|
|
129
142
|
desc "#{command} monit-service for: #{process}"
|
130
|
-
task "#{command}
|
143
|
+
task "#{command}" do
|
131
144
|
if Array(fetch(:monit_processes)).include?(process)
|
132
145
|
on roles(fetch("#{process}_roles".to_sym)) do
|
133
146
|
if process == "sidekiq"
|
@@ -154,7 +167,7 @@ namespace :monit do
|
|
154
167
|
if %w[nginx postgresql redis].include?(process)
|
155
168
|
## Server specific tasks (gets overwritten by other environments!)
|
156
169
|
desc "Upload Monit #{process} config file (server specific)"
|
157
|
-
task "
|
170
|
+
task "configure" do
|
158
171
|
if Array(fetch(:monit_processes)).include?(process)
|
159
172
|
on release_roles fetch("#{process}_roles".to_sym) do |role|
|
160
173
|
monit_config( process, nil, role )
|
@@ -164,7 +177,7 @@ namespace :monit do
|
|
164
177
|
elsif %w[pm2 pwa sidekiq thin].include?(process)
|
165
178
|
## App specific tasks (unique for app and environment)
|
166
179
|
desc "Upload Monit #{process} config file (app specific)"
|
167
|
-
task "
|
180
|
+
task "configure" do
|
168
181
|
if Array(fetch(:monit_processes)).include?(process)
|
169
182
|
on release_roles fetch("#{process}_roles".to_sym) do |role|
|
170
183
|
monit_config process, "/etc/monit/conf.d/#{fetch(:application)}_#{fetch(:stage)}_#{process}.conf", role
|
@@ -173,19 +186,23 @@ namespace :monit do
|
|
173
186
|
end
|
174
187
|
end
|
175
188
|
|
189
|
+
end
|
176
190
|
end
|
177
191
|
|
178
|
-
%w[pwa website].each do |process|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
192
|
+
%w[pwa website website2 website3].each do |process|
|
193
|
+
namespace process.to_sym do
|
194
|
+
|
195
|
+
desc "Upload Monit #{process} config file (app specific)"
|
196
|
+
task "configure_#{process}" do
|
197
|
+
if Array(fetch(:monit_processes)).include?(process)
|
198
|
+
on release_roles fetch("#{process =~ /website/ ? 'nginx' : process}_roles".to_sym, :web) do |role|
|
199
|
+
process_file = process =~ /^website\d{1}$/ ? 'websiteX' : process
|
200
|
+
monit_config process, "/etc/monit/conf.d/#{fetch(:application)}_#{fetch(:stage)}_#{process}.conf", role
|
201
|
+
end
|
185
202
|
end
|
186
203
|
end
|
204
|
+
|
187
205
|
end
|
188
|
-
|
189
206
|
end
|
190
207
|
|
191
208
|
|
@@ -116,6 +116,24 @@ namespace :secrets do
|
|
116
116
|
end
|
117
117
|
|
118
118
|
|
119
|
+
namespace :keys do
|
120
|
+
|
121
|
+
desc "upload master.key to server"
|
122
|
+
task :upload_master do
|
123
|
+
on roles %w{app db web} do
|
124
|
+
|
125
|
+
%w(master.key credentials.yml.enc).each do |that|
|
126
|
+
puts "syncing: #{that}"
|
127
|
+
local_dir = "./config/#{ that }"
|
128
|
+
remote_dir = "#{host.user}@#{host.hostname}:#{shared_path}/config/#{ that }"
|
129
|
+
run_locally { execute "rsync -av --delete #{local_dir} #{remote_dir}" }
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
119
137
|
|
120
138
|
|
121
139
|
desc 'Server setup tasks'
|
@@ -0,0 +1,199 @@
|
|
1
|
+
##
|
2
|
+
## NEW! for sidekiqs new deamonized style
|
3
|
+
##
|
4
|
+
|
5
|
+
# https://github.com/seuros/capistrano-sidekiq
|
6
|
+
namespace :load do
|
7
|
+
task :defaults do
|
8
|
+
set :sidekiq_six_default_hooks, -> { true }
|
9
|
+
set :sidekiq_six_deamon_file, -> { "sidekiq_#{fetch(:application)}_#{fetch(:stage)}" }
|
10
|
+
set :sidekiq_six_timeout, -> { 10 }
|
11
|
+
set :sidekiq_six_roles, -> { :app }
|
12
|
+
set :sidekiq_six_processes, -> { 1 }
|
13
|
+
# Sidekiq queued processes:
|
14
|
+
|
15
|
+
set :sidekiq_six_special_queues, -> { false }
|
16
|
+
set :sidekiq_six_queued_processes, -> { [] }
|
17
|
+
## If needed you can set special queues and configure it seperately
|
18
|
+
## .. options:
|
19
|
+
## - queue: string # => queue-name (default: "default")
|
20
|
+
## - processes: integer # => number processes (default: 1)
|
21
|
+
## - worker: integer # => concurrency (default: 7)
|
22
|
+
## => [ { queue: "queue_name", processes: "count", worker: "count" }]
|
23
|
+
|
24
|
+
set :sidekiq_six_deamon_path, -> { "/lib/systemd/system" }
|
25
|
+
set :sidekiq_six_deamon_template, -> { :default }
|
26
|
+
|
27
|
+
set :sidekiq_six_ruby_vm, -> { :system } # ( :rvm | :rbenv | :system )
|
28
|
+
|
29
|
+
set :sidekiq_six_user, -> { 'deploy' } # role-user
|
30
|
+
set :sidekiq_six_log_lines, -> { 100 }
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
namespace :sidekiq_six do
|
37
|
+
|
38
|
+
def for_each_process(reverse = false, &block)
|
39
|
+
pids = processes_deamones
|
40
|
+
pids.reverse! if reverse
|
41
|
+
pids.each_with_index do |service_file, idx|
|
42
|
+
within fetch(:sidekiq_six_deamon_path) do
|
43
|
+
yield(service_file, idx)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def processes_deamones
|
49
|
+
deamons = []
|
50
|
+
if fetch(:sidekiq_six_special_queues)
|
51
|
+
fetch(:sidekiq_six_queued_processes, []).each do |qp|
|
52
|
+
counter = (qp[:processes] && qp[:processes].to_i > 0 ? qp[:processes].to_i : 1)
|
53
|
+
if counter > 1
|
54
|
+
counter.times do |idx|
|
55
|
+
deamons.push "#{ fetch(:sidekiq_six_deamon_file) }-#{ qp[:queue] }-#{ idx }"
|
56
|
+
end
|
57
|
+
else
|
58
|
+
deamons.push "#{ fetch(:sidekiq_six_deamon_file) }-#{ qp[:queue] }"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
else
|
62
|
+
counter = fetch(:sidekiq_six_processes).to_i
|
63
|
+
if counter > 1
|
64
|
+
counter.times do |idx|
|
65
|
+
deamons.push "#{ fetch(:sidekiq_six_deamon_file) }-#{ idx }"
|
66
|
+
end
|
67
|
+
else
|
68
|
+
deamons.push "#{ fetch(:sidekiq_six_deamon_file) }"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
deamons
|
72
|
+
end
|
73
|
+
|
74
|
+
def sidekiq_special_config(idx)
|
75
|
+
if fetch(:sidekiq_six_special_queues)
|
76
|
+
settingz = []
|
77
|
+
fetch(:sidekiq_six_queued_processes).each do |that|
|
78
|
+
(that[:processes] && that[:processes].to_i > 0 ? that[:processes].to_i : 1 ).to_i.times do
|
79
|
+
sttng_hash = {}
|
80
|
+
sttng_hash[:queue] = that[:queue] ? that[:queue] : "default"
|
81
|
+
sttng_hash[:concurrency] = that[:worker] && that[:worker].to_i > 0 ? that[:worker].to_i : 7
|
82
|
+
settingz.push( sttng_hash )
|
83
|
+
end
|
84
|
+
end
|
85
|
+
settingz[ idx.to_i ]
|
86
|
+
else
|
87
|
+
{}
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def upload_deamon(service_file, idx = 0)
|
92
|
+
args = []
|
93
|
+
args.push "--environment #{fetch(:stage)}"
|
94
|
+
args.push "--require #{fetch(:sidekiq_six_require)}" if fetch(:sidekiq_six_require)
|
95
|
+
args.push "--tag #{fetch(:sidekiq_six_tag)}" if fetch(:sidekiq_six_tag)
|
96
|
+
if fetch(:sidekiq_six_special_queues)
|
97
|
+
queue_config = sidekiq_special_config(idx)
|
98
|
+
args.push "--queue #{ queue_config[:queue] || 'default' }"
|
99
|
+
args.push "--concurrency #{ queue_config[:concurrency] || 7 }"
|
100
|
+
else
|
101
|
+
Array(fetch(:sidekiq_six_queue)).each do |queue|
|
102
|
+
args.push "--queue #{queue}"
|
103
|
+
end
|
104
|
+
args.push "--concurrency #{fetch(:sidekiq_six_concurrency)}" if fetch(:sidekiq_six_concurrency)
|
105
|
+
end
|
106
|
+
args.push "--config #{fetch(:sidekiq_six_config)}" if fetch(:sidekiq_six_config)
|
107
|
+
# use sidekiq_options for special options
|
108
|
+
args.push fetch(:sidekiq_six_options) if fetch(:sidekiq_six_options)
|
109
|
+
|
110
|
+
side_kiq_args = args.compact.join(' ')
|
111
|
+
|
112
|
+
@service_file = service_file
|
113
|
+
@side_kiq_args = side_kiq_args
|
114
|
+
|
115
|
+
if fetch(:sidekiq_six_deamon_template, :default) == :default
|
116
|
+
magic_template("sidekiq.service", '/tmp/sidekiq.service')
|
117
|
+
else
|
118
|
+
magic_template(fetch(:sidekiq_six_deamon_template), '/tmp/sidekiq.service')
|
119
|
+
end
|
120
|
+
execute :sudo, :mv, '/tmp/sidekiq.service', "#{ fetch(:sidekiq_six_deamon_path) }/#{ service_file }.service"
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
|
125
|
+
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
|
126
|
+
|
127
|
+
|
128
|
+
desc 'Creates and uploads sidekiq6 DEAMON files'
|
129
|
+
task :upload_deamons do
|
130
|
+
on roles fetch(:sidekiq_six_roles) do
|
131
|
+
for_each_process do |service_file, idx|
|
132
|
+
upload_deamon(service_file, idx)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
%w[start stop restart enable disable is-enabled].each do |cmnd|
|
138
|
+
desc "#{cmnd.capitalize} sidekiq6 service"
|
139
|
+
task cmnd.gsub(/-/, '_') do
|
140
|
+
on roles fetch(:sidekiq_six_roles) do
|
141
|
+
for_each_process do |service_file, idx|
|
142
|
+
execute :sudo, :systemctl, cmnd, service_file
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
desc "Quiet sidekiq6 service"
|
149
|
+
task :quiet do
|
150
|
+
on roles fetch(:sidekiq_six_roles) do
|
151
|
+
for_each_process do |service_file, idx|
|
152
|
+
execute :sudo, :systemctl, 'kill -s TSTP', service_file
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
desc "Get logs for sidekiq6 service"
|
158
|
+
task :logs do
|
159
|
+
on roles fetch(:sidekiq_six_roles) do
|
160
|
+
for_each_process do |service_file, idx|
|
161
|
+
execute :sudo, :journalctl, '-u', service_file, '-rn', fetch(:sidekiq_six_log_lines, 100)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
|
167
|
+
desc "check sidekiq6 service status"
|
168
|
+
task :check_status do
|
169
|
+
on roles fetch(:sidekiq_six_roles) do
|
170
|
+
for_each_process do |service_file, idx|
|
171
|
+
puts "#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#"
|
172
|
+
puts "#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#"
|
173
|
+
puts service_file
|
174
|
+
puts "#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#"
|
175
|
+
output = capture :sudo, "systemctl status", service_file
|
176
|
+
output.each_line do |line|
|
177
|
+
puts line
|
178
|
+
end
|
179
|
+
puts "#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#"
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
|
185
|
+
end
|
186
|
+
|
187
|
+
|
188
|
+
namespace :deploy do
|
189
|
+
before :starting, :stop_sidekiq_services do
|
190
|
+
if fetch(:sidekiq_six_default_hooks)
|
191
|
+
invoke "sidekiq_six:stop"
|
192
|
+
end
|
193
|
+
end
|
194
|
+
after :finished, :restart_sidekiq_services do
|
195
|
+
if fetch(:sidekiq_six_default_hooks)
|
196
|
+
invoke "sidekiq_six:start"
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
@@ -13,6 +13,7 @@ namespace :load do
|
|
13
13
|
set :thin_require, -> { [] }
|
14
14
|
set :thin_wait, -> { 90 }
|
15
15
|
set :thin_onebyone, -> { true }
|
16
|
+
set :thin_deamonize, -> { true }
|
16
17
|
set :thin_hooks, -> { true }
|
17
18
|
|
18
19
|
end
|
@@ -29,7 +30,7 @@ namespace :thin do
|
|
29
30
|
magic_template("thin_app_yml", '/tmp/thin_app.yml')
|
30
31
|
execute :sudo, :mv, '/tmp/thin_app.yml', "config/thin_app_#{fetch(:stage)}.yml"
|
31
32
|
execute :sudo, :rm, ' -f', "#{fetch(:thin_path)}/thin_#{fetch(:application)}_#{fetch(:stage)}*"
|
32
|
-
execute :sudo, :ln, ' -sf', "#{
|
33
|
+
execute :sudo, :ln, ' -sf', "#{shared_path}/config/thin_app_#{fetch(:stage)}.yml", "#{fetch(:thin_path)}/thin_#{fetch(:application)}_#{fetch(:stage)}.yml"
|
33
34
|
end
|
34
35
|
end
|
35
36
|
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'capistrano/magic_recipes/base_helpers'
|
2
|
+
include Capistrano::MagicRecipes::BaseHelpers
|
3
|
+
|
4
|
+
namespace :load do
|
5
|
+
task :defaults do
|
6
|
+
|
7
|
+
set :thin_path, -> { '/etc/thin' }
|
8
|
+
set :thin_roles, -> { :web }
|
9
|
+
|
10
|
+
set :thin_timeout, -> { 30 }
|
11
|
+
set :thin_max_conns, -> { 1024 }
|
12
|
+
set :thin_max_persistent_conns, -> { 512 }
|
13
|
+
set :thin_require, -> { [] }
|
14
|
+
set :thin_wait, -> { 90 }
|
15
|
+
set :thin_onebyone, -> { true }
|
16
|
+
set :thin_deamonize, -> { true }
|
17
|
+
set :thin_hooks, -> { true }
|
18
|
+
|
19
|
+
set :thin_deamon_file, -> { "thin_#{fetch(:application)}_#{fetch(:stage)}" }
|
20
|
+
set :thin_deamon_path, -> { "/lib/systemd/system" }
|
21
|
+
set :thin_deamon_template, -> { :default }
|
22
|
+
set :thin_deamon_log_lines, -> { 100 }
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
namespace :thin do
|
29
|
+
|
30
|
+
def upload_deamon(service_file, idx = 0)
|
31
|
+
if fetch(:thin_deamon_template, :default) == :default
|
32
|
+
magic_template("thin.service", '/tmp/thin.service')
|
33
|
+
else
|
34
|
+
magic_template(fetch(:thin_deamon_template), '/tmp/thin.service')
|
35
|
+
end
|
36
|
+
execute :sudo, :mv, '/tmp/thin.service', "#{ fetch(:thin_deamon_path) }/#{ fetch(:thin_deamon_file) }.service"
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
desc "rewrite and upload thin config"
|
41
|
+
task :reconf do
|
42
|
+
on release_roles fetch(:thin_roles) do
|
43
|
+
within current_path do
|
44
|
+
magic_template("thin_app_yml", '/tmp/thin_app.yml')
|
45
|
+
execute :sudo, :mv, '/tmp/thin_app.yml', "config/thin_app_#{fetch(:stage)}.yml"
|
46
|
+
execute :sudo, :rm, ' -f', "#{fetch(:thin_path)}/thin_#{fetch(:application)}_#{fetch(:stage)}*"
|
47
|
+
execute :sudo, :ln, ' -sf', "#{shared_path}/config/thin_app_#{fetch(:stage)}.yml", "#{fetch(:thin_path)}/thin_#{fetch(:application)}_#{fetch(:stage)}.yml"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
%w[start stop restart enable disable is-enabled].each do |cmnd|
|
55
|
+
desc "#{cmnd.capitalize} thin service"
|
56
|
+
task cmnd.gsub(/-/, '_') do
|
57
|
+
on roles fetch(:thin_roles) do
|
58
|
+
execute :sudo, :systemctl, cmnd, fetch(:thin_deamon_file)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
desc "Quiet thin service"
|
64
|
+
task :quiet do
|
65
|
+
on roles fetch(:thin_roles) do
|
66
|
+
execute :sudo, :systemctl, 'kill -s TSTP', fetch(:thin_deamon_file)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
desc "Get logs for thin service"
|
71
|
+
task :logs do
|
72
|
+
on roles fetch(:thin_roles) do
|
73
|
+
execute :sudo, :journalctl, '-u', fetch(:thin_deamon_file), '-rn', fetch(:thin_deamon_log_lines, 100)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
desc "check thin service status"
|
79
|
+
task :check_status do
|
80
|
+
on roles fetch(:thin_roles) do
|
81
|
+
puts "#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#"
|
82
|
+
puts "#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#"
|
83
|
+
puts fetch(:thin_deamon_file)
|
84
|
+
puts "#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#"
|
85
|
+
output = capture :sudo, "systemctl status", fetch(:thin_deamon_file)
|
86
|
+
output.each_line do |line|
|
87
|
+
puts line
|
88
|
+
end
|
89
|
+
puts "#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
|
97
|
+
# => after 'deploy:published', nil do
|
98
|
+
# => on release_roles fetch(:thin_roles) do
|
99
|
+
# => invoke "thin:reconf"
|
100
|
+
# => invoke "thin:restart"
|
101
|
+
# => end
|
102
|
+
# => end
|
103
|
+
|
104
|
+
|
105
|
+
namespace :deploy do
|
106
|
+
after 'deploy:published', :restart_thin_apps do
|
107
|
+
if fetch(:thin_hooks)
|
108
|
+
invoke "thin:reconf"
|
109
|
+
invoke "thin:restart"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
@@ -28,11 +28,3 @@ check host <%= domain %> with address <%= domain %>
|
|
28
28
|
then alert
|
29
29
|
<% end %>
|
30
30
|
|
31
|
-
|
32
|
-
### For Version 5.6:
|
33
|
-
# check host example.com with address example.com
|
34
|
-
# if failed
|
35
|
-
# url https://example.com
|
36
|
-
# timeout 10 seconds
|
37
|
-
# for 3 cycles
|
38
|
-
# then alert
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Check domains on <%= fetch(:nginx_use_ssl) ? 'https' : 'http' %> for <%= fetch(:application) %> [<%= fetch(:stage) %>]
|
2
|
+
<% domain_list.uniq.each do |domain| %>
|
3
|
+
check host <%= domain %> with address <%= domain %>
|
4
|
+
if failed
|
5
|
+
<% if fetch(:nginx_use_ssl) %>
|
6
|
+
port 443
|
7
|
+
type TCPSSL
|
8
|
+
protocol https
|
9
|
+
<% else %>
|
10
|
+
port 80
|
11
|
+
protocol http
|
12
|
+
<% end %>
|
13
|
+
<% if fetch(:monit_website_check_content, false) %>
|
14
|
+
request "<%= fetch(:monit_website_check_path, '/') %>"
|
15
|
+
content = "<%= fetch(:monit_website_check_text, '<!DOCTYPE html>') %>"
|
16
|
+
<% else %>
|
17
|
+
# status = 200
|
18
|
+
<% end %>
|
19
|
+
with timeout <%= fetch(:monit_website_check_timeout, 10) %> seconds
|
20
|
+
for <%= fetch(:monit_website_check_cycles, 3) %> cycles
|
21
|
+
then alert
|
22
|
+
<% end %>
|
23
|
+
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<meta charset="utf-8">
|
5
5
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
7
|
-
|
7
|
+
<meta http-equiv="refresh" content="5; URL=<%= fetch(:redirect_new_domain) %>">
|
8
8
|
<title>Wir werden <%= fetch(:redirect_new_name) %></title>
|
9
9
|
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
|
10
10
|
|
@@ -87,7 +87,7 @@
|
|
87
87
|
el: '#app',
|
88
88
|
data: {
|
89
89
|
domain: String(window.location).split('://')[1].split('/')[0],
|
90
|
-
count:
|
90
|
+
count: 3,
|
91
91
|
interval: null
|
92
92
|
},
|
93
93
|
methods: {
|
@@ -0,0 +1,79 @@
|
|
1
|
+
#
|
2
|
+
# This file tells systemd how to run Sidekiq as a 24/7 long-running daemon.
|
3
|
+
#
|
4
|
+
# Customize this file based on your bundler location, app directory, etc.
|
5
|
+
# Customize and copy this into /usr/lib/systemd/system (CentOS) or /lib/systemd/system (Ubuntu).
|
6
|
+
# Then run:
|
7
|
+
# - systemctl enable <%= @service_file %>
|
8
|
+
# - systemctl {start,stop,restart} <%= @service_file %>
|
9
|
+
#
|
10
|
+
# This file corresponds to a single Sidekiq process. Add multiple copies
|
11
|
+
# to run multiple processes (sidekiq-1, sidekiq-2, etc).
|
12
|
+
#
|
13
|
+
# Use `journalctl -u <%= @service_file %> -rn 100` to view the last 100 lines of log output.
|
14
|
+
#
|
15
|
+
[Unit]
|
16
|
+
Description=<%= @service_file %>
|
17
|
+
# start us only once the network and logging subsystems are available,
|
18
|
+
# consider adding redis-server.service if Redis is local and systemd-managed.
|
19
|
+
After=syslog.target network.target
|
20
|
+
|
21
|
+
# See these pages for lots of options:
|
22
|
+
#
|
23
|
+
# https://www.freedesktop.org/software/systemd/man/systemd.service.html
|
24
|
+
# https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
25
|
+
#
|
26
|
+
# THOSE PAGES ARE CRITICAL FOR ANY LINUX DEVOPS WORK; read them multiple
|
27
|
+
# times! systemd is a critical tool for all developers to know and understand.
|
28
|
+
#
|
29
|
+
[Service]
|
30
|
+
#
|
31
|
+
# !!!! !!!! !!!!
|
32
|
+
#
|
33
|
+
# As of v6.0.6, Sidekiq automatically supports systemd's `Type=notify` and watchdog service
|
34
|
+
# monitoring. If you are using an earlier version of Sidekiq, change this to `Type=simple`
|
35
|
+
# and remove the `WatchdogSec` line.
|
36
|
+
#
|
37
|
+
# !!!! !!!! !!!!
|
38
|
+
#
|
39
|
+
Type=notify
|
40
|
+
# If your Sidekiq process locks up, systemd's watchdog will restart it within seconds.
|
41
|
+
WatchdogSec=10
|
42
|
+
|
43
|
+
WorkingDirectory=<%= current_path %>
|
44
|
+
<% if fetch(:sidekiq_six_ruby_vm) == :rbenv %>
|
45
|
+
# If you use rbenv:
|
46
|
+
ExecStart=/bin/bash -lc 'exec /home/deploy/.rbenv/shims/bundle exec sidekiq <%= @side_kiq_args %>'
|
47
|
+
<% elsif fetch(:sidekiq_six_ruby_vm) == :rvm %>
|
48
|
+
# RVM
|
49
|
+
ExecStart=<%= fetch(:rvm_path) %>/bin/rvm <%= fetch(:rvm_ruby_version) %> do bundle exec sidekiq <%= @side_kiq_args %>
|
50
|
+
<% else %>
|
51
|
+
# If you use the system's ruby:
|
52
|
+
ExecStart=/usr/local/bin/bundle exec sidekiq <%= @side_kiq_args %>
|
53
|
+
<% end %>
|
54
|
+
|
55
|
+
|
56
|
+
# Use `systemctl kill -s TSTP <%= @service_file %>` to quiet the Sidekiq process
|
57
|
+
|
58
|
+
# !!! Change this to your deploy user account !!!
|
59
|
+
User=<%= fetch(:sidekiq_six_user) %>
|
60
|
+
Group=<%= fetch(:sidekiq_six_user) %>
|
61
|
+
UMask=0002
|
62
|
+
|
63
|
+
# Greatly reduce Ruby memory fragmentation and heap usage
|
64
|
+
# https://www.mikeperham.com/2018/04/25/taming-rails-memory-bloat/
|
65
|
+
Environment=MALLOC_ARENA_MAX=2
|
66
|
+
|
67
|
+
# if we crash, restart
|
68
|
+
RestartSec=1
|
69
|
+
Restart=on-failure
|
70
|
+
|
71
|
+
# output goes to /var/log/syslog (Ubuntu) or /var/log/messages (CentOS)
|
72
|
+
StandardOutput=syslog
|
73
|
+
StandardError=syslog
|
74
|
+
|
75
|
+
# This will default to "bundler" if we don't specify it
|
76
|
+
SyslogIdentifier=<%= @service_file %>
|
77
|
+
|
78
|
+
[Install]
|
79
|
+
WantedBy=multi-user.target
|
@@ -0,0 +1,33 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description=<%= @service_file %>
|
3
|
+
After=syslog.target network.target
|
4
|
+
|
5
|
+
[Service]
|
6
|
+
Type=notify
|
7
|
+
WatchdogSec=10
|
8
|
+
|
9
|
+
WorkingDirectory=<%= current_path %>
|
10
|
+
<% if fetch(:sidekiq_six_ruby_vm) == :rbenv %>
|
11
|
+
ExecStart=/bin/bash -lc 'exec /home/deploy/.rbenv/shims/bundle exec sidekiq <%= @side_kiq_args %>'
|
12
|
+
<% elsif fetch(:sidekiq_six_ruby_vm) == :rvm %>
|
13
|
+
ExecStart=<%= fetch(:rvm_path) %>/bin/rvm <%= fetch(:rvm_ruby_version) %> do bundle exec sidekiq <%= @side_kiq_args %>
|
14
|
+
<% else %>
|
15
|
+
ExecStart=/usr/local/bin/bundle exec sidekiq <%= @side_kiq_args %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
User=<%= fetch(:sidekiq_six_user) %>
|
19
|
+
Group=<%= fetch(:sidekiq_six_user) %>
|
20
|
+
UMask=0002
|
21
|
+
|
22
|
+
Environment=MALLOC_ARENA_MAX=2
|
23
|
+
|
24
|
+
RestartSec=1
|
25
|
+
Restart=on-failure
|
26
|
+
|
27
|
+
StandardOutput=/var/log/syslog
|
28
|
+
StandardError=/var/log/syslog
|
29
|
+
|
30
|
+
SyslogIdentifier=sidekiq
|
31
|
+
|
32
|
+
[Install]
|
33
|
+
WantedBy=multi-user.target
|
@@ -0,0 +1,33 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description=<%= fetch(:thin_deamon_file) %>
|
3
|
+
After=syslog.target
|
4
|
+
After=network.target
|
5
|
+
|
6
|
+
[Service]
|
7
|
+
Type=forking
|
8
|
+
|
9
|
+
User=<%= @role.user %>
|
10
|
+
Group=<%= @role.user %>
|
11
|
+
|
12
|
+
WorkingDirectory=<%= current_path %>
|
13
|
+
<% if fetch(:sidekiq_six_ruby_vm) == :rbenv %>
|
14
|
+
ExecStart=/bin/bash -lc 'exec /home/deploy/.rbenv/shims/bundle exec thin -C config/thin_app_<%= fetch(:stage) %>.yml start'
|
15
|
+
ExecStop=/bin/bash -lc 'exec /home/deploy/.rbenv/shims/bundle exec thin -C config/thin_app_<%= fetch(:stage) %>.yml stop'
|
16
|
+
ExecReload=/bin/bash -lc 'exec /home/deploy/.rbenv/shims/bundle exec thin -C config/thin_app_<%= fetch(:stage) %>.yml restart'
|
17
|
+
<% elsif fetch(:sidekiq_six_ruby_vm) == :rvm %>
|
18
|
+
ExecStart=<%= fetch(:rvm_path) %>/bin/rvm <%= fetch(:rvm_ruby_version) %> do bundle exec thin -C config/thin_app_<%= fetch(:stage) %>.yml start
|
19
|
+
ExecStop=<%= fetch(:rvm_path) %>/bin/rvm <%= fetch(:rvm_ruby_version) %> do bundle exec thin -C config/thin_app_<%= fetch(:stage) %>.yml stop
|
20
|
+
ExecReload=<%= fetch(:rvm_path) %>/bin/rvm <%= fetch(:rvm_ruby_version) %> do bundle exec thin -C config/thin_app_<%= fetch(:stage) %>.yml restart
|
21
|
+
<% else %>
|
22
|
+
ExecStart=/usr/local/bin/bundle exec thin -C config/thin_app_<%= fetch(:stage) %>.yml start
|
23
|
+
ExecStop=/usr/local/bin/bundle exec thin -C config/thin_app_<%= fetch(:stage) %>.yml stop
|
24
|
+
ExecReload=/usr/local/bin/bundle exec thin -C config/thin_app_<%= fetch(:stage) %>.yml restart
|
25
|
+
<% end %>
|
26
|
+
|
27
|
+
TimeoutSec=<%= fetch(:thin_wait) %>
|
28
|
+
Restart=always
|
29
|
+
|
30
|
+
SyslogIdentifier=thin
|
31
|
+
|
32
|
+
[Install]
|
33
|
+
WantedBy=multi-user.target
|
@@ -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:
|
18
|
+
daemonize: <%= fetch(:thin_deamonize) %>
|
19
19
|
onebyone: <%= fetch(:thin_onebyone) %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magic_recipes_two
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.93
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Torsten Wetzel
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- Rakefile
|
148
148
|
- lib/capistrano/magic_recipes.rb
|
149
149
|
- lib/capistrano/magic_recipes/assets.rb
|
150
|
+
- lib/capistrano/magic_recipes/backup.rb
|
150
151
|
- lib/capistrano/magic_recipes/base_helpers.rb
|
151
152
|
- lib/capistrano/magic_recipes/db.rb
|
152
153
|
- lib/capistrano/magic_recipes/exception_pages.rb
|
@@ -160,9 +161,12 @@ files:
|
|
160
161
|
- lib/capistrano/magic_recipes/redis.rb
|
161
162
|
- lib/capistrano/magic_recipes/secrets.rb
|
162
163
|
- lib/capistrano/magic_recipes/sidekiq.rb
|
164
|
+
- lib/capistrano/magic_recipes/sidekiq_six.rb
|
163
165
|
- lib/capistrano/magic_recipes/thin.rb
|
166
|
+
- lib/capistrano/magic_recipes/thin_sysd.rb
|
164
167
|
- lib/capistrano/magic_recipes/version.rb
|
165
168
|
- lib/capistrano/tasks/assets.rake
|
169
|
+
- lib/capistrano/tasks/backup.rake
|
166
170
|
- lib/capistrano/tasks/db.rake
|
167
171
|
- lib/capistrano/tasks/exception_pages.rake
|
168
172
|
- lib/capistrano/tasks/inform_slack.rake
|
@@ -176,7 +180,9 @@ files:
|
|
176
180
|
- lib/capistrano/tasks/redis.rake
|
177
181
|
- lib/capistrano/tasks/secrets.rake
|
178
182
|
- lib/capistrano/tasks/sidekiq.rake
|
183
|
+
- lib/capistrano/tasks/sidekiq_six.rake
|
179
184
|
- lib/capistrano/tasks/thin.rake
|
185
|
+
- lib/capistrano/tasks/thin_sysd.rake
|
180
186
|
- lib/generators/capistrano/magic_recipes/templates/capistrano3_nginx_conf.erb
|
181
187
|
- lib/generators/capistrano/magic_recipes/templates/monit/monitrc.erb
|
182
188
|
- lib/generators/capistrano/magic_recipes/templates/monit/nginx.erb
|
@@ -188,6 +194,7 @@ files:
|
|
188
194
|
- lib/generators/capistrano/magic_recipes/templates/monit/sidekiq.erb
|
189
195
|
- lib/generators/capistrano/magic_recipes/templates/monit/thin.erb
|
190
196
|
- lib/generators/capistrano/magic_recipes/templates/monit/website.erb
|
197
|
+
- lib/generators/capistrano/magic_recipes/templates/monit/websiteX.erb
|
191
198
|
- lib/generators/capistrano/magic_recipes/templates/nginx.conf.erb
|
192
199
|
- lib/generators/capistrano/magic_recipes/templates/nginx/diffie_hellman.erb
|
193
200
|
- lib/generators/capistrano/magic_recipes/templates/nginx/media_cache_path.erb
|
@@ -201,6 +208,9 @@ files:
|
|
201
208
|
- lib/generators/capistrano/magic_recipes/templates/postgresql.yml.erb
|
202
209
|
- lib/generators/capistrano/magic_recipes/templates/redirect_page.html.erb
|
203
210
|
- lib/generators/capistrano/magic_recipes/templates/secrets_yml.erb
|
211
|
+
- lib/generators/capistrano/magic_recipes/templates/sidekiq.docu-service.erb
|
212
|
+
- lib/generators/capistrano/magic_recipes/templates/sidekiq.service.erb
|
213
|
+
- lib/generators/capistrano/magic_recipes/templates/thin.service.erb
|
204
214
|
- lib/generators/capistrano/magic_recipes/templates/thin_app_yml.erb
|
205
215
|
- lib/magic_recipes_two.rb
|
206
216
|
- lib/tasks/magic_recipes_two_tasks.rake
|
@@ -208,7 +218,7 @@ homepage: https://github.com/berlinmagic/magic_recipes_two
|
|
208
218
|
licenses:
|
209
219
|
- MIT
|
210
220
|
metadata: {}
|
211
|
-
post_install_message:
|
221
|
+
post_install_message:
|
212
222
|
rdoc_options: []
|
213
223
|
require_paths:
|
214
224
|
- lib
|
@@ -223,9 +233,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
233
|
- !ruby/object:Gem::Version
|
224
234
|
version: '0'
|
225
235
|
requirements: []
|
226
|
-
rubyforge_project:
|
227
|
-
rubygems_version: 2.
|
228
|
-
signing_key:
|
236
|
+
rubyforge_project:
|
237
|
+
rubygems_version: 2.7.8
|
238
|
+
signing_key:
|
229
239
|
specification_version: 4
|
230
240
|
summary: Some recipes for rails-4 and capistrano-3.
|
231
241
|
test_files: []
|