繁体   English   中英

我无法使用 systemd 启动 puma.service

[英]I am unable to start puma.service using systemd

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

彪马版本: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

现在一切正常。 `

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM