This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(sidekiq): add multiple configs
BREAKING CHANGE: `app['worker']['config']` for sidekiq is now an Array. However fallback is supported, so you don't have to change your stack.json if you don't need to. Keep in mind, that filenames for sidekiq monit and configurations changed: * Configurations changed from `sidekiq_1.yml` to `sidekiq_c1_p1.yml` * Pids changed from `sidekiq-app-1.pid` to `sidekiq-app-c1-p1.yml` * Logs changed from `sidekiq-app-1.log` to `sidekiq-app-c1-p1.log`
- Loading branch information
Showing
7 changed files
with
104 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
<% ([@out[:process_count].to_i || 1].max).times do |n| %> | ||
<% identifier = "#{@application}-#{n+1}" %> | ||
<% conf_file = "#{@deploy_to}/shared/config/sidekiq_#{n+1}.yml" %> | ||
<% pid_file = "#{@deploy_to}/shared/pids/sidekiq_#{identifier}.pid" %> | ||
<% syslog = !!@out[:syslog] ? "2>&1 | logger -t sidekiq-#{identifier}" : '' %> | ||
<% to_require = @out[:require].present? ? " -r #{File.join(@deploy_to, 'current', @out[:require])}" : '' %> | ||
<% timeout = (@out[:config]['timeout'] || 8).to_i %> | ||
|
||
check process sidekiq_<%= identifier.to_s %> | ||
with pidfile <%= pid_file.to_s %> | ||
start program = "/bin/su - <%= node['deployer']['user'] %> -c 'cd <%= File.join(@deploy_to, 'current') %> && <%= @environment.map { |k, v| "#{k}=\"#{v}\"" }.join(' ') %> bundle exec sidekiq -C <%= conf_file.to_s %> -i <%= n %> -P <%= pid_file.to_s %><%= to_require.to_s %> <%= syslog.to_s %>'" with timeout 90 seconds | ||
stop program = "/bin/su - <%= node['deployer']['user'] %> -c 'cd <%= File.join(@deploy_to, 'current') %> && <%= @environment.map { |k, v| "#{k}=\"#{v}\"" }.join(' ') %> bundle exec sidekiqctl stop <%= pid_file %> <%= timeout %>'" with timeout <%= timeout + 10 %> seconds | ||
group sidekiq_<%= @application.to_s %>_group | ||
<% Array.wrap(@out[:config]).each.with_index do |config, config_number| %> | ||
<% ([@out[:process_count].to_i || 1].max).times do |n| %> | ||
<% identifier = "#{@application}-c#{config_number+1}-p#{n+1}" %> | ||
<% conf_file = "#{@deploy_to}/shared/config/sidekiq_c#{config_number+1}_p#{n+1}.yml" %> | ||
<% pid_file = "#{@deploy_to}/shared/pids/sidekiq_#{identifier}.pid" %> | ||
<% syslog = !!@out[:syslog] ? "2>&1 | logger -t sidekiq-#{identifier}" : '' %> | ||
<% to_require = @out[:require].present? ? " -r #{File.join(@deploy_to, 'current', @out[:require])}" : '' %> | ||
<% timeout = (config['timeout'] || 8).to_i %> | ||
|
||
check process sidekiq_<%= identifier.to_s %> | ||
with pidfile <%= pid_file.to_s %> | ||
start program = "/bin/su - <%= node['deployer']['user'] %> -c 'cd <%= File.join(@deploy_to, 'current') %> && <%= @environment.map { |k, v| "#{k}=\"#{v}\"" }.join(' ') %> bundle exec sidekiq -C <%= conf_file.to_s %> -i <%= n %> -P <%= pid_file.to_s %><%= to_require.to_s %> <%= syslog.to_s %>'" with timeout 90 seconds | ||
stop program = "/bin/su - <%= node['deployer']['user'] %> -c 'cd <%= File.join(@deploy_to, 'current') %> && <%= @environment.map { |k, v| "#{k}=\"#{v}\"" }.join(' ') %> bundle exec sidekiqctl stop <%= pid_file %> <%= timeout %>'" with timeout <%= timeout + 10 %> seconds | ||
group sidekiq_<%= @application.to_s %>_group | ||
<% end %> | ||
<% end %> |