Skip to content

Commit

Permalink
Add upstart support for start, stop, and quiet (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Miller authored and seuros committed Aug 14, 2018
1 parent 4f9af46 commit b290994
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,19 @@ Default name for the service file is `sidekiq-stage.service`. This can be change
set :service_unit_name, "sidekiq-#{fetch(:application)}-#{fetch(:stage)}.service"
```

## Integration with upstart

Set init system to upstart in the cap deploy config:

```ruby
set :init_system, :upstart
```

Set upstart service name:
```ruby
set :upstart_service_name, 'sidekiq'
```

## Customizing the monit sidekiq templates

If you need change some config in redactor, you can
Expand Down
7 changes: 7 additions & 0 deletions lib/capistrano/tasks/sidekiq.rake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace :load do
set :init_system, -> { nil }
# systemd integration
set :service_unit_name, "sidekiq-#{fetch(:stage)}.service"
set :upstart_service_name, "sidekiq"
end
end

Expand All @@ -44,6 +45,8 @@ namespace :sidekiq do
case fetch(:init_system)
when :systemd
execute :systemctl, "--user", "reload", fetch(:service_unit_name), raise_on_non_zero_exit: false
when :upstart
sudo :service, fetch(:upstart_service_name), :reload
else
if test("[ -d #{release_path} ]")
each_process_with_index(reverse: true) do |pid_file, _idx|
Expand All @@ -64,6 +67,8 @@ namespace :sidekiq do
case fetch(:init_system)
when :systemd
execute :systemctl, "--user", "stop", fetch(:service_unit_name)
when :upstart
sudo :service, fetch(:upstart_service_name), :stop
else
if test("[ -d #{release_path} ]")
each_process_with_index(reverse: true) do |pid_file, _idx|
Expand All @@ -84,6 +89,8 @@ namespace :sidekiq do
case fetch(:init_system)
when :systemd
execute :systemctl, '--user', 'start', fetch(:service_unit_name)
when :upstart
sudo :service, fetch(:upstart_service_name), :start
else
each_process_with_index do |pid_file, idx|
unless pid_file_exists?(pid_file) && process_exists?(pid_file)
Expand Down

0 comments on commit b290994

Please sign in to comment.