Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Systemd integration #171

Merged
merged 7 commits into from Apr 3, 2018
Merged

Systemd integration #171

merged 7 commits into from Apr 3, 2018

Conversation

baierjan
Copy link
Contributor

Add ability to run sidekiq daemon via systemd. Closes #51

* start/stop/quiet tasks as systemd wrappers
* systemd.service template
* sidekiq:install task to install and enable service template
* sidekiq:uninstall to disable and remove
@heironimus
Copy link

This looks good to me. systemd integration is a pretty hot topic on various gists and the sidekiq wiki. Implementing this in the gem would make this dead simple.

Environment=RAILS_ENV=<%= fetch(:rails_env) %>
WorkingDirectory=<%= fetch(:deploy_to) %>/current
ExecStart=<%= fetch(:bundler_path, '/usr/local/bin/bundler') %> exec sidekiq -e <%= fetch(:rails_env) %>
ExecReload=/bin/kill -USR1 $MAINPID

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this should be ExecReload=/bin/kill -TSTP $MAINPID (TSTP instead of USR1) for Sidekiq 5. https://github.com/mperham/sidekiq/wiki/Signals#tstp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

@feliperaul
Copy link

This would be really nice. +1

Type=simple
Environment=RAILS_ENV=<%= fetch(:rails_env) %>
WorkingDirectory=<%= fetch(:deploy_to) %>/current
ExecStart=<%= fetch(:bundler_path, '/usr/local/bin/bundler') %> exec sidekiq -e <%= fetch(:rails_env) %>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not an expert on systemd, but it seems that ExecStart is not taking into consideration sidekiq.yml config file, right? Since this is oficially supported by the gem via the set :sidekiq_config option (see https://github.com/seuros/capistrano-sidekiq/wiki), I think it should be supported here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean? This just call bundle exec sidekiq via systemd, it should be some sort of an equivalent to cap sidekiq:start. Nothing less, nothing more.

I have an idea to add a generator for this file, which can solve some issue. In the mean time, this is just a template for a service file and you can customize the resulting systemd service file to your liking.

@thapakazi
Copy link

Lets get this merged, we need this...

@seuros seuros merged commit fa13522 into seuros:master Apr 3, 2018
@mperham
Copy link

mperham commented Apr 3, 2018

👏

@thapakazi
Copy link

great
http://media.tumblr.com/d9511f0fdb885a503531b11998afc383/tumblr_inline_mnokefdwx31rnvwt1.gif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants