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 #320

Closed
dimidd opened this issue Feb 24, 2017 · 4 comments
Closed

systemd integration #320

dimidd opened this issue Feb 24, 2017 · 4 comments

Comments

@dimidd
Copy link

dimidd commented Feb 24, 2017

Hi, I'd like to restart shoryuken after a restart and after a deploy (preferably with capistrano-shoryuken). Is there an equivalent for the sidekiq systemd unit file?

@phstc
Copy link
Collaborator

phstc commented Feb 24, 2017

Hi @dimidd

There's not. But I guess it's just a matter of s/sidekiq/shoryuken/g in the systemd unit file you linked.

Besides the search and replace, you may need to change this line as well, for something like ExecStart=/usr/local/bin/bundle exec shoryuken -C /path/shoryuken.yml ....

Please let me know if you create a system unit file, so I can update this wiki with the instructions.

@dimidd
Copy link
Author

dimidd commented Feb 24, 2017

Thanks, I'm using this one, which seems to work, but I still have to test it thoroughly.
https://gist.github.com/64c43ef5e26ad55320d0a27098a7d466

@phstc
Copy link
Collaborator

phstc commented Feb 24, 2017

@dimidd nice! I linked your gist in here.

@phstc phstc closed this as completed Feb 24, 2017
@aivils
Copy link

aivils commented Sep 29, 2017

FYI
foreman will export Procfile to systemd for You!
I used foreman 0.84.0 out of the box
I added to my capistrano deploy.rb some lines:

namespace :foreman do
  desc "Export the Procfile to Ubuntu's systemd scripts"
  task :export do
    on roles(:app) do
      within release_path do
        with rails_env: fetch(:stage) do
          execute :sudo, '/home/boss/.rvm/bin/rvm 2.4.2 do bundle exec foreman export systemd /etc/systemd/system ' +
        "-f Procfile.#{fetch(:stage)} -a #{fetch(:application)}-#{fetch(:stage)} -u #{fetch(:user)} -l #{shared_path}/log -e #{shared_path}/.env --root #{current_path}"
        end
      end
    end
  end
end

Where #{shared_path}/.env have entries with standard KEY=value syntax

Content of Procfile.staging

web: /home/boss/.rvm/bin/rvm 2.4.2 do bundle exec unicorn -c ./config/unicorn.rb
worker: /home/boss/.rvm/bin/rvm 2.4.2 do bundle exec shoryuken --rails -C config/shoryuken.yml

This command will create all files for systemd:

cap staging foreman:export

What we have in the sytemd

ls -1 /etc/systemd/system/boss*
/etc/systemd/system/boss-staging.target
/etc/systemd/system/boss-staging-web@.service
/etc/systemd/system/boss-staging-web.target
/etc/systemd/system/boss-staging-worker@.service
/etc/systemd/system/boss-staging-worker.target

/etc/systemd/system/boss-staging-web.target.wants:
boss-staging-web@3010.service

/etc/systemd/system/boss-staging-worker.target.wants:
boss-staging-worker@3110.service

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

No branches or pull requests

3 participants