Gow*_*nan 6 systemd puma ubuntu-16.04
我创建了一个名为"puma.service"in 的服务脚本,/etc/systemd/system/其中包含以下内容:
[Unit]
Description=Puma HTTP Server
After=network.target
[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/username/appdir/current
ExecStart=/bin/bash -lc "/home/username/appdir/current/sbin/puma -C /home/username/appdir/current/config/puma.rb /home/username/appdir/current/config.ru"
Restart=always
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
我启用了该服务,启动时,我从systemctl获取以下日志:
? puma.service - Puma HTTP Server
Loaded: loaded (/etc/systemd/system/puma.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Wed 2016-12-14 10:09:46 UTC; 12min ago
Process: 16889 ExecStart=/bin/bash -lc cd /home/username/appdir/current && bundle exec puma -C /home/username/appdir..
Main PID: 16889 (code=exited, status=127)
Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: puma.service: Main process exited, code=exited, status=127/n/a
Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: puma.service: Unit entered failed state.
Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: puma.service: Failed with result 'exit-code'.
Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: puma.service: Service hold-off time over, scheduling restart.
Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: Stopped Puma HTTP Server.
Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: puma.service: Start request repeated too quickly.
Dec 14 10:09:46 ip-172-31-29-40 systemd[1]: Failed to start Puma HTTP Server.
Run Code Online (Sandbox Code Playgroud)
虽然,当我在SSH终端中发出命令时,服务器启动并运行完美.我必须在服务文件中进行任何更改吗?
注意:
你能解开一些光吗?
我发现了问题并改变了ExecStart,如下所述,它就像一个魅力:
ExecStart=/home/username/.rbenv/shims/bundle exec puma -e production -C ./config/puma.rb config.ru
PIDFile=/home/username/appdir/shared/tmp/pids/puma.pid
Run Code Online (Sandbox Code Playgroud)
bundle应该从rbenv垫片和puma的配置文件(config/puma.rb)和应用程序的配置文件(config.ru)中获取相对路径.
| 归档时间: |
|
| 查看次数: |
2809 次 |
| 最近记录: |