Skip to content

Instantly share code, notes, and snippets.

@pwmpw
Forked from brycejohnston/sidekiq.service
Created July 29, 2016 07:52
Show Gist options
  • Save pwmpw/d8896b47e68137a32e709fa0b0352a0e to your computer and use it in GitHub Desktop.
Save pwmpw/d8896b47e68137a32e709fa0b0352a0e to your computer and use it in GitHub Desktop.

Revisions

  1. @brycejohnston brycejohnston revised this gist Jun 29, 2016. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions sidekiq.service
    Original file line number Diff line number Diff line change
    @@ -12,16 +12,17 @@
    [Unit]
    Description=sidekiq
    # start sidekiq only once the network, logging subsystems and local redis instance are available
    After=syslog.target network.target redis-server.service
    After=syslog.target network.target redis-server.service postgresql.service

    [Service]
    # change path to bundle if not using rbenv
    Type=simple
    WorkingDirectory=/home/deploy/myapp/current
    ExecStart=/home/deploy/.rbenv/shims/bundle exec sidekiq -e production -C config/sidekiq.yml
    User=deploy
    Group=deploy
    UMask=0002
    ExecStart=/home/deploy/.rbenv/shims/bundle exec sidekiq -e production -C config/sidekiq.yml -L log/sidekiq.log
    ExecStop=/home/deploy/.rbenv/shims/bundle exec sidekiqctl stop /home/deploy/myapp/current/pids/sidekiq.pid

    # if we crash, restart
    RestartSec=1
  2. @brycejohnston brycejohnston created this gist Jun 29, 2016.
    38 changes: 38 additions & 0 deletions sidekiq.service
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    #
    # systemd unit file for Debian
    #
    # Put this in /lib/systemd/system
    # Run:
    # - systemctl enable sidekiq
    # - systemctl {start,stop,restart} sidekiq
    #
    # This file corresponds to a single Sidekiq process. Add multiple copies
    # to run multiple processes (sidekiq-1, sidekiq-2, etc).
    #
    [Unit]
    Description=sidekiq
    # start sidekiq only once the network, logging subsystems and local redis instance are available
    After=syslog.target network.target redis-server.service

    [Service]
    # change path to bundle if not using rbenv
    Type=simple
    WorkingDirectory=/home/deploy/myapp/current
    ExecStart=/home/deploy/.rbenv/shims/bundle exec sidekiq -e production -C config/sidekiq.yml
    User=deploy
    Group=deploy
    UMask=0002

    # if we crash, restart
    RestartSec=1
    Restart=on-failure

    # output goes to /var/log/syslog
    StandardOutput=syslog
    StandardError=syslog

    # This will default to "bundler" if we don't specify it
    SyslogIdentifier=sidekiq

    [Install]
    WantedBy=multi-user.target