magic_recipes_two 0.0.93 → 0.0.94

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de82290a078d6de6dd0db27958456070b1cb88ef998c46bd84472743bf252983
4
- data.tar.gz: c326693d2f0a94bb3ec60c5d3abd47ebc2ae63f9179186511322bf4931e4f1e0
3
+ metadata.gz: b50067781cfa8d65ac3c4ae487d5fa03dbe28ef2d26e7941219df9cee775a0cf
4
+ data.tar.gz: a9c3c528b5786f54ce9c239f74eb4f1a067fb5706b788bfc593b44d96ca65054
5
5
  SHA512:
6
- metadata.gz: 8de6f633599241a991d78fc9741b4a0829f1accfb43357002332ec9c497a2aba8a24871f77a36a145b53678217748bf9b2af06017b295b59176064c072d0373a
7
- data.tar.gz: 3caf010043617bb8cdf99332bf12d6e3da066875042b53d061c182c9740ae1fa9df75d1eb32a776810bd7a1f76e7cb4fc7c3215e0889efec90d5af20733ddb6b
6
+ metadata.gz: b1009790183b10583e375dfaed183b921d422ae90118bc6b6b06b2b423696b1dbacc080c00476652cb44fbc4065085578c34a2f2cc935477dbe281307e8203bc
7
+ data.tar.gz: d8c692af47aa1e66249a1ebd6d0d453ac61d509cb37a2e708aee2f2682bb71757d500d2daa0ddb6effe0755c666e69215e60e7c1447b89b73b515ce185482f98
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module MagicRecipes
3
- VERSION = "0.0.93"
3
+ VERSION = "0.0.94"
4
4
  end
5
5
  end
@@ -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' } # role-user
29
+ set :sidekiq_six_user, -> { fetch(:user, 'deploy') } # role-user
30
30
  set :sidekiq_six_log_lines, -> { 100 }
31
31
 
32
32
  end
@@ -13,7 +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
+ set :thin_daemonize, -> { true }
17
17
  set :thin_hooks, -> { true }
18
18
 
19
19
  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
- set :thin_deamonize, -> { true }
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 :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 }
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 upload_deamon(service_file, idx = 0)
31
- if fetch(:thin_deamon_template, :default) == :default
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(:thin_deamon_template), '/tmp/thin.service')
38
+ magic_template(fetch(:thin_daemon_template), '/tmp/thin.service')
35
39
  end
36
- execute :sudo, :mv, '/tmp/thin.service', "#{ fetch(:thin_deamon_path) }/#{ fetch(:thin_deamon_file) }.service"
40
+ execute :sudo, :mv, '/tmp/thin.service', "#{ fetch(:thin_daemon_path) }/#{ fetch(:thin_daemon_file) }.service"
37
41
  end
38
42
 
39
43
 
40
- desc "rewrite and upload thin config"
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
- execute :sudo, :systemctl, cmnd, fetch(:thin_deamon_file)
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
- execute :sudo, :systemctl, 'kill -s TSTP', fetch(:thin_deamon_file)
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
- execute :sudo, :journalctl, '-u', fetch(:thin_deamon_file), '-rn', fetch(:thin_deamon_log_lines, 100)
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(:thin_deamon_file)
108
+ puts fetch(:thin_daemon_file)
84
109
  puts "#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#"
85
- output = capture :sudo, "systemctl status", fetch(:thin_deamon_file)
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(:thin_deamon_file) %>
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=<%= @role.user %>
10
- Group=<%= @role.user %>
9
+ User=<%= fetch(:thin_daemon_user) %>
10
+ Group=<%= fetch(:thin_daemon_user) %>
11
11
 
12
12
  WorkingDirectory=<%= current_path %>
13
- <% if fetch(:sidekiq_six_ruby_vm) == :rbenv %>
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(:sidekiq_six_ruby_vm) == :rvm %>
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(:thin_deamonize) %>
18
+ daemonize: <%= fetch(:thin_daemonize) %>
19
19
  onebyone: <%= fetch(:thin_onebyone) %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magic_recipes_two
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.93
4
+ version: 0.0.94
5
5
  platform: ruby
6
6
  authors:
7
7
  - Torsten Wetzel