-
Notifications
You must be signed in to change notification settings - Fork 414
Sidekiq service file for systemd (CentOS, Fedora) #43
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
Conversation
|
Please add header to each file |
|
done ;) there's only one service file: Also there's just sidekiq because all other services can be installed with package management which creates startup files automatically and there's multiple choices which software to use (eg. nginx or apache) Also seems I've lied a bit, current stable CentOS release doesn't come with systemd, but it can be installed. Distributions with systemd as default:
Distributions where systemd can be enabled/installed easily:
|
|
Why not something more along the lines of: The ExecStart/Stop need an absolute path, but this is a lot simpler... I'll check why it is crashing, if it does, on my Arch machine. |
|
wasn't aware there's EDIT: |
|
I updated sidekiq service, thanks :) seems to work good :) |
|
whoops... sidekiq is crashing same as my first attempt... EDIT: |
|
I reverted back... I've no idea why sidekiq is crashing... anyway while this config might not be the nicest it does work so unless someone have better one which doesn't crash sidekiq I'm leaving this one. |
|
So after going crazy trying to get a working sidekiq.service on my arch machine I ended up with this service, where setting Environment=PATH= seems to be the winner for me since sidekiq kept throwing failed to run command on bundle even with absolute paths etc. Kinda assumed there's another bundle call inside which wont find the bundle without the PATH set. [Unit]
Description=GitLab Sidekiq Service
After=redis.service gitlab.service
Requires=redis.service
[Service]
Type=forking
SyslogIdentifier=gl-sidekiq
PIDFile=/home/gitlab/gitlab/tmp/pids/sidekiq.pid
WorkingDirectory=/home/gitlab/gitlab
TimeoutStartSec=600
User=gitlab
Environment=PATH=/home/gitlab/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/core_perl
ExecStart=/bin/bash -c 'bundle exec rake sidekiq:start RAILS_ENV=production'
ExecStop=/bin/bash -c 'bundle exec rake sidekiq:stop RAILS_ENV=production'
[Install]
WantedBy=multi-user.targetWell idk figured I'd just post it just in case it might actually help someone ^^ |
|
this ^ above, doesn't work for me on Fedora, still crash but bit different than earlier. [Unit]
Description=GitLab Sidekiq Service
After=syslog.target network.target remote-fs.target redis.service
Wants=redis.service
[Service]
Type=simple
TimeoutStartSec=30
SyslogIdentifier=gl-sidekiq
PIDFile=/home/gitlab/gitlab/tmp/pids/sidekiq.pid
ExecStart=/bin/su - gitlab -c "(cd /home/gitlab/gitlab/ && bundle exec rake sidekiq:start RAILS_ENV=production) || 0"
ExecStop=/bin/su - gitlab -c "(cd /home/gitlab/gitlab/ && bundle exec rake sidekiq:stop RAILS_ENV=production) || 0"
[Install]
WantedBy=multi-user.target
|
|
I provided some service files based on many suggestions that play with Fedora (see above commit). Haven't tested with Arch yet. I also included your readme and I added 1-2 things. Feedback welcomed :) |
|
just tested, works good for my Fedora 18 :) Thanks 👍 |
|
Cool! Thanks for the feedback. I'll add your name to the contributors if you don't mind. |
|
sure lol. When I first tried sidekiq as systemd unit file for some configurations it was crashing, that was when I had F17, maybe some buggy lib/gem somewhere idk, but anyway this unit file is very clean and nice, not sure if you saw any crashes, but I didn't now with this and fully updated system. |
|
No crashes for me too, I tested before pushing on Fedora 19. Will have to do the same for Archlinux. To give proper credits, I took the sidekiq one from here. |
CentOS and Fedora uses
systemdnot usualinit.dso it needs bit different configuration.I added
sidekiq.servicefilefirst I tried:
but sidekiq was crashing (don't know why, it was launched as gitlab user)
this works fine
ExecStart=/bin/su - gitlab -c "cd /home/gitlab/gitlab/ && bundle exec rake sidekiq:start"