pixelforce_recipes 2.3 → 3.2

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: ad9d77ec9bf9d8ffe4eabde0ee7813cd2d8f900584b2908cb628658bc93261a1
4
- data.tar.gz: 37927ba6a5f7ebf744331a2e2f6829538db140eedce42ae118d6b0db82393249
3
+ metadata.gz: 7905038f3c5054c06689ee483a7b158ac72a334660b454b60052861002914673
4
+ data.tar.gz: c715817402a72a47b814c190fba4f30e437de3c08c70c4a089bdd8a78fecd1a5
5
5
  SHA512:
6
- metadata.gz: b855a9ead01e7808631d853bbed9a278661439597910b97bd75b175bd7a4ff22fdbf9508a693669645ee2f7d38e2100b73ac9b151cc88a1fcc9d29a263407b2a
7
- data.tar.gz: e244b96ca0385bf32fb349b0506728ac1c9bb41003e6a884aefd110fc7a2b7aff4d047631250d95236325d0c0226e0542df99f0bed2f71f97f9c6d2faf4a4016
6
+ metadata.gz: 50b57475792027bca4943499d209c1c8d61e5105a626aa33052811659f42ce80d53b58a30752813f3d9f2ac63548ece5cf3b3d157ab16dd4f1f1128de8d68c68
7
+ data.tar.gz: c23bf29502ee0bde6926139cc552a8babf80f534c82f2cfb99f7402f3dfb3a4c66065157cddd056f1e8cbe794c3c61fdb6870a2587b905c90a2eafcb03957449
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pixelforce_recipes (2.3)
4
+ pixelforce_recipes (3.1)
5
5
  capistrano (> 2.0.0)
6
6
 
7
7
  GEM
@@ -16,7 +16,7 @@ GEM
16
16
  sshkit (>= 1.9.0)
17
17
  concurrent-ruby (1.1.9)
18
18
  diff-lcs (1.2.5)
19
- i18n (1.8.10)
19
+ i18n (1.8.11)
20
20
  concurrent-ruby (~> 1.0)
21
21
  net-scp (3.0.0)
22
22
  net-ssh (>= 2.6.5, < 7.0.0)
@@ -43,10 +43,9 @@ PLATFORMS
43
43
  ruby
44
44
 
45
45
  DEPENDENCIES
46
- bundler (~> 1.12)
47
46
  pixelforce_recipes!
48
47
  rake (~> 13.0)
49
48
  rspec (~> 3.0)
50
49
 
51
50
  BUNDLED WITH
52
- 1.17.3
51
+ 2.2.10
@@ -1,66 +1,43 @@
1
1
  namespace :puma do
2
-
3
- desc "Setup puma configuration for this application"
2
+ desc 'Setup puma configuration for this application'
4
3
  task :config do
5
4
  on roles(:web) do
6
- template "puma.rb.erb", "/tmp/puma_conf"
5
+ template 'puma.rb.erb', '/tmp/puma_conf'
7
6
  sudo "mv /tmp/puma_conf #{shared_path}/config/puma.rb"
8
7
  execute "mkdir -p #{shared_path}/pids"
9
8
  end
10
9
  end
11
10
 
12
- namespace :sysvinit do
11
+ namespace :systemd do
13
12
  task :setup do
14
13
  on roles(:web) do
15
- template "puma_init.erb", "/tmp/puma"
16
- sudo "mv /tmp/puma /etc/init.d/#{fetch(:application)}"
17
- sudo "chmod +x /etc/init.d/#{fetch(:application)}"
18
- sudo "update-rc.d #{fetch(:application)} defaults"
19
- template "nginx_puma_config.erb", "/tmp/nginx_puma_config"
20
- sudo "mv /tmp/nginx_puma_config /etc/nginx/sites-enabled/#{fetch(:application)}"
14
+ template 'puma_systemd.erb', '/tmp/puma.service'
15
+ sudo 'mv /tmp/puma.service /etc/systemd/system/puma.service'
16
+ sudo 'systemctl daemon-reload'
17
+ sudo 'systemctl enable puma.service'
18
+ sudo 'systemctl start puma.service'
21
19
  end
22
20
  end
23
21
 
24
- %w[start stop restart reload].each do |command|
25
- desc "#{command} puma"
26
- task command do
27
- on roles(:web) do
28
- execute "/etc/init.d/#{fetch(:application)} #{command}"
29
- end
30
- end
31
- end
32
- end
33
-
34
- namespace :supervisor do
35
- task :setup do
22
+ task :restart do
36
23
  on roles(:web) do
37
- template "puma_supervisor.erb", "/tmp/puma"
38
- sudo "mv /tmp/puma /etc/supervisor/conf.d/#{fetch(:application)}.conf"
39
- sudo "supervisorctl reread"
40
- sudo "supervisorctl update" # it will auto start the application
41
- template "nginx_puma_config.erb", "/tmp/nginx_puma_config"
42
- sudo "mv /tmp/nginx_puma_config /etc/nginx/sites-enabled/#{fetch(:application)}"
24
+ sudo 'systemctl restart puma'
43
25
  end
44
26
  end
45
27
 
46
- task :start do
47
- on roles(:web) do
48
- execute "supervisorctl start #{fetch(:application)}"
49
- end
50
- end
51
- task :stop do
52
- on roles(:web) do
53
- execute "supervisorctl signal INT #{fetch(:application)}"
54
- end
55
- end
56
- task :restart do
28
+ task :reload do
57
29
  on roles(:web) do
58
- execute "supervisorctl signal USR1 #{fetch(:application)}"
30
+ sudo 'systemctl reload puma'
59
31
  end
60
32
  end
61
- task :reload do
33
+ end
34
+
35
+ namespace :supervisor do
36
+ task :uninstall do
62
37
  on roles(:web) do
63
- execute "supervisorctl signal USR2 #{fetch(:application)}"
38
+ sudo "rm /etc/supervisor/conf.d/#{fetch(:application)}.conf"
39
+ sudo 'supervisorctl reread'
40
+ sudo 'supervisorctl update'
64
41
  end
65
42
  end
66
43
  end
@@ -1,75 +1,36 @@
1
1
  namespace :sidekiq do
2
- desc "Install sidekiq"
2
+ desc 'Install sidekiq'
3
3
 
4
- desc "Setup sidekiq configuration for this application"
5
- namespace :sysvinit do
4
+ namespace :systemd do
6
5
  task :setup do
7
- on roles(:sidekiq) do
8
- template "sidekiq_init.erb", "/tmp/sidekiq"
9
- sudo "mv /tmp/sidekiq /etc/init.d/sidekiq"
10
- sudo "chmod +x /etc/init.d/sidekiq"
11
- sudo "update-rc.d sidekiq defaults"
12
- end
13
- end
14
-
15
- %w[start stop restart].each do |command|
16
- desc "#{command} sidekiq"
17
- task command do
18
- on roles(:sidekiq) do
19
- execute "/etc/init.d/sidekiq #{command}"
20
- end
21
- end
22
- end
23
- end
24
- namespace :supervisor do
25
- task :setup do
26
- on roles(:sidekiq) do
27
- template "sidekiq_supervisor.erb", "/tmp/sidekiq"
28
- sudo "mv /tmp/sidekiq /etc/supervisor/conf.d/sidekiq.conf"
29
- sudo "supervisorctl reread"
30
- sudo "supervisorctl update" # it will auto start the application
6
+ on roles(:web) do
7
+ template 'sidekiq_systemd.erb', '/tmp/sidekiq.service'
8
+ sudo 'mv /tmp/sidekiq.service /etc/systemd/system/sidekiq.service'
9
+ sudo 'systemctl daemon-reload'
10
+ sudo 'systemctl enable sidekiq'
11
+ sudo 'systemctl start sidekiq'
31
12
  end
32
13
  end
33
14
 
34
- %w[start stop restart].each do |command|
35
- desc "#{command} sidekiq"
36
- task command do
37
- on roles(:sidekiq) do
38
- execute "supervisorctl #{command} sidekiq"
39
- end
40
- end
41
- end
42
15
  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"
16
+ on roles(:web) do
17
+ sudo 'systemctl kill -s TSTP sidekiq'
52
18
  end
53
19
  end
54
20
 
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:*"
21
+ task :restart do
22
+ on roles(:web) do
23
+ sudo 'systemctl restart sidekiq'
67
24
  end
68
25
  end
69
- task :rolling_restart_group do
70
- desc "used for rolling restart, only available on enterprise version"
26
+ end
27
+
28
+ namespace :supervisor do
29
+ task :uninstall do
71
30
  on roles(:sidekiq) do
72
- execute "supervisorctl signal USR2 sidekiq:*"
31
+ sudo 'rm/etc/supervisor/conf.d/sidekiq.conf'
32
+ sudo 'supervisorctl reread'
33
+ sudo 'supervisorctl update'
73
34
  end
74
35
  end
75
36
  end
@@ -16,12 +16,16 @@ server {
16
16
 
17
17
  try_files $uri $uri @<%= fetch(:application) %>;
18
18
  location @<%= fetch(:application) %> {
19
- proxy_set_header X-Forwarded-Proto $scheme;
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
+
20
24
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
21
25
  proxy_set_header Host $http_host;
22
- proxy_redirect off;
23
- proxy_buffering on;
24
- proxy_set_header X-Real-IP $remote_addr;
26
+ proxy_redirect off;
27
+ proxy_buffering on;
28
+ proxy_set_header X-Real-IP $remote_addr;
25
29
 
26
30
  proxy_pass http://<%= fetch(:application) %>;
27
31
  }
@@ -0,0 +1,19 @@
1
+ [Unit]
2
+ Description=Puma HTTP Server
3
+ After=network.target
4
+
5
+ [Service]
6
+ Type=simple
7
+ User=<%= fetch(:user) %>
8
+ WorkingDirectory=<%= fetch(:deploy_to) %>/current
9
+
10
+ # Helpful for debugging socket activation, etc.
11
+ # Environment=PUMA_DEBUG=1
12
+
13
+ ExecStart=/bin/bash -l -c 'bundle exec puma -C <%= fetch(:deploy_to) %>/shared/config/puma.rb -e <%= fetch(:rails_env) %>'
14
+ ExecStop=/bin/bash -l -c 'bundle exec pumactl -F <%= fetch(:deploy_to) %>/shared/config/puma.rb stop'
15
+ ExecReload=/bin/bash -l -c 'bundle exec pumactl -F <%= fetch(:deploy_to) %>/shared/config/puma.rb phased-restart'
16
+ Restart=always
17
+
18
+ [Install]
19
+ WantedBy=multi-user.target
@@ -0,0 +1,17 @@
1
+ [Unit]
2
+ Description=Sidekiq Background Process
3
+ After=syslog.target network.target
4
+
5
+ [Service]
6
+ Type=simple
7
+ User=<%= fetch(:user) %>
8
+ WorkingDirectory=<%= fetch(:deploy_to) %>/current
9
+
10
+ # Helpful for debugging socket activation, etc.
11
+ Environment=MALLOC_ARENA_MAX=2
12
+
13
+ ExecStart=/bin/bash -l -c 'bundle exec sidekiq -L <%= fetch(:deploy_to) %>/shared/log/sidekiq.log -e <%= fetch(:rails_env) %>'
14
+ Restart=always
15
+
16
+ [Install]
17
+ WantedBy=multi-user.target
@@ -1,3 +1,3 @@
1
1
  module PixelforceRecipes
2
- VERSION = "2.3"
2
+ VERSION = "3.2"
3
3
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{Write a short summary, because Rubygems requires one.}
13
13
  spec.description = %q{Write a longer description or delete this line.}
14
- spec.homepage = "https://git.pixelforcesystems.com.au/"
14
+ spec.homepage = "https://github.com/BenZhang/pixelforce_recipes"
15
15
  spec.license = "MIT"
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
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: '2.3'
4
+ version: '3.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Zhang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-03 00:00:00.000000000 Z
11
+ date: 2021-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -102,20 +102,20 @@ files:
102
102
  - lib/pixelforce_recipes/templates/nginx_config.erb
103
103
  - lib/pixelforce_recipes/templates/nginx_puma_config.erb
104
104
  - lib/pixelforce_recipes/templates/puma.rb.erb
105
- - lib/pixelforce_recipes/templates/puma_init.erb
106
- - lib/pixelforce_recipes/templates/puma_supervisor.erb
105
+ - lib/pixelforce_recipes/templates/puma_systemd.erb
107
106
  - lib/pixelforce_recipes/templates/resque_init.erb
108
107
  - lib/pixelforce_recipes/templates/resque_scheduler_init.erb
109
108
  - lib/pixelforce_recipes/templates/resque_scheduler_supervisor.erb
110
109
  - lib/pixelforce_recipes/templates/resque_supervisor.erb
111
110
  - lib/pixelforce_recipes/templates/sidekiq_init.erb
112
111
  - lib/pixelforce_recipes/templates/sidekiq_supervisor.erb
112
+ - lib/pixelforce_recipes/templates/sidekiq_systemd.erb
113
113
  - lib/pixelforce_recipes/templates/supervisor.erb
114
114
  - lib/pixelforce_recipes/templates/unicorn_init.erb
115
115
  - lib/pixelforce_recipes/templates/unicorn_supervisor.erb
116
116
  - lib/pixelforce_recipes/version.rb
117
117
  - pixelforce_recipes.gemspec
118
- homepage: https://git.pixelforcesystems.com.au/
118
+ homepage: https://github.com/BenZhang/pixelforce_recipes
119
119
  licenses:
120
120
  - MIT
121
121
  metadata: {}
@@ -1,55 +0,0 @@
1
- #!/bin/bash
2
-
3
- ### BEGIN INIT INFO
4
- # Provides: <%= fetch(:application) %>
5
- # Required-Start: $local_fs $remote_fs $network $syslog
6
- # Required-Stop: $local_fs $remote_fs $network $syslog
7
- # Default-Start: 2 3 4 5
8
- # Default-Stop: 0 1 6
9
- # Short-Description: starts the puma web server
10
- # Description: starts puma
11
- ### END INIT INFO
12
-
13
- USER="<%= fetch(:user) %>"
14
- DAEMON=puma
15
- PROJECT_PATH="<%= fetch(:deploy_to) %>"
16
- DAEMON_OPTS="-C $PROJECT_PATH/shared/config/puma.rb -e <%= fetch(:rails_env) %> -d"
17
- NAME=puma
18
- DESC="puma app for $USER"
19
- PID="$PROJECT_PATH/shared/pids/puma.pid"
20
-
21
- case "$1" in
22
- start)
23
- CD_TO_APP_DIR="cd $PROJECT_PATH/current"
24
- START_DAEMON_PROCESS="bundle exec $DAEMON $DAEMON_OPTS"
25
-
26
- echo -n "Starting $DESC: "
27
- if [ `whoami` = 'root' ]; then
28
- su - $USER -c "$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS"
29
- else
30
- $CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS
31
- fi
32
- echo "$NAME."
33
- ;;
34
- stop)
35
- echo -n "Stopping $DESC: "
36
- kill -INT `cat $PID`
37
- echo "$NAME."
38
- ;;
39
- restart)
40
- echo -n "Restarting $DESC: "
41
- kill -USR1 `cat $PID`
42
- echo "$NAME."
43
- ;;
44
- reload)
45
- echo -n "Reloading $DESC configuration: "
46
- kill -USR2 `cat $PID`
47
- echo "$NAME."
48
- ;;
49
- *)
50
- echo "Usage: $NAME {start|stop|restart|reload}" >&2
51
- exit 1
52
- ;;
53
- esac
54
-
55
- exit 0
@@ -1,13 +0,0 @@
1
- [program:<%= fetch(:application) %>]
2
- user=<%= fetch(:user) %>
3
- environment=HOME="/home/<%= fetch(:user) %>",USER="<%= fetch(:user) %>"
4
- directory=<%= fetch(:deploy_to) %>/current
5
- command=/home/<%= fetch(:user) %>/.rvm/bin/rvm <%= fetch(:rvm_ruby_version, '2.4.7') %> do bundle exec puma -C <%= fetch(:deploy_to) %>/shared/config/puma.rb -e <%= fetch(:rails_env) %>
6
- autostart=<%= fetch(:autostart, 'true') %>
7
- autorestart=<%= fetch(:autorestart, 'true') %>
8
- startsecs=5
9
- startretries=3
10
- stderr_logfile=<%= fetch(:deploy_to) %>/shared/log/<%= fetch(:application) %>.log
11
- stdout_logfile=<%= fetch(:deploy_to) %>/shared/log/<%= fetch(:rails_env) %>.log
12
- stdout_logfile_maxbytes=<%= fetch(:logfile_maxbytes, '5GB') %>
13
- stdout_logfile_backups=<%= fetch(:logfile_backups, '10') %>