pixelforce_recipes 1.3 → 2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +12 -12
- data/README.md +33 -1
- data/lib/pixelforce_recipes.rb +18 -5
- data/lib/pixelforce_recipes/capistrano_3_recipes/base.rb +4 -0
- data/lib/pixelforce_recipes/capistrano_3_recipes/logrotate.rb +9 -0
- data/lib/pixelforce_recipes/capistrano_3_recipes/puma.rb +64 -0
- data/lib/pixelforce_recipes/capistrano_3_recipes/resque.rb +43 -0
- data/lib/pixelforce_recipes/capistrano_3_recipes/resque_scheduler.rb +43 -0
- data/lib/pixelforce_recipes/capistrano_3_recipes/sidekiq.rb +76 -0
- data/lib/pixelforce_recipes/capistrano_3_recipes/supervisor.rb +9 -0
- data/lib/pixelforce_recipes/capistrano_3_recipes/unicorn.rb +58 -0
- data/lib/pixelforce_recipes/{base.rb → legacy_recipes/base.rb} +1 -1
- data/lib/pixelforce_recipes/{logrotate.rb → legacy_recipes/logrotate.rb} +0 -0
- data/lib/pixelforce_recipes/{puma.rb → legacy_recipes/puma.rb} +0 -0
- data/lib/pixelforce_recipes/legacy_recipes/resque.rb +22 -0
- data/lib/pixelforce_recipes/legacy_recipes/resque_scheduler.rb +22 -0
- data/lib/pixelforce_recipes/{sidekiq.rb → legacy_recipes/sidekiq.rb} +0 -0
- data/lib/pixelforce_recipes/{unicorn.rb → legacy_recipes/unicorn.rb} +0 -0
- data/lib/pixelforce_recipes/templates/logrotate.erb +6 -4
- data/lib/pixelforce_recipes/templates/nginx_config.erb +11 -8
- data/lib/pixelforce_recipes/templates/nginx_puma_config.erb +10 -11
- data/lib/pixelforce_recipes/templates/puma.rb.erb +34 -0
- data/lib/pixelforce_recipes/templates/puma_init.erb +8 -8
- data/lib/pixelforce_recipes/templates/puma_supervisor.erb +13 -0
- data/lib/pixelforce_recipes/templates/resque_init.erb +49 -0
- data/lib/pixelforce_recipes/templates/resque_scheduler_init.erb +49 -0
- data/lib/pixelforce_recipes/templates/resque_scheduler_supervisor.erb +13 -0
- data/lib/pixelforce_recipes/templates/resque_supervisor.erb +13 -0
- data/lib/pixelforce_recipes/templates/sidekiq_init.erb +4 -4
- data/lib/pixelforce_recipes/templates/sidekiq_supervisor.erb +12 -0
- data/lib/pixelforce_recipes/templates/supervisor.erb +19 -0
- data/lib/pixelforce_recipes/templates/unicorn_init.erb +4 -4
- data/lib/pixelforce_recipes/templates/unicorn_supervisor.erb +13 -0
- data/lib/pixelforce_recipes/version.rb +1 -1
- data/pixelforce_recipes.gemspec +1 -1
- metadata +32 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4cc8944ed978b04a14ad148a608429564b240baf6c4aa0645e07c61879779b0f
|
4
|
+
data.tar.gz: 8470f58a2d5e1b4688ffecbeef0b6214bf910ba2c8bb8728ffd204b316e98437
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd84db64c8238e86f2d7715eb8c15f7123ca385436434b6ad2ca69c465ad29b164f4f8aa9f31bea2bbf05f432ee2b4e9c6bce8347fb5b36accb8d319babd6684
|
7
|
+
data.tar.gz: 181f1e7f3b8a0b5e7fb2ac10921e5132f56218a1663354e89c3cbbb327dd3c5ca155ea6a6c6450797bd48de560df312ccb32aaa49eba14e65c3bad2c8ad9298f
|
data/Gemfile.lock
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pixelforce_recipes (1.
|
4
|
+
pixelforce_recipes (1.8)
|
5
5
|
capistrano (> 2.0.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
airbrussh (1.
|
10
|
+
airbrussh (1.4.0)
|
11
11
|
sshkit (>= 1.6.1, != 1.7.0)
|
12
|
-
capistrano (3.
|
12
|
+
capistrano (3.12.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.
|
17
|
+
concurrent-ruby (1.1.6)
|
18
18
|
diff-lcs (1.2.5)
|
19
|
-
i18n (1.
|
19
|
+
i18n (1.8.2)
|
20
20
|
concurrent-ruby (~> 1.0)
|
21
|
-
net-scp (
|
22
|
-
net-ssh (>= 2.6.5)
|
23
|
-
net-ssh (5.0
|
24
|
-
rake (
|
21
|
+
net-scp (2.0.0)
|
22
|
+
net-ssh (>= 2.6.5, < 6.0.0)
|
23
|
+
net-ssh (5.2.0)
|
24
|
+
rake (13.0.1)
|
25
25
|
rspec (3.5.0)
|
26
26
|
rspec-core (~> 3.5.0)
|
27
27
|
rspec-expectations (~> 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.20.0)
|
39
39
|
net-scp (>= 1.1.2)
|
40
40
|
net-ssh (>= 2.8.0)
|
41
41
|
|
@@ -45,8 +45,8 @@ PLATFORMS
|
|
45
45
|
DEPENDENCIES
|
46
46
|
bundler (~> 1.12)
|
47
47
|
pixelforce_recipes!
|
48
|
-
rake (~>
|
48
|
+
rake (~> 13.0)
|
49
49
|
rspec (~> 3.0)
|
50
50
|
|
51
51
|
BUNDLED WITH
|
52
|
-
1.
|
52
|
+
1.16.6
|
data/README.md
CHANGED
@@ -34,8 +34,40 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
34
34
|
|
35
35
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pixelforce_recipes. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
36
|
|
37
|
+
## supervisor support
|
38
|
+
|
39
|
+
The recipes for capistrano3 with supervisor support.
|
40
|
+
Please use `process:supervisor:task` to invoke it.
|
41
|
+
They relied on some capistrano plugins for some variables
|
42
|
+
|
43
|
+
* [**rvm**](https://github.com/capistrano/rvm) for `rvm_ruby_version`
|
44
|
+
|
45
|
+
Tweak some option for supervisor, the following value is default
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
set :autostart, 'true'
|
49
|
+
set :autorestart, 'true'
|
50
|
+
set :logfile_maxbytes, '1GB'
|
51
|
+
set :logfile_backups, '10'
|
52
|
+
```
|
53
|
+
|
54
|
+
#### unicorn
|
55
|
+
|
56
|
+
Relied on unicornherder for supervisor monitoring.
|
57
|
+
|
58
|
+
#### puma
|
59
|
+
|
60
|
+
Get rid of capistrano-puma, and now generate puma config itself.
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
set :puma_threads, [0, 1]
|
64
|
+
set :puma_workers, 2
|
65
|
+
```
|
66
|
+
|
67
|
+
## sysvinit support
|
68
|
+
|
69
|
+
Please use `process:sysvinit:task` to invoke it.
|
37
70
|
|
38
71
|
## License
|
39
72
|
|
40
73
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
data/lib/pixelforce_recipes.rb
CHANGED
@@ -1,8 +1,21 @@
|
|
1
1
|
require "pixelforce_recipes/version"
|
2
2
|
require "capistrano"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/
|
7
|
-
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/
|
8
|
-
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/
|
4
|
+
if defined?(Capistrano::VERSION)
|
5
|
+
if Capistrano::VERSION.to_s.split('.').first.to_i >= 3
|
6
|
+
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/capistrano_3_recipes/base")
|
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")
|
13
|
+
else
|
14
|
+
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/legacy_recipes/base")
|
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")
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
namespace :puma do
|
2
|
+
|
3
|
+
desc "Setup puma configuration for this application"
|
4
|
+
task :config do
|
5
|
+
on roles(:web) do
|
6
|
+
template "puma.rb.erb", "/tmp/puma_conf"
|
7
|
+
sudo "mv /tmp/puma_conf #{shared_path}/config/puma.rb"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
namespace :sysvinit do
|
11
|
+
task :setup do
|
12
|
+
on roles(:web) do
|
13
|
+
template "puma_init.erb", "/tmp/puma"
|
14
|
+
sudo "mv /tmp/puma /etc/init.d/#{fetch(:application)}"
|
15
|
+
sudo "chmod +x /etc/init.d/#{fetch(:application)}"
|
16
|
+
sudo "update-rc.d #{fetch(:application)} defaults"
|
17
|
+
template "nginx_puma_config.erb", "/tmp/nginx_puma_config"
|
18
|
+
sudo "mv /tmp/nginx_puma_config /etc/nginx/sites-enabled/#{fetch(:application)}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
%w[start stop restart reload].each do |command|
|
23
|
+
desc "#{command} puma"
|
24
|
+
task command do
|
25
|
+
on roles(:web) do
|
26
|
+
execute "/etc/init.d/#{fetch(:application)} #{command}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
namespace :supervisor do
|
32
|
+
task :setup do
|
33
|
+
on roles(:web) do
|
34
|
+
template "puma_supervisor.erb", "/tmp/puma"
|
35
|
+
sudo "mv /tmp/puma /etc/supervisor/conf.d/#{fetch(:application)}.conf"
|
36
|
+
sudo "supervisorctl reread"
|
37
|
+
sudo "supervisorctl update" # it will auto start the application
|
38
|
+
template "nginx_puma_config.erb", "/tmp/nginx_puma_config"
|
39
|
+
sudo "mv /tmp/nginx_puma_config /etc/nginx/sites-enabled/#{fetch(:application)}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
task :start do
|
44
|
+
on roles(:web) do
|
45
|
+
execute "supervisorctl start #{fetch(:application)}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
task :stop do
|
49
|
+
on roles(:web) do
|
50
|
+
execute "supervisorctl signal INT #{fetch(:application)}"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
task :restart do
|
54
|
+
on roles(:web) do
|
55
|
+
execute "supervisorctl signal USR1 #{fetch(:application)}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
task :reload do
|
59
|
+
on roles(:web) do
|
60
|
+
execute "supervisorctl signal USR2 #{fetch(:application)}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
namespace :resque do
|
2
|
+
desc "Install resque"
|
3
|
+
|
4
|
+
desc "Setup resque configuration for this application"
|
5
|
+
namespace :sysvinit do
|
6
|
+
task :setup do
|
7
|
+
on roles(:resque) do
|
8
|
+
template "resque_init.erb", "/tmp/resque"
|
9
|
+
sudo "mv /tmp/resque /etc/init.d/resque"
|
10
|
+
sudo "chmod +x /etc/init.d/resque"
|
11
|
+
sudo "update-rc.d resque defaults"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
%w[start stop restart].each do |command|
|
16
|
+
desc "#{command} resque"
|
17
|
+
task command do
|
18
|
+
on roles(:resque) do
|
19
|
+
execute "/etc/init.d/resque #{command}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
namespace :supervisor do
|
25
|
+
task :setup do
|
26
|
+
on roles(:resque) do
|
27
|
+
template "resque_supervisor.erb", "/tmp/resque"
|
28
|
+
sudo "mv /tmp/resque /etc/supervisor/conf.d/resque.conf"
|
29
|
+
sudo "supervisorctl reread"
|
30
|
+
sudo "supervisorctl update" # it will auto start the application
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
%w[start stop restart].each do |command|
|
35
|
+
desc "#{command} resque"
|
36
|
+
task command do
|
37
|
+
on roles(:resque) do
|
38
|
+
execute "supervisorctl #{command} resque"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
namespace :resque_scheduler do
|
2
|
+
desc "Install resque scheduler"
|
3
|
+
|
4
|
+
desc "Setup resque scheduler configuration for this application"
|
5
|
+
namespace :sysvinit do
|
6
|
+
task :setup do
|
7
|
+
on roles(:resque) do
|
8
|
+
template "resque_scheduler_init.erb", "/tmp/resque_scheduler"
|
9
|
+
sudo "mv /tmp/resque_scheduler /etc/init.d/resque_scheduler"
|
10
|
+
sudo "chmod +x /etc/init.d/resque_scheduler"
|
11
|
+
sudo "update-rc.d resque_scheduler defaults"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
%w[start stop restart].each do |command|
|
16
|
+
desc "#{command} resque_scheduler"
|
17
|
+
task command do
|
18
|
+
on roles(:resque) do
|
19
|
+
execute "/etc/init.d/resque_scheduler #{command}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
namespace :supervisor do
|
25
|
+
task :setup do
|
26
|
+
on roles(:resque) do
|
27
|
+
template "resque_scheduler_supervisor.erb", "/tmp/resque_scheduler"
|
28
|
+
sudo "mv /tmp/resque_scheduler /etc/supervisor/conf.d/resque_scheduler.conf"
|
29
|
+
sudo "supervisorctl reread"
|
30
|
+
sudo "supervisorctl update" # it will auto start the application
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
%w[start stop restart].each do |command|
|
35
|
+
desc "#{command} resque_scheduler"
|
36
|
+
task command do
|
37
|
+
on roles(:resque) do
|
38
|
+
execute "supervisorctl #{command} resque_scheduler"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
namespace :sidekiq do
|
2
|
+
desc "Install sidekiq"
|
3
|
+
|
4
|
+
desc "Setup sidekiq configuration for this application"
|
5
|
+
namespace :sysvinit do
|
6
|
+
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
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
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
|
+
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
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
namespace :unicorn do
|
2
|
+
desc "Install unicorn"
|
3
|
+
namespace :sysvinit do
|
4
|
+
task :setup do
|
5
|
+
on roles(:web) do
|
6
|
+
template "unicorn_init.erb", "/tmp/unicorn"
|
7
|
+
sudo "mv /tmp/unicorn /etc/init.d/#{fetch(:application)}"
|
8
|
+
sudo "chmod +x /etc/init.d/#{fetch(:application)}"
|
9
|
+
sudo "update-rc.d #{fetch(:application)} defaults"
|
10
|
+
template "nginx_config.erb", "/tmp/nginx_config"
|
11
|
+
sudo "mv /tmp/nginx_config /etc/nginx/sites-enabled/#{fetch(:application)}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
%w[start stop restart reload].each do |command|
|
16
|
+
desc "#{command} unicorn"
|
17
|
+
task command do
|
18
|
+
on roles(:web) do
|
19
|
+
execute "/etc/init.d/#{fetch(:application)} #{command}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
namespace :supervisor do
|
25
|
+
desc "Setup unicorn configuration for this application"
|
26
|
+
task :setup do
|
27
|
+
on roles(:web) do
|
28
|
+
template "unicorn_supervisor.erb", "/tmp/unicorn"
|
29
|
+
sudo "mv /tmp/unicorn /etc/supervisor/conf.d/#{fetch(:application)}.conf"
|
30
|
+
sudo "supervisorctl reread"
|
31
|
+
sudo "supervisorctl update" # it will auto start the application
|
32
|
+
template "nginx_config.erb", "/tmp/nginx_config"
|
33
|
+
sudo "mv /tmp/nginx_config /etc/nginx/sites-enabled/#{fetch(:application)}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
task :start do
|
38
|
+
on roles(:web) do
|
39
|
+
execute "supervisorctl start #{fetch(:application)}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
task :stop do
|
43
|
+
on roles(:web) do
|
44
|
+
execute "supervisorctl signal QUIT #{fetch(:application)}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
task :restart do
|
48
|
+
on roles(:web) do
|
49
|
+
execute "supervisorctl signal USR2 #{fetch(:application)}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
task :reload do
|
53
|
+
on roles(:web) do
|
54
|
+
execute "supervisorctl signal HUP #{fetch(:application)}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -3,7 +3,7 @@ if Capistrano::Configuration.instance(false)
|
|
3
3
|
Capistrano::Configuration.instance(true).load do |instance|
|
4
4
|
|
5
5
|
def template(from, to)
|
6
|
-
erb = File.read(File.expand_path("
|
6
|
+
erb = File.read(File.expand_path("../../templates/#{from}", __FILE__))
|
7
7
|
put ERB.new(erb).result(binding), to
|
8
8
|
end
|
9
9
|
|
File without changes
|
File without changes
|
@@ -0,0 +1,22 @@
|
|
1
|
+
if Capistrano::Configuration.instance(false)
|
2
|
+
Capistrano::Configuration.instance(true).load do |instance|
|
3
|
+
namespace :resque do
|
4
|
+
desc "Install resque"
|
5
|
+
|
6
|
+
desc "Setup resque configuration for this application"
|
7
|
+
task :setup, roles: :resque do
|
8
|
+
template "resque_init.erb", "/tmp/resque"
|
9
|
+
run "#{sudo} mv /tmp/resque /etc/init.d/resque"
|
10
|
+
run "#{sudo} chmod +x /etc/init.d/resque"
|
11
|
+
run "#{sudo} update-rc.d resque defaults"
|
12
|
+
end
|
13
|
+
|
14
|
+
%w[start stop restart].each do |command|
|
15
|
+
desc "#{command} resque"
|
16
|
+
task command do
|
17
|
+
run "/etc/init.d/resque #{command}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
if Capistrano::Configuration.instance(false)
|
2
|
+
Capistrano::Configuration.instance(true).load do |instance|
|
3
|
+
namespace :resque_scheduler do
|
4
|
+
desc "Install resque scheduler"
|
5
|
+
|
6
|
+
desc "Setup resque scheduler configuration for this application"
|
7
|
+
task :setup, roles: :resque do
|
8
|
+
template "resque_scheduler_init.erb", "/tmp/resque_scheduler"
|
9
|
+
run "#{sudo} mv /tmp/resque_scheduler /etc/init.d/resque_scheduler"
|
10
|
+
run "#{sudo} chmod +x /etc/init.d/resque_scheduler"
|
11
|
+
run "#{sudo} update-rc.d resque_scheduler defaults"
|
12
|
+
end
|
13
|
+
|
14
|
+
%w[start stop restart].each do |command|
|
15
|
+
desc "#{command} resque scheduler"
|
16
|
+
task command do
|
17
|
+
run "/etc/init.d/resque_scheduler #{command}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
File without changes
|
File without changes
|
@@ -1,29 +1,32 @@
|
|
1
|
-
upstream <%= application %> {
|
2
|
-
server unix:/tmp/<%= application %>.sock fail_timeout=0;
|
1
|
+
upstream <%= fetch(:application) %> {
|
2
|
+
server unix:/tmp/<%= fetch(:application) %>.sock fail_timeout=0;
|
3
3
|
}
|
4
4
|
|
5
5
|
server {
|
6
6
|
listen 80;
|
7
|
-
server_name <%= server_address %>;
|
8
|
-
root <%= deploy_to %>/current/public;
|
7
|
+
server_name <%= fetch(:server_address) %>;
|
8
|
+
root <%= fetch(:deploy_to) %>/current/public;
|
9
9
|
|
10
|
-
try_files $uri/index.html $uri @<%= application %>;
|
10
|
+
try_files $uri/index.html $uri @<%= fetch(:application) %>;
|
11
11
|
|
12
12
|
location ~* ^(/assets|/favicon.ico) {
|
13
13
|
access_log off;
|
14
14
|
expires max;
|
15
15
|
}
|
16
16
|
|
17
|
-
location @<%= application %> {
|
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;
|
21
24
|
proxy_buffering on;
|
22
25
|
proxy_set_header X-Real-IP $remote_addr;
|
23
|
-
proxy_pass http://<%= application %>;
|
26
|
+
proxy_pass http://<%= fetch(:application) %>;
|
24
27
|
}
|
25
28
|
|
26
29
|
error_page 500 502 503 504 /500.html;
|
27
30
|
client_max_body_size 1G;
|
28
31
|
keepalive_timeout 10;
|
29
|
-
}
|
32
|
+
}
|
@@ -1,14 +1,12 @@
|
|
1
|
-
upstream <%= application %> {
|
2
|
-
server unix:/tmp/<%= application %>.sock fail_timeout=0;
|
1
|
+
upstream <%= fetch(:application) %> {
|
2
|
+
server unix:/tmp/<%= fetch(:application) %>.sock fail_timeout=0;
|
3
3
|
}
|
4
4
|
|
5
5
|
server {
|
6
6
|
listen 80 default_server deferred;
|
7
|
-
server_name <%= server_address %>;
|
7
|
+
server_name <%= fetch(:server_address) %>;
|
8
8
|
|
9
|
-
root <%= deploy_to %>/current/public;
|
10
|
-
access_log <%= deploy_to %>/current/log/nginx.access.log;
|
11
|
-
error_log <%= deploy_to %>/current/log/nginx.error.log info;
|
9
|
+
root <%= fetch(:deploy_to) %>/current/public;
|
12
10
|
|
13
11
|
location ^~ /assets/ {
|
14
12
|
gzip_static on;
|
@@ -16,19 +14,20 @@ server {
|
|
16
14
|
add_header Cache-Control public;
|
17
15
|
}
|
18
16
|
|
19
|
-
try_files $uri $uri @<%= application %>;
|
20
|
-
location @<%= application %> {
|
17
|
+
try_files $uri $uri @<%= fetch(:application) %>;
|
18
|
+
location @<%= fetch(:application) %> {
|
19
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
21
20
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
22
21
|
proxy_set_header Host $http_host;
|
23
22
|
proxy_redirect off;
|
24
23
|
proxy_buffering on;
|
25
24
|
proxy_set_header X-Real-IP $remote_addr;
|
26
25
|
|
27
|
-
proxy_pass http://<%= application %>;
|
26
|
+
proxy_pass http://<%= fetch(:application) %>;
|
28
27
|
}
|
29
28
|
|
30
29
|
location /cable {
|
31
|
-
proxy_pass http://<%= application %>;
|
30
|
+
proxy_pass http://<%= fetch(:application) %>;
|
32
31
|
proxy_http_version 1.1;
|
33
32
|
proxy_set_header Upgrade $http_upgrade;
|
34
33
|
proxy_set_header Connection "upgrade";
|
@@ -37,4 +36,4 @@ server {
|
|
37
36
|
error_page 500 502 503 504 /500.html;
|
38
37
|
client_max_body_size 10M;
|
39
38
|
keepalive_timeout 10;
|
40
|
-
}
|
39
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env puma
|
2
|
+
|
3
|
+
directory '<%= current_path %>'
|
4
|
+
rackup '<%= current_path %>/config.ru'
|
5
|
+
environment '<%= fetch(:rails_env, 'production') %>'
|
6
|
+
tag '<%= fetch(:application)%>'
|
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
|
+
|
11
|
+
threads <%= fetch(:puma_threads, [0, 1]).join(',')%>
|
12
|
+
|
13
|
+
bind 'unix:///tmp/<%= fetch(:application)%>.sock'
|
14
|
+
|
15
|
+
activate_control_app 'unix://<%= shared_path %>/tmp/sockets/pumactl.sock'
|
16
|
+
|
17
|
+
workers <%= fetch(:puma_workers, 2) %>
|
18
|
+
|
19
|
+
preload_app!
|
20
|
+
|
21
|
+
on_restart do
|
22
|
+
puts 'Refreshing Gemfile'
|
23
|
+
ENV['BUNDLE_GEMFILE'] = '<%= current_path %>/Gemfile'
|
24
|
+
end
|
25
|
+
|
26
|
+
before_fork do
|
27
|
+
ActiveRecord::Base.connection_pool.disconnect!
|
28
|
+
end
|
29
|
+
|
30
|
+
on_worker_boot do
|
31
|
+
ActiveSupport.on_load(:active_record) do
|
32
|
+
ActiveRecord::Base.establish_connection
|
33
|
+
end
|
34
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
3
|
### BEGIN INIT INFO
|
4
|
-
# Provides: <%= application %>
|
4
|
+
# Provides: <%= fetch(:application) %>
|
5
5
|
# Required-Start: $local_fs $remote_fs $network $syslog
|
6
6
|
# Required-Stop: $local_fs $remote_fs $network $syslog
|
7
7
|
# Default-Start: 2 3 4 5
|
@@ -10,10 +10,10 @@
|
|
10
10
|
# Description: starts puma
|
11
11
|
### END INIT INFO
|
12
12
|
|
13
|
-
USER="<%= user %>"
|
13
|
+
USER="<%= fetch(:user) %>"
|
14
14
|
DAEMON=puma
|
15
|
-
PROJECT_PATH="<%= deploy_to %>"
|
16
|
-
DAEMON_OPTS="-e <%= rails_env %>"
|
15
|
+
PROJECT_PATH="<%= fetch(:deploy_to) %>"
|
16
|
+
DAEMON_OPTS="-C $PROJECT_PATH/shared/config/puma.rb -e <%= fetch(:rails_env) %> -d"
|
17
17
|
NAME=puma
|
18
18
|
DESC="puma app for $USER"
|
19
19
|
PID="$PROJECT_PATH/shared/pids/puma.pid"
|
@@ -33,17 +33,17 @@ case "$1" in
|
|
33
33
|
;;
|
34
34
|
stop)
|
35
35
|
echo -n "Stopping $DESC: "
|
36
|
-
kill -
|
36
|
+
kill -INT `cat $PID`
|
37
37
|
echo "$NAME."
|
38
38
|
;;
|
39
39
|
restart)
|
40
40
|
echo -n "Restarting $DESC: "
|
41
|
-
kill -
|
41
|
+
kill -USR1 `cat $PID`
|
42
42
|
echo "$NAME."
|
43
43
|
;;
|
44
44
|
reload)
|
45
45
|
echo -n "Reloading $DESC configuration: "
|
46
|
-
kill -
|
46
|
+
kill -USR2 `cat $PID`
|
47
47
|
echo "$NAME."
|
48
48
|
;;
|
49
49
|
*)
|
@@ -52,4 +52,4 @@ case "$1" in
|
|
52
52
|
;;
|
53
53
|
esac
|
54
54
|
|
55
|
-
exit 0
|
55
|
+
exit 0
|
@@ -0,0 +1,13 @@
|
|
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') %>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
### BEGIN INIT INFO
|
4
|
+
# Provides: resque
|
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: resque worker via init.d
|
10
|
+
# Description: starts resque
|
11
|
+
### END INIT INFO
|
12
|
+
|
13
|
+
USER="<%= fetch(:user) %>"
|
14
|
+
PROJECT_PATH="<%= fetch(:deploy_to) %>"
|
15
|
+
NAME=resque
|
16
|
+
DESC="Resque app for $USER"
|
17
|
+
PID="$PROJECT_PATH/shared/pids/resque.pid"
|
18
|
+
LOGFILE="$PROJECT_PATH/shared/log/resque.log"
|
19
|
+
CD_TO_APP_DIR="cd $PROJECT_PATH/current"
|
20
|
+
|
21
|
+
|
22
|
+
case "$1" in
|
23
|
+
start)
|
24
|
+
START_DAEMON_PROCESS="bundle exec rake RAILS_ENV=<%= fetch(:rails_env) %> QUEUE='*' PIDFILE=$PID BACKGROUND=yes environment resque:work 2>&1 > $LOGFILE"
|
25
|
+
echo -n "Starting $DESC: "
|
26
|
+
if [ `whoami` = 'root' ]; then
|
27
|
+
su - $USER -c "$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS"
|
28
|
+
else
|
29
|
+
/bin/bash -l -c "$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS"
|
30
|
+
fi
|
31
|
+
echo "$NAME."
|
32
|
+
;;
|
33
|
+
stop)
|
34
|
+
STOP_DAEMON_PROCESS="test -f $PID && kill -s QUIT `cat $PID` && rm -f $PID"
|
35
|
+
echo -n "Stopping $DESC: "
|
36
|
+
if [ `whoami` = 'root' ]; then
|
37
|
+
su - $USER -c "$CD_TO_APP_DIR && $STOP_DAEMON_PROCESS"
|
38
|
+
else
|
39
|
+
/bin/bash -l -c "$CD_TO_APP_DIR && $STOP_DAEMON_PROCESS"
|
40
|
+
fi
|
41
|
+
echo "$NAME."
|
42
|
+
;;
|
43
|
+
*)
|
44
|
+
echo "Usage: $NAME {start|stop|restart|reload}" >&2
|
45
|
+
exit 1
|
46
|
+
;;
|
47
|
+
esac
|
48
|
+
|
49
|
+
exit 0
|
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
### BEGIN INIT INFO
|
4
|
+
# Provides: resque scheduler
|
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: resque scheduler worker via init.d
|
10
|
+
# Description: starts resque scheduler
|
11
|
+
### END INIT INFO
|
12
|
+
|
13
|
+
USER="<%= fetch(:user) %>"
|
14
|
+
PROJECT_PATH="<%= fetch(:deploy_to) %>"
|
15
|
+
NAME="resque_scheduler"
|
16
|
+
DESC="Resque Scheduler for $USER"
|
17
|
+
PID="$PROJECT_PATH/shared/pids/resque_scheduler.pid"
|
18
|
+
LOGFILE="$PROJECT_PATH/shared/log/resque.log"
|
19
|
+
CD_TO_APP_DIR="cd $PROJECT_PATH/current"
|
20
|
+
|
21
|
+
|
22
|
+
case "$1" in
|
23
|
+
start)
|
24
|
+
START_DAEMON_PROCESS="bundle exec rake RAILS_ENV=<%= fetch(:rails_env) %> QUEUE='*' PIDFILE=$PID BACKGROUND=yes environment resque:scheduler 2>&1 > $LOGFILE"
|
25
|
+
echo -n "Starting $DESC: "
|
26
|
+
if [ `whoami` = 'root' ]; then
|
27
|
+
su - $USER -c "$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS"
|
28
|
+
else
|
29
|
+
/bin/bash -l -c "$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS"
|
30
|
+
fi
|
31
|
+
echo "$NAME."
|
32
|
+
;;
|
33
|
+
stop)
|
34
|
+
STOP_DAEMON_PROCESS="test -f $PID && kill -s QUIT `cat $PID` && rm -f $PID"
|
35
|
+
echo -n "Stopping $DESC: "
|
36
|
+
if [ `whoami` = 'root' ]; then
|
37
|
+
su - $USER -c "$CD_TO_APP_DIR && $STOP_DAEMON_PROCESS"
|
38
|
+
else
|
39
|
+
/bin/bash -l -c "$CD_TO_APP_DIR && $STOP_DAEMON_PROCESS"
|
40
|
+
fi
|
41
|
+
echo "$NAME."
|
42
|
+
;;
|
43
|
+
*)
|
44
|
+
echo "Usage: $NAME {start|stop|restart|reload}" >&2
|
45
|
+
exit 1
|
46
|
+
;;
|
47
|
+
esac
|
48
|
+
|
49
|
+
exit 0
|
@@ -0,0 +1,13 @@
|
|
1
|
+
[program:resque_scheduler]
|
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 rake RAILS_ENV=<%= fetch(:rails_env) %> QUEUE='*' environment resque:scheduler 2>&1 > <%= fetch(:deploy_to) %>/shared/log/resque_scheduler.log
|
6
|
+
autostart=<%= fetch(:autostart, 'true') %>
|
7
|
+
autorestart=<%= fetch(:autorestart, 'true') %>
|
8
|
+
stopsignal=QUIT
|
9
|
+
startsecs=5
|
10
|
+
startretries=3
|
11
|
+
stdout_logfile=<%= fetch(:deploy_to) %>/shared/log/resque_scheduler.log
|
12
|
+
stdout_logfile_maxbytes=<%= fetch(:logfile_maxbytes, '1GB') %>
|
13
|
+
stdout_logfile_backups=<%= fetch(:logfile_backups, '10') %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
[program:resque]
|
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 rake RAILS_ENV=<%= fetch(:rails_env) %> QUEUE=critical,default,mailers,low environment resque:work 2>&1 > <%= fetch(:deploy_to) %>/shared/log/resque.log
|
6
|
+
autostart=<%= fetch(:autostart, 'true') %>
|
7
|
+
autorestart=<%= fetch(:autorestart, 'true') %>
|
8
|
+
stopsignal=QUIT
|
9
|
+
startsecs=5
|
10
|
+
startretries=3
|
11
|
+
stdout_logfile=<%= fetch(:deploy_to) %>/shared/log/resque.log
|
12
|
+
stdout_logfile_maxbytes=<%= fetch(:logfile_maxbytes, '1GB') %>
|
13
|
+
stdout_logfile_backups=<%= fetch(:logfile_backups, '10') %>
|
@@ -10,9 +10,9 @@
|
|
10
10
|
# Description: starts sidekiq
|
11
11
|
### END INIT INFO
|
12
12
|
|
13
|
-
USER="
|
13
|
+
USER="<%= fetch(:user) %>"
|
14
14
|
DAEMON=sidekiq
|
15
|
-
PROJECT_PATH="<%= deploy_to %>"
|
15
|
+
PROJECT_PATH="<%= fetch(:deploy_to) %>"
|
16
16
|
NAME=sidekiq
|
17
17
|
DESC="Sidekiq app for $USER"
|
18
18
|
PID="$PROJECT_PATH/shared/pids/sidekiq.pid"
|
@@ -21,13 +21,13 @@ CD_TO_APP_DIR="cd $PROJECT_PATH/current"
|
|
21
21
|
|
22
22
|
case "$1" in
|
23
23
|
start)
|
24
|
-
START_DAEMON_PROCESS="bundle exec sidekiq -d -e <%= rails_env %> -L $LOGFILE -P $PID"
|
24
|
+
START_DAEMON_PROCESS="bundle exec sidekiq -d -e <%= fetch(:rails_env) %> -L $LOGFILE -P $PID"
|
25
25
|
|
26
26
|
echo -n "Starting $DESC: "
|
27
27
|
if [ `whoami` = 'root' ]; then
|
28
28
|
su - $USER -c "$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS"
|
29
29
|
else
|
30
|
-
$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS
|
30
|
+
/bin/bash -l -c "$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS"
|
31
31
|
fi
|
32
32
|
echo "$NAME."
|
33
33
|
;;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
[program:sidekiq]
|
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 sidekiq -L <%= fetch(:deploy_to) %>/shared/log/sidekiq.log -e <%= fetch(:rails_env) %>
|
6
|
+
autostart=<%= fetch(:autostart, 'true') %>
|
7
|
+
autorestart=<%= fetch(:autorestart, 'true') %>
|
8
|
+
startsecs=5
|
9
|
+
startretries=3
|
10
|
+
stdout_logfile=<%= fetch(:deploy_to) %>/shared/log/sidekiq.log
|
11
|
+
stdout_logfile_maxbytes=<%= fetch(:logfile_maxbytes, '1GB') %>
|
12
|
+
stdout_logfile_backups=<%= fetch(:logfile_backups, '10') %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
; Generated with pixelforce recipies
|
2
|
+
[unix_http_server]
|
3
|
+
file=/tmp/supervisor.sock ; (the path to the socket file)
|
4
|
+
chmod=0700 ; sockef file mode (default 0700)
|
5
|
+
|
6
|
+
[supervisord]
|
7
|
+
user=<%= fetch(:user) %>
|
8
|
+
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
|
9
|
+
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
|
10
|
+
|
11
|
+
[rpcinterface:supervisor]
|
12
|
+
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
13
|
+
|
14
|
+
[supervisorctl]
|
15
|
+
serverurl=unix:///tmp/supervisor.sock
|
16
|
+
|
17
|
+
[include]
|
18
|
+
files = /etc/supervisor/conf.d/*.conf
|
19
|
+
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
|
3
3
|
### BEGIN INIT INFO
|
4
|
-
# Provides: <%= application %>
|
4
|
+
# Provides: <%= fetch(:application) %>
|
5
5
|
# Required-Start: $local_fs $remote_fs $network $syslog
|
6
6
|
# Required-Stop: $local_fs $remote_fs $network $syslog
|
7
7
|
# Default-Start: 2 3 4 5
|
@@ -10,10 +10,10 @@
|
|
10
10
|
# Description: starts unicorn
|
11
11
|
### END INIT INFO
|
12
12
|
|
13
|
-
USER="<%= user %>"
|
13
|
+
USER="<%= fetch(:user) %>"
|
14
14
|
DAEMON=unicorn
|
15
|
-
PROJECT_PATH="<%= deploy_to %>"
|
16
|
-
DAEMON_OPTS="-c $PROJECT_PATH/current/config/unicorn.rb -E <%= rails_env %> -D"
|
15
|
+
PROJECT_PATH="<%= fetch(:deploy_to) %>"
|
16
|
+
DAEMON_OPTS="-c $PROJECT_PATH/current/config/unicorn.rb -E <%= fetch(:rails_env) %> -D"
|
17
17
|
NAME=unicorn
|
18
18
|
DESC="Unicorn app for $USER"
|
19
19
|
PID="$PROJECT_PATH/shared/pids/unicorn.pid"
|
@@ -0,0 +1,13 @@
|
|
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 unicornherder -u unicorn -p <%= fetch(:deploy_to) %>/shared/pids/unicorn.pid -- -c config/unicorn.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') %>
|
data/pixelforce_recipes.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.12"
|
23
|
-
spec.add_development_dependency "rake", "~>
|
23
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
24
24
|
spec.add_development_dependency "rspec", "~> 3.0"
|
25
25
|
spec.add_dependency(%q<capistrano>, ["> 2.0.0"])
|
26
26
|
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.0'
|
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-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,24 +83,43 @@ files:
|
|
83
83
|
- bin/console
|
84
84
|
- bin/setup
|
85
85
|
- lib/pixelforce_recipes.rb
|
86
|
-
- lib/pixelforce_recipes/base.rb
|
87
|
-
- lib/pixelforce_recipes/logrotate.rb
|
88
|
-
- lib/pixelforce_recipes/puma.rb
|
89
|
-
- lib/pixelforce_recipes/
|
86
|
+
- lib/pixelforce_recipes/capistrano_3_recipes/base.rb
|
87
|
+
- lib/pixelforce_recipes/capistrano_3_recipes/logrotate.rb
|
88
|
+
- lib/pixelforce_recipes/capistrano_3_recipes/puma.rb
|
89
|
+
- lib/pixelforce_recipes/capistrano_3_recipes/resque.rb
|
90
|
+
- lib/pixelforce_recipes/capistrano_3_recipes/resque_scheduler.rb
|
91
|
+
- lib/pixelforce_recipes/capistrano_3_recipes/sidekiq.rb
|
92
|
+
- lib/pixelforce_recipes/capistrano_3_recipes/supervisor.rb
|
93
|
+
- lib/pixelforce_recipes/capistrano_3_recipes/unicorn.rb
|
94
|
+
- lib/pixelforce_recipes/legacy_recipes/base.rb
|
95
|
+
- lib/pixelforce_recipes/legacy_recipes/logrotate.rb
|
96
|
+
- lib/pixelforce_recipes/legacy_recipes/puma.rb
|
97
|
+
- lib/pixelforce_recipes/legacy_recipes/resque.rb
|
98
|
+
- lib/pixelforce_recipes/legacy_recipes/resque_scheduler.rb
|
99
|
+
- lib/pixelforce_recipes/legacy_recipes/sidekiq.rb
|
100
|
+
- lib/pixelforce_recipes/legacy_recipes/unicorn.rb
|
90
101
|
- lib/pixelforce_recipes/templates/logrotate.erb
|
91
102
|
- lib/pixelforce_recipes/templates/nginx_config.erb
|
92
103
|
- lib/pixelforce_recipes/templates/nginx_puma_config.erb
|
104
|
+
- lib/pixelforce_recipes/templates/puma.rb.erb
|
93
105
|
- lib/pixelforce_recipes/templates/puma_init.erb
|
106
|
+
- lib/pixelforce_recipes/templates/puma_supervisor.erb
|
107
|
+
- lib/pixelforce_recipes/templates/resque_init.erb
|
108
|
+
- lib/pixelforce_recipes/templates/resque_scheduler_init.erb
|
109
|
+
- lib/pixelforce_recipes/templates/resque_scheduler_supervisor.erb
|
110
|
+
- lib/pixelforce_recipes/templates/resque_supervisor.erb
|
94
111
|
- lib/pixelforce_recipes/templates/sidekiq_init.erb
|
112
|
+
- lib/pixelforce_recipes/templates/sidekiq_supervisor.erb
|
113
|
+
- lib/pixelforce_recipes/templates/supervisor.erb
|
95
114
|
- lib/pixelforce_recipes/templates/unicorn_init.erb
|
96
|
-
- lib/pixelforce_recipes/
|
115
|
+
- lib/pixelforce_recipes/templates/unicorn_supervisor.erb
|
97
116
|
- lib/pixelforce_recipes/version.rb
|
98
117
|
- pixelforce_recipes.gemspec
|
99
118
|
homepage: https://git.pixelforcesystems.com.au/
|
100
119
|
licenses:
|
101
120
|
- MIT
|
102
121
|
metadata: {}
|
103
|
-
post_install_message:
|
122
|
+
post_install_message:
|
104
123
|
rdoc_options: []
|
105
124
|
require_paths:
|
106
125
|
- lib
|
@@ -115,9 +134,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
134
|
- !ruby/object:Gem::Version
|
116
135
|
version: '0'
|
117
136
|
requirements: []
|
118
|
-
|
119
|
-
|
120
|
-
signing_key:
|
137
|
+
rubygems_version: 3.0.6
|
138
|
+
signing_key:
|
121
139
|
specification_version: 4
|
122
140
|
summary: Write a short summary, because Rubygems requires one.
|
123
141
|
test_files: []
|