我无法使用 systemd 启动 puma.service

I am unable to start puma.service using systemd

到昨天为止运行一直很好。现在,突然间我根本无法获得 puma 运行ning。我目前正在使用 tmux 来 运行 puma 和 运行 我的应用程序。但是,当我尝试使用 systemctl 运行 服务器时,它失败了。注意:- 我更新了 rake 和其他 gems 然后不得不恢复,这给了我错误。我已经激活了新版本的 rake,并使用了旧版本。所以,我决定安装 gem 'rubygems-bundler'。这可能是问题的原因吗?我现在已经删除了这个 gem。但是,还是不行。

Puma 版本:3.12.0

这是 puma.service 状态:

puma.service - Puma HTTP Server
Loaded: loaded (/etc/systemd/system/puma.service; enabled; vendor preset: enabled)
Active: failed (Result: start-limit-hit) since Wed 2020-07-01 12:06:47 UTC; 1s ago
Process: 14640 ExecStart=/home/deploy/.rbenv/shims/puma -C config/puma.rb -p 9100 -e staging (code=exited, status=1/FAILURE)
Main PID: 14640 (code=exited, status=1/FAILURE)

systemd[1]: puma.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: puma.service: Unit entered failed state.
systemd[1]: puma.service: Failed with result 'exit-code'.
systemd[1]: puma.service: Service hold-off time over, scheduling restart.
systemd[1]: Stopped Puma HTTP Server.
systemd[1]: puma.service: Start request repeated too quickly.
systemd[1]: Failed to start Puma HTTP Server.
systemd[1]: puma.service: Unit entered failed state.
systemd[1]: puma.service: Failed with result 'start-limit-hit'.

我的 pumar.rb 文件是:

workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
threads threads_count, threads_count

bind "unix:///tmp/production-puma.sock"

preload_app!

rackup      DefaultRackup
port        ENV['PORT']     || 3000
environment ENV['RACK_ENV'] || 'development'

on_worker_boot do
  # Worker specific setup for Rails 4.1+
  ActiveRecord::Base.establish_connection
end

app_path = File.expand_path(File.dirname(__FILE__) + '/../')

stdout_redirect "/#{app_path}/log/puma.stdout.log", "/#{app_path}/log/puma.stderr.log"

这是puma.service文件

[Unit]
Description=Puma HTTP Server
After=network.target

# Uncomment for socket activation (see below)
Requires=puma.socket

[Service]
# Foreground process (do not use --daemon in ExecStart or config.rb)
Type=simple
#Type=forking

# Preferably configure a non-privileged user
User=deploy

# The path to the puma application root
# Also replace the "<WD>" place holders below with this path.
WorkingDirectory=/home/deploy/app

# Helpful for debugging socket activation, etc.
# Environment=PUMA_DEBUG=1

 ExecStart=/home/deploy/.rbenv/shims/puma -C config/puma.rb -p 9100 -e staging

Restart=always

[Install]
WantedBy=multi-user.target

好的。解决了这个问题。确实是rubygems-bundler.

造成的

卸载rubygems-bundler

gem uninstall rubygems-bundler

我的确切问题不是 运行 以下命令:

executable-hooks-uninstaller

现在一切正常。 `