I have tired to setup sidekiq on ubuntu By using rvm, capistrano gem, capistrano-sidekiq gem, sidekiq gem, redis gem
This is my sidekiq.service file (wrote by official example):
[Unit]
Description=sidekiq
After=syslog.target network.target
[Service]
Type=notify
WatchdogSec=10
WorkingDirectory=/home/deploy/my_platform/current
ExecStart=/home/deploy/.rvm/gems/ruby-3.0.0@r611/wrappers/bundle exec sidekiq -e production
User=deploy
Group=deploy
UMask=0002
Environment=MALLOC_ARENA_MAX=2
RestartSec=1
Restart=on-failure
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=sidekiq
[Install]
WantedBy=multi-user.target
(Sure, I have 3.0.0 ruby and custom r611 gemset in my RVM which successfully works)
$ systemctl enable sidekiq
$ systemctl start sidekiq
But when i trying to start this service - it don't works:
Job for sidekiq.service failed because the control process exited with error code.
See "systemctl status sidekiq.service" and "journalctl -xe" for details.
If we try to check our logs - we will see this:
$ journalctl -u sidekiq
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: bundler: failed to load command: sidekiq (/home/deploy/my_platform/shared/bundle/ruby/3.0.0/bin/sidekiq)
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: /home/deploy/.rvm/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/bundler/rubygems_integration.rb:362:in `block in replace_bin_path': can't find executable sidekiq for gem sidekiq. sidekiq is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/.rvm/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/bundler/rubygems_integration.rb:390:in `block in replace_bin_path'
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/my_platform/shared/bundle/ruby/3.0.0/bin/sidekiq:23:in `<top (required)>'
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/.rvm/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/bundler/cli/exec.rb:63:in `load'
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/.rvm/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/bundler/cli/exec.rb:63:in `kernel_load'
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/.rvm/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/bundler/cli/exec.rb:28:in `run'
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/.rvm/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/bundler/cli.rb:494:in `exec'
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/.rvm/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/.rvm/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/.rvm/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/.rvm/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/bundler/cli.rb:30:in `dispatch'
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/.rvm/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/.rvm/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/bundler/cli.rb:24:in `start'
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.15/exe/bundle:49:in `block in <top (required)>'
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/.rvm/rubies/ruby-3.0.0/lib/ruby/site_ruby/3.0.0/bundler/friendly_errors.rb:130:in `with_friendly_errors'
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.15/exe/bundle:37:in `<top (required)>'
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/.rvm/gems/ruby-3.0.0@r611/bin/bundle:23:in `load'
Apr 04 19:08:06 ubuntu-s-1vcpu-1gb-nyc1-01 sidekiq[14639]: from /home/deploy/.rvm/gems/ruby-3.0.0@r611/bin/bundle:23:in `<main>'
What bundle says in my rvm gemset:
~/my_platform$ bundle info sidekiq
* sidekiq (6.2.0)
Summary: Simple, efficient background processing for Ruby
Homepage: https://sidekiq.org
Documentation: https://github.com/mperham/sidekiq/wiki
Source Code: https://github.com/mperham/sidekiq
Changelog: https://github.com/mperham/sidekiq/blob/master/Changes.md
Bug Tracker: https://github.com/mperham/sidekiq/issues
Path: /home/deploy/.rvm/gems/ruby-3.0.0@r611/gems/sidekiq-6.2.0
I'm confused, why it not works and don't understand how to fix it without some readable information in the terminal. Because my Gemfile has sidekiq gem and i can successfully using it manually.
If are you use capistrano - this line:
WorkingDirectory=/home/deploy/my_platform/current
Should be :
WorkingDirectory=/home/deploy/my_platform