ruby-on-rails - bundler : failed to load command: sidekiq -> systemd

标签 ruby-on-rails ubuntu capistrano sidekiq systemd

我已经厌倦了在 ubuntu 上设置 sidekiq
通过使用 rvm、capistrano gem、capistrano-sidekiq gem、sidekiq gem、redis gem
这是我的 sidekiq.service 文件(由官方 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
(当然,我的 RVM 中有 3.0.0 ruby​​ 和自定义 r611 gemset,它们成功运行)
$ systemctl enable sidekiq
$ systemctl start sidekiq
但是当我尝试启动此服务时 - 它不起作用:
Job for sidekiq.service failed because the control process exited with error code.
See "systemctl status sidekiq.service" and "journalctl -xe" for details.
如果我们尝试检查我们的日志 - 我们将看到:
$ 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>'
什么包在我的 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
我很困惑,为什么它不起作用并且不明白如何在终端中没有一些可读信息的情况下修复它。因为我的 Gemfile 有 sidekiq gem,我可以手动成功使用它。

最佳答案

如果你使用 capistrano - 这一行:

WorkingDirectory=/home/deploy/my_platform/current
应该 :
WorkingDirectory=/home/deploy/my_platform

关于ruby-on-rails - bundler : failed to load command: sidekiq -> systemd,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66945851/

相关文章:

postgresql-13-postgis-3 : Depends: libgdal20 (>= 2. 0.1) 但它不会被安装

python - Databricks CLI 未在 Ubuntu 18.04 上安装

ruby - Capistrano:使用标准 Gem-Home 中的 Bundle Gems

ruby-on-rails - 如何在单表继承中运行子类的验证?

mysql - 我正在使用 Ubuntu、XAMPP、MySQL 和 Geany。使用 fopen() 时遇到问题;

ruby-on-rails - 运行 Rails 并将其部署到 Docker 容器

ruby-on-rails - ENV 变量中的 Capistrano 和 API key ?

ruby-on-rails - Rails 5.2 ActiveStorage 保存并读取 Exif 数据

ruby-on-rails - 如何在没有 tilda 的情况下从 node_modules 导入 scss 文件?

ruby-on-rails - (仅)在创建 Controller 和模型后创建 Ruby on Rails View