1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00
Commit graph

20 commits

Author SHA1 Message Date
H. Wade Minter
34f61e8bc6 Change systemd restart method to "always"
I'm running Sidekiq 6.4.1 on an Ubuntu 20.04 system with Ruby 3.1.1 installed via Snap for a Rails 7 application.

    Using this systemd template, I noticed something odd when deploying with Capistrano. When my cap script ran `sudo systemctl restart sidekiq`, the Sidekiq process would restart, briefly go active, then go inactive and stop running. I would need to SSH in and manually do a `systemctl restart sidekiq` in order to get the process back up and running.

    With some experimentation, I found that changing the `Restart` configuration from `on-failure` to `always` seems to do the trick. Now, when the Sidekiq process goes inactive, it properly restarts and stays restarted.

    I'm not 100% sure of the "why" behind what's going on, but this change seems to be effective and I have not noticed any side effects.

    Documentation of previous behavior

    Prior to deploy (process running)

    ```
    root@stage-worker01:~# systemctl status sidekiq
    ● sidekiq.service - sidekiq
         Loaded: loaded (/lib/systemd/system/sidekiq.service; enabled; vendor prese>
         Active: active (running) since Thu 2022-03-24 16:34:32 UTC; 51s ago
       Main PID: 118856 (bundle)
          Tasks: 30 (limit: 1120)
         Memory: 291.2M
         CGroup: /system.slice/sidekiq.service
                 └─118856 sidekiq 6.4.1 staging [0 of 20 busy]
    ```

    Immediately post deploy (process restarting)

    ```
    root@stage-worker01:~# systemctl status sidekiq
    ● sidekiq.service - sidekiq
         Loaded: loaded (/lib/systemd/system/sidekiq.service; enabled; vendor prese>
         Active: activating (start) since Thu 2022-03-24 16:38:35 UTC; 9s ago
       Main PID: 119572 (bundle)
          Tasks: 0 (limit: 1120)
         Memory: 43.4M
         CGroup: /system.slice/sidekiq.service
                 ‣ 119572 /var/www/sox/staging/shared/bundle/ruby/3.1.0/bin/sidekiq>
    ```

    After deploy (process started)

    ```
    Mar 24 16:38:35 stage-worker01.suggestionox.com systemd[1]: Starting sidekiq...
    root@stage-worker01:~# systemctl status sidekiq
    ● sidekiq.service - sidekiq
         Loaded: loaded (/lib/systemd/system/sidekiq.service; enabled; vendor prese>
         Active: active (running) since Thu 2022-03-24 16:38:45 UTC; 3s ago
       Main PID: 119572 (bundle)
          Tasks: 0 (limit: 1120)
         Memory: 43.4M
         CGroup: /system.slice/sidekiq.service
                 ‣ 119572 sidekiq 6.4.1 staging [0 of 20 busy]

    Mar 24 16:38:35 stage-worker01.suggestionox.com systemd[1]: Starting sidekiq...
    Mar 24 16:38:45 stage-worker01.suggestionox.com systemd[1]: Started sidekiq.
    ```

    Failure (process inactive)

    ```
    root@stage-worker01:~# systemctl status sidekiq
    ● sidekiq.service - sidekiq
         Loaded: loaded (/lib/systemd/system/sidekiq.service; enabled; vendor prese>
         Active: inactive (dead) since Thu 2022-03-24 16:38:56 UTC; 2s ago
        Process: 119572 ExecStart=/usr/bin/env bundle exec sidekiq -e staging (code>
       Main PID: 119572 (code=exited, status=0/SUCCESS)

    Mar 24 16:38:35 stage-worker01.suggestionox.com systemd[1]: Starting sidekiq...
    Mar 24 16:38:45 stage-worker01.suggestionox.com systemd[1]: Started sidekiq.
    Mar 24 16:38:56 stage-worker01.suggestionox.com systemd[1]: sidekiq.service: Su>
    ```
2022-03-24 12:53:37 -04:00
Narath Carlile
9a44071af1
Update Sidekiq.service as a user service (#4938)
You recommend the use of capistrano-sidekiq. This uses a user service (which is likely a good idea for most users from a security perspective). In order to get it to work, changes need to be made to the Sidekiq.service file (and location)
2021-07-08 07:44:43 -07:00
Adam Guderski
dae5debf84
Updated sidekiq service configuration with automatic ruby/gemset version pick (#4907)
RVM has option to run commands in specific directory, and if this directory has `.ruby-version` (with optional `.ruby-gemset`) or `.rvmrc` files in it, this version is automatically used.
Thanks to this, you no longer need to update systemd service configuration on Ruby version change.
2021-05-19 08:09:36 -07:00
AsbahIshaq
02d265aac0
spell corrected (#4788) [ci skip]
Co-authored-by: Asbah Ishaq <asbahishaq>
2021-01-24 12:53:35 +01:00
Sachin Gevariya
d081a8a66a
Updated sidekiq configuration with rvm and gemset (#4705)
* Updated sidekiq configuration with rvm and gemset

* Updated environment with execution
2020-10-01 04:31:35 -07:00
Mike Perham
a631ba920a Remove ill-advised usage of systemctl reload for quiet, closes #4569 2020-05-19 09:45:41 -07:00
Mike Perham
157e06ccd3 polish 2020-04-20 05:49:37 -07:00
Cris R
02b5e51eb4
Add syslog path for CentOS (#4533) 2020-04-18 14:41:06 -07:00
Mike Perham
387267814d
tweaks
Mention `systemctl kill` and ease up on the watchdog a bit.
2020-04-08 09:48:43 -07:00
Jason Swett
b48d539b9b
Add suggestion to remove WatchdogSec=5 line for Sidekiq < 6.0.6 (#4508) 2020-03-25 06:01:01 -07:00
Mike Perham
9186373b25 more docs 2020-03-17 10:42:46 -07:00
Mike Perham
1d9800b0ce Fixes for systemd notify integration, #4488 2020-03-17 10:12:25 -07:00
Mikhail Doronin
3510de7df3 Type=notify alternative in sidekiq.service systemd example (#4430) 2020-01-14 08:45:59 -08:00
Mike Perham
8c4a052141
Add exec to ensure MAINPID is Sidekiq, fixes #4401 2020-01-08 08:59:24 -08:00
Mike Perham
a8145e1a4e Freshen up 2019-10-12 11:02:55 -07:00
Alexandros
6386c6596e absolute path for bundle in sidekiq.service for rbenv (#3931) 2018-08-19 13:21:11 -07:00
Mike Perham
6e79f2a860 add memory tuning to examples 2018-04-29 17:58:19 -07:00
Kris Quigley
2dcd386301 Update sidekiq.service
Adds comment about how to use sidekiq with rbenv
2016-08-28 23:45:07 +01:00
Mike Perham
abe227d7dd typo 2015-12-18 13:52:26 -08:00
Mike Perham
dfa2b446e9 Add sample systemd unit file, fixes #1532 2015-06-25 10:24:24 -07:00