magic_recipes_two 0.0.89 → 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.
Files changed (26) hide show
  1. checksums.yaml +5 -13
  2. data/lib/capistrano/magic_recipes/backup.rb +1 -0
  3. data/lib/capistrano/magic_recipes/base_helpers.rb +1 -0
  4. data/lib/capistrano/magic_recipes/redirect_page.rb +1 -0
  5. data/lib/capistrano/magic_recipes/sidekiq_six.rb +1 -0
  6. data/lib/capistrano/magic_recipes/thin_sysd.rb +1 -0
  7. data/lib/capistrano/magic_recipes/version.rb +1 -1
  8. data/lib/capistrano/tasks/backup.rake +38 -0
  9. data/lib/capistrano/tasks/db.rake +29 -0
  10. data/lib/capistrano/tasks/lets_encrypt.rake +38 -10
  11. data/lib/capistrano/tasks/monit.rake +33 -11
  12. data/lib/capistrano/tasks/nginx.rake +3 -0
  13. data/lib/capistrano/tasks/redirect_page.rake +118 -0
  14. data/lib/capistrano/tasks/secrets.rake +18 -0
  15. data/lib/capistrano/tasks/sidekiq_six.rake +199 -0
  16. data/lib/capistrano/tasks/thin.rake +2 -1
  17. data/lib/capistrano/tasks/thin_sysd.rake +113 -0
  18. data/lib/generators/capistrano/magic_recipes/templates/monit/website.erb +0 -8
  19. data/lib/generators/capistrano/magic_recipes/templates/monit/websiteX.erb +23 -0
  20. data/lib/generators/capistrano/magic_recipes/templates/nginx_redirect_page.conf.erb +50 -0
  21. data/lib/generators/capistrano/magic_recipes/templates/redirect_page.html.erb +114 -0
  22. data/lib/generators/capistrano/magic_recipes/templates/sidekiq.docu-service.erb +79 -0
  23. data/lib/generators/capistrano/magic_recipes/templates/sidekiq.service.erb +33 -0
  24. data/lib/generators/capistrano/magic_recipes/templates/thin.service.erb +33 -0
  25. data/lib/generators/capistrano/magic_recipes/templates/thin_app_yml.erb +1 -1
  26. metadata +41 -27
@@ -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', "#{current_path}/config/thin_app_#{fetch(:stage)}.yml", "#{fetch(:thin_path)}/thin_#{fetch(:application)}_#{fetch(:stage)}.yml"
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
+
@@ -0,0 +1,50 @@
1
+ # Redirect - Page
2
+ server {
3
+ listen 80;
4
+ server_name <%= Array(fetch(:redirect_old_domains)).join(joiner) %>;
5
+
6
+ root <%= "#{ fetch(:redirect_index_parent, shared_path) }/#{ fetch(:redirect_index_path, 'redirector') }" %>;
7
+
8
+ # location ~ /.well-known { allow all; }
9
+
10
+ # lets-encrypt path
11
+ location ~ /.well-known {
12
+ allow all;
13
+ root <%= current_path %>/public;
14
+ }
15
+
16
+ # SPA-routing
17
+ location / {
18
+ try_files /index.html;
19
+ }
20
+
21
+ }
22
+
23
+
24
+ <% if Array(fetch(:redirect_old_ssl_domains, [])).any? %>
25
+ server {
26
+ listen 443 ssl http2;
27
+ ssl on;
28
+ ssl_certificate <%= fetch(:redirect_ssl_cert) %>;
29
+ ssl_certificate_key <%= fetch(:redirect_ssl_key) %>;
30
+ <%= magic_render("nginx/diffie_hellman") %>
31
+
32
+ server_name <%= Array(fetch(:redirect_old_ssl_domains)).join(joiner) %>;
33
+
34
+ root <%= "#{ fetch(:redirect_index_parent, shared_path) }/#{ fetch(:redirect_index_path, 'redirector') }" %>;
35
+
36
+ # location ~ /.well-known { allow all; }
37
+
38
+ # lets-encrypt path
39
+ location ~ /.well-known {
40
+ allow all;
41
+ root <%= current_path %>/public;
42
+ }
43
+
44
+ # SPA-routing
45
+ location / {
46
+ try_files /index.html;
47
+ }
48
+
49
+ }
50
+ <% end %>
@@ -0,0 +1,114 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7
+ <meta http-equiv="refresh" content="5; URL=<%= fetch(:redirect_new_domain) %>">
8
+ <title>Wir werden <%= fetch(:redirect_new_name) %></title>
9
+ <script src="https://cdn.jsdelivr.net/npm/vue"></script>
10
+
11
+ <style>
12
+ html, body {
13
+ width: 100%;
14
+ height: 100%;
15
+ margin: 0;
16
+ padding: 0;
17
+ font-size: 18px;
18
+ font-family: Lucida, Verdana, Arial, sans-serif;
19
+ line-height: 1.6;
20
+ color: #333;
21
+ background: #fff;
22
+ }
23
+ #app {
24
+ height: 100vh;
25
+ width: 100vw;
26
+ display: flex;
27
+ justify-content: center;
28
+ align-items: center;
29
+ }
30
+ .box {
31
+ display: block; position: relative;
32
+ width: 60%;
33
+ max-width: 600px;
34
+ padding: 20px;
35
+ text-align: center;
36
+ }
37
+ a, p {
38
+ display: block; position: relative;
39
+ margin: 0;
40
+ padding: 0;
41
+ }
42
+ a {
43
+ color: #000;
44
+ text-decoration: none;
45
+ }
46
+ a:hover {
47
+ text-shadow: 0 0 2px #069;
48
+ }
49
+ .gets {
50
+ font-size: 80%;
51
+ color: rgb(102,102,102);
52
+ }
53
+ .small {
54
+ font-size: 60%;
55
+ color: rgb(102,102,102);
56
+ }
57
+ .new { font-size: 120%; }
58
+ @media (min-width: 600px) {
59
+ html, body {
60
+ font-size: 24px;
61
+ }
62
+ }
63
+ @media (min-width: 1200px) {
64
+ html, body {
65
+ font-size: 32px;
66
+ }
67
+ }
68
+ </style>
69
+
70
+ </head>
71
+ <body>
72
+ <div id="app">
73
+ <div class="box">
74
+ <p class="old">{{ domain }}</p>
75
+ <p class="gets">wird zu</p>
76
+ <a class="new" href="<%= fetch(:redirect_new_domain) %>"><%= fetch(:redirect_new_name) %></a>
77
+ <br>
78
+ <p class="small">
79
+ Du wirst
80
+ <span v-if="count > 0">in {{ count }} Sekunden</span>
81
+ <span v-else>jetzt</span>
82
+ automatisch weitergeleitet.</p>
83
+ </div>
84
+ </div>
85
+ <script>
86
+ var app = new Vue({
87
+ el: '#app',
88
+ data: {
89
+ domain: String(window.location).split('://')[1].split('/')[0],
90
+ count: 3,
91
+ interval: null
92
+ },
93
+ methods: {
94
+ startInterval() {
95
+ console.log('domain => ' + this.domain)
96
+ console.log('start CountDown .. ', this.count)
97
+ let that = this
98
+ this.interval = setInterval(function(){
99
+ console.log('CountDown: ', that.count)
100
+ that.count = that.count - 1
101
+ if (this.count < 0) {
102
+ window.location = '<%= fetch(:redirect_new_domain) %>'
103
+ }
104
+ }, 990);
105
+ }
106
+ },
107
+ created: function () {
108
+ if (this.interval) { clearInterval(this.interval) }
109
+ this.startInterval()
110
+ }
111
+ })
112
+ </script>
113
+ </body>
114
+ </html>
@@ -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: true
18
+ daemonize: <%= fetch(:thin_deamonize) %>
19
19
  onebyone: <%= fetch(:thin_onebyone) %>