pixelforce_recipes 1.8 → 2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -9
- data/lib/pixelforce_recipes/capistrano_3_recipes/puma.rb +5 -2
- data/lib/pixelforce_recipes/capistrano_3_recipes/resque.rb +1 -1
- data/lib/pixelforce_recipes/capistrano_3_recipes/resque_scheduler.rb +1 -1
- data/lib/pixelforce_recipes/capistrano_3_recipes/sidekiq.rb +34 -1
- data/lib/pixelforce_recipes/capistrano_3_recipes/unicorn.rb +1 -1
- data/lib/pixelforce_recipes/templates/logrotate.erb +5 -3
- data/lib/pixelforce_recipes/templates/nginx_config.erb +4 -1
- data/lib/pixelforce_recipes/templates/nginx_puma_config.erb +9 -6
- data/lib/pixelforce_recipes/templates/puma.rb.erb +7 -7
- data/lib/pixelforce_recipes/templates/puma_supervisor.erb +2 -2
- data/lib/pixelforce_recipes/templates/resque_scheduler_supervisor.erb +1 -0
- data/lib/pixelforce_recipes/templates/resque_supervisor.erb +1 -0
- data/lib/pixelforce_recipes/version.rb +1 -1
- data/lib/pixelforce_recipes.rb +2 -13
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99cd84bf28bedffc49e0b17d0abadb17948931d83adfff7e4ea203085e846595
|
4
|
+
data.tar.gz: 5f29ecc95d3af1e4745ece64f81ea1412616b77efbf3e8809e7eb516186cb490
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e77266c598a308a077dac8cf13e8965171a3eda2ca41f8e055863303093f1bf3e58a34de975e2d3f6d05265f490e3b7cc451f149781ba87fa86d7da0902c9b62
|
7
|
+
data.tar.gz: 16bad33ad82245b2a4a9d33bea8eee1e2d1a2bc79337570656d34e0d90f2d2292b74699395a1c677b55cada6ce54dd43d59d0bfe8227d634d8f6e881ec1d329f
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pixelforce_recipes (
|
4
|
+
pixelforce_recipes (2.4)
|
5
5
|
capistrano (> 2.0.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -9,18 +9,18 @@ GEM
|
|
9
9
|
specs:
|
10
10
|
airbrussh (1.4.0)
|
11
11
|
sshkit (>= 1.6.1, != 1.7.0)
|
12
|
-
capistrano (3.
|
12
|
+
capistrano (3.16.0)
|
13
13
|
airbrussh (>= 1.0.0)
|
14
14
|
i18n
|
15
15
|
rake (>= 10.0.0)
|
16
16
|
sshkit (>= 1.9.0)
|
17
|
-
concurrent-ruby (1.1.
|
17
|
+
concurrent-ruby (1.1.9)
|
18
18
|
diff-lcs (1.2.5)
|
19
|
-
i18n (1.8.
|
19
|
+
i18n (1.8.10)
|
20
20
|
concurrent-ruby (~> 1.0)
|
21
|
-
net-scp (
|
22
|
-
net-ssh (>= 2.6.5, <
|
23
|
-
net-ssh (
|
21
|
+
net-scp (3.0.0)
|
22
|
+
net-ssh (>= 2.6.5, < 7.0.0)
|
23
|
+
net-ssh (6.1.0)
|
24
24
|
rake (13.0.1)
|
25
25
|
rspec (3.5.0)
|
26
26
|
rspec-core (~> 3.5.0)
|
@@ -35,7 +35,7 @@ GEM
|
|
35
35
|
diff-lcs (>= 1.2.0, < 2.0)
|
36
36
|
rspec-support (~> 3.5.0)
|
37
37
|
rspec-support (3.5.0)
|
38
|
-
sshkit (1.
|
38
|
+
sshkit (1.21.2)
|
39
39
|
net-scp (>= 1.1.2)
|
40
40
|
net-ssh (>= 2.8.0)
|
41
41
|
|
@@ -49,4 +49,4 @@ DEPENDENCIES
|
|
49
49
|
rspec (~> 3.0)
|
50
50
|
|
51
51
|
BUNDLED WITH
|
52
|
-
1.
|
52
|
+
1.17.3
|
@@ -4,9 +4,11 @@ namespace :puma do
|
|
4
4
|
task :config do
|
5
5
|
on roles(:web) do
|
6
6
|
template "puma.rb.erb", "/tmp/puma_conf"
|
7
|
-
sudo "mv /tmp/puma_conf #{shared_path}/config"
|
7
|
+
sudo "mv /tmp/puma_conf #{shared_path}/config/puma.rb"
|
8
|
+
execute "mkdir -p #{shared_path}/pids"
|
8
9
|
end
|
9
10
|
end
|
11
|
+
|
10
12
|
namespace :sysvinit do
|
11
13
|
task :setup do
|
12
14
|
on roles(:web) do
|
@@ -28,11 +30,12 @@ namespace :puma do
|
|
28
30
|
end
|
29
31
|
end
|
30
32
|
end
|
33
|
+
|
31
34
|
namespace :supervisor do
|
32
35
|
task :setup do
|
33
36
|
on roles(:web) do
|
34
37
|
template "puma_supervisor.erb", "/tmp/puma"
|
35
|
-
sudo "mv /tmp/puma /etc/supervisor/conf.d/#{fetch(:application)}"
|
38
|
+
sudo "mv /tmp/puma /etc/supervisor/conf.d/#{fetch(:application)}.conf"
|
36
39
|
sudo "supervisorctl reread"
|
37
40
|
sudo "supervisorctl update" # it will auto start the application
|
38
41
|
template "nginx_puma_config.erb", "/tmp/nginx_puma_config"
|
@@ -25,7 +25,7 @@ namespace :resque do
|
|
25
25
|
task :setup do
|
26
26
|
on roles(:resque) do
|
27
27
|
template "resque_supervisor.erb", "/tmp/resque"
|
28
|
-
sudo "mv /tmp/resque /etc/supervisor/conf.d/resque"
|
28
|
+
sudo "mv /tmp/resque /etc/supervisor/conf.d/resque.conf"
|
29
29
|
sudo "supervisorctl reread"
|
30
30
|
sudo "supervisorctl update" # it will auto start the application
|
31
31
|
end
|
@@ -25,7 +25,7 @@ namespace :resque_scheduler do
|
|
25
25
|
task :setup do
|
26
26
|
on roles(:resque) do
|
27
27
|
template "resque_scheduler_supervisor.erb", "/tmp/resque_scheduler"
|
28
|
-
sudo "mv /tmp/resque_scheduler /etc/supervisor/conf.d/resque_scheduler"
|
28
|
+
sudo "mv /tmp/resque_scheduler /etc/supervisor/conf.d/resque_scheduler.conf"
|
29
29
|
sudo "supervisorctl reread"
|
30
30
|
sudo "supervisorctl update" # it will auto start the application
|
31
31
|
end
|
@@ -25,7 +25,7 @@ namespace :sidekiq do
|
|
25
25
|
task :setup do
|
26
26
|
on roles(:sidekiq) do
|
27
27
|
template "sidekiq_supervisor.erb", "/tmp/sidekiq"
|
28
|
-
sudo "mv /tmp/sidekiq /etc/supervisor/conf.d/sidekiq"
|
28
|
+
sudo "mv /tmp/sidekiq /etc/supervisor/conf.d/sidekiq.conf"
|
29
29
|
sudo "supervisorctl reread"
|
30
30
|
sudo "supervisorctl update" # it will auto start the application
|
31
31
|
end
|
@@ -39,5 +39,38 @@ namespace :sidekiq do
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
|
+
task :unload do
|
43
|
+
desc "tell sidekiq stop receive new jobs, called at the beginning"
|
44
|
+
on roles(:sidekiq) do
|
45
|
+
execute "supervisorctl signal TSTP sidekiq"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
task :rolling_restart do
|
49
|
+
desc "used for rolling restart, only available on enterprise version"
|
50
|
+
on roles(:sidekiq) do
|
51
|
+
execute "supervisorctl signal USR2 sidekiq"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
%w[start_group stop_group restart_group].each do |command|
|
56
|
+
desc "#{command} sidekiq"
|
57
|
+
task command do
|
58
|
+
on roles(:sidekiq) do
|
59
|
+
execute "supervisorctl #{command.split('_')[0]} sidekiq:*"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
task :unload_group do
|
64
|
+
desc "tell sidekiq stop receive new jobs, called at the beginning"
|
65
|
+
on roles(:sidekiq) do
|
66
|
+
execute "supervisorctl signal TSTP sidekiq:*"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
task :rolling_restart_group do
|
70
|
+
desc "used for rolling restart, only available on enterprise version"
|
71
|
+
on roles(:sidekiq) do
|
72
|
+
execute "supervisorctl signal USR2 sidekiq:*"
|
73
|
+
end
|
74
|
+
end
|
42
75
|
end
|
43
76
|
end
|
@@ -26,7 +26,7 @@ namespace :unicorn do
|
|
26
26
|
task :setup do
|
27
27
|
on roles(:web) do
|
28
28
|
template "unicorn_supervisor.erb", "/tmp/unicorn"
|
29
|
-
sudo "mv /tmp/unicorn /etc/supervisor/conf.d/#{fetch(:application)}"
|
29
|
+
sudo "mv /tmp/unicorn /etc/supervisor/conf.d/#{fetch(:application)}.conf"
|
30
30
|
sudo "supervisorctl reread"
|
31
31
|
sudo "supervisorctl update" # it will auto start the application
|
32
32
|
template "nginx_config.erb", "/tmp/nginx_config"
|
@@ -15,6 +15,9 @@ server {
|
|
15
15
|
}
|
16
16
|
|
17
17
|
location @<%= fetch(:application) %> {
|
18
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
19
|
+
proxy_set_header X-Forwarded-Ssl on;
|
20
|
+
proxy_set_header X-Forwarded-Port 443;
|
18
21
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
19
22
|
proxy_set_header Host $http_host;
|
20
23
|
proxy_redirect off;
|
@@ -26,4 +29,4 @@ server {
|
|
26
29
|
error_page 500 502 503 504 /500.html;
|
27
30
|
client_max_body_size 1G;
|
28
31
|
keepalive_timeout 10;
|
29
|
-
}
|
32
|
+
}
|
@@ -7,10 +7,8 @@ server {
|
|
7
7
|
server_name <%= fetch(:server_address) %>;
|
8
8
|
|
9
9
|
root <%= fetch(:deploy_to) %>/current/public;
|
10
|
-
access_log <%= fetch(:deploy_to) %>/current/log/nginx.access.log;
|
11
|
-
error_log <%= fetch(:deploy_to) %>/current/log/nginx.error.log info;
|
12
10
|
|
13
|
-
location ^~ /
|
11
|
+
location ^~ /packs/ {
|
14
12
|
gzip_static on;
|
15
13
|
expires max;
|
16
14
|
add_header Cache-Control public;
|
@@ -18,11 +16,16 @@ server {
|
|
18
16
|
|
19
17
|
try_files $uri $uri @<%= fetch(:application) %>;
|
20
18
|
location @<%= fetch(:application) %> {
|
19
|
+
proxy_set_header X-Forwarded-Proto https;
|
20
|
+
proxy_set_header X-Url-Scheme https;
|
21
|
+
proxy_set_header X-Forwarded-Ssl on;
|
22
|
+
proxy_set_header Front-End-Https on;
|
23
|
+
|
21
24
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
22
25
|
proxy_set_header Host $http_host;
|
23
|
-
proxy_redirect
|
24
|
-
proxy_buffering
|
25
|
-
proxy_set_header
|
26
|
+
proxy_redirect off;
|
27
|
+
proxy_buffering on;
|
28
|
+
proxy_set_header X-Real-IP $remote_addr;
|
26
29
|
|
27
30
|
proxy_pass http://<%= fetch(:application) %>;
|
28
31
|
}
|
@@ -1,18 +1,18 @@
|
|
1
1
|
#!/usr/bin/env puma
|
2
2
|
|
3
3
|
directory '<%= current_path %>'
|
4
|
-
rackup
|
4
|
+
rackup '<%= current_path %>/config.ru'
|
5
5
|
environment '<%= fetch(:rails_env, 'production') %>'
|
6
6
|
tag '<%= fetch(:application)%>'
|
7
|
-
pidfile
|
8
|
-
state_path
|
9
|
-
stdout_redirect
|
7
|
+
pidfile '<%= shared_path %>/pids/puma.pid'
|
8
|
+
state_path '<%= shared_path %>/pids/puma.state'
|
9
|
+
stdout_redirect '<%= shared_path %>/log/<%= fetch(:application)%>.log', '<%= shared_path %>/log/<%= fetch(:application)%>.log', true
|
10
10
|
|
11
11
|
threads <%= fetch(:puma_threads, [0, 1]).join(',')%>
|
12
12
|
|
13
|
-
bind
|
13
|
+
bind 'unix:///tmp/<%= fetch(:application)%>.sock'
|
14
14
|
|
15
|
-
activate_control_app
|
15
|
+
activate_control_app 'unix://<%= shared_path %>/tmp/sockets/pumactl.sock'
|
16
16
|
|
17
17
|
workers <%= fetch(:puma_workers, 2) %>
|
18
18
|
|
@@ -20,7 +20,7 @@ preload_app!
|
|
20
20
|
|
21
21
|
on_restart do
|
22
22
|
puts 'Refreshing Gemfile'
|
23
|
-
ENV[
|
23
|
+
ENV['BUNDLE_GEMFILE'] = '<%= current_path %>/Gemfile'
|
24
24
|
end
|
25
25
|
|
26
26
|
before_fork do
|
@@ -7,7 +7,7 @@ autostart=<%= fetch(:autostart, 'true') %>
|
|
7
7
|
autorestart=<%= fetch(:autorestart, 'true') %>
|
8
8
|
startsecs=5
|
9
9
|
startretries=3
|
10
|
-
stderr_logfile=<%= fetch(:deploy_to) %>/shared/log
|
11
|
-
stdout_logfile=<%= fetch(:deploy_to) %>/shared/log
|
10
|
+
stderr_logfile=<%= fetch(:deploy_to) %>/shared/log/<%= fetch(:application) %>.log
|
11
|
+
stdout_logfile=<%= fetch(:deploy_to) %>/shared/log/<%= fetch(:rails_env) %>.log
|
12
12
|
stdout_logfile_maxbytes=<%= fetch(:logfile_maxbytes, '5GB') %>
|
13
13
|
stdout_logfile_backups=<%= fetch(:logfile_backups, '10') %>
|
@@ -5,6 +5,7 @@ directory=<%= fetch(:deploy_to) %>/current
|
|
5
5
|
command=/home/<%= fetch(:user) %>/.rvm/bin/rvm <%= fetch(:rvm_ruby_version, '2.4.7') %> do bundle exec rake RAILS_ENV=<%= fetch(:rails_env) %> QUEUE='*' environment resque:scheduler 2>&1 > <%= fetch(:deploy_to) %>/shared/log/resque_scheduler.log
|
6
6
|
autostart=<%= fetch(:autostart, 'true') %>
|
7
7
|
autorestart=<%= fetch(:autorestart, 'true') %>
|
8
|
+
stopsignal=QUIT
|
8
9
|
startsecs=5
|
9
10
|
startretries=3
|
10
11
|
stdout_logfile=<%= fetch(:deploy_to) %>/shared/log/resque_scheduler.log
|
@@ -5,6 +5,7 @@ directory=<%= fetch(:deploy_to) %>/current
|
|
5
5
|
command=/home/<%= fetch(:user) %>/.rvm/bin/rvm <%= fetch(:rvm_ruby_version, '2.4.7') %> do bundle exec rake RAILS_ENV=<%= fetch(:rails_env) %> QUEUE=critical,default,mailers,low environment resque:work 2>&1 > <%= fetch(:deploy_to) %>/shared/log/resque.log
|
6
6
|
autostart=<%= fetch(:autostart, 'true') %>
|
7
7
|
autorestart=<%= fetch(:autorestart, 'true') %>
|
8
|
+
stopsignal=QUIT
|
8
9
|
startsecs=5
|
9
10
|
startretries=3
|
10
11
|
stdout_logfile=<%= fetch(:deploy_to) %>/shared/log/resque.log
|
data/lib/pixelforce_recipes.rb
CHANGED
@@ -3,19 +3,8 @@ require "capistrano"
|
|
3
3
|
|
4
4
|
if defined?(Capistrano::VERSION)
|
5
5
|
if Capistrano::VERSION.to_s.split('.').first.to_i >= 3
|
6
|
-
|
7
|
-
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/capistrano_3_recipes/sidekiq")
|
8
|
-
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/capistrano_3_recipes/resque")
|
9
|
-
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/capistrano_3_recipes/resque_scheduler")
|
10
|
-
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/capistrano_3_recipes/supervisor")
|
11
|
-
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/capistrano_3_recipes/unicorn")
|
12
|
-
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/capistrano_3_recipes/puma")
|
6
|
+
Dir[File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/capistrano_3_recipes/*.rb")].each {|file| require file }
|
13
7
|
else
|
14
|
-
|
15
|
-
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/legacy_recipes/unicorn")
|
16
|
-
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/legacy_recipes/sidekiq")
|
17
|
-
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/legacy_recipes/resque")
|
18
|
-
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/legacy_recipes/puma")
|
19
|
-
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/legacy_recipes/logrotate")
|
8
|
+
Dir[File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/legacy_recipes/*.rb")].each {|file| require file }
|
20
9
|
end
|
21
10
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixelforce_recipes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '2.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Zhang
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -119,7 +119,7 @@ homepage: https://git.pixelforcesystems.com.au/
|
|
119
119
|
licenses:
|
120
120
|
- MIT
|
121
121
|
metadata: {}
|
122
|
-
post_install_message:
|
122
|
+
post_install_message:
|
123
123
|
rdoc_options: []
|
124
124
|
require_paths:
|
125
125
|
- lib
|
@@ -134,9 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
|
-
|
138
|
-
|
139
|
-
signing_key:
|
137
|
+
rubygems_version: 3.0.6
|
138
|
+
signing_key:
|
140
139
|
specification_version: 4
|
141
140
|
summary: Write a short summary, because Rubygems requires one.
|
142
141
|
test_files: []
|