简体   繁体   English

在centos 7上将puma服务器作为服务运行-未找到红宝石

[英]run puma server as a service at centos 7 - no ruby found

There are many things I do not understand, so my question may be silly. 我有很多事情不了解,所以我的问题可能很愚蠢。
I want to run a puma ror server as a systemd service at centos 7. Use ruby installed using rvm. 我想在centos 7上将puma ror服务器作为systemd服务运行。使用通过rvm安装的ruby。
My puma_test.service file is: 我的puma_test.service文件是:

[Unit]
Description=Puma application server
After=network.target

[Service]
WorkingDirectory=/var/www/test_app
Environment=RAILS_ENV=development

PIDFile=/var/www/shared/pids/puma.pid
ExecStart=/usr/local/rvm/gems/ruby-2.2.1/gems/bundler-1.9.4/bin/bundle exec puma -e development -b unix:///var/www/shared/pids/puma.sock --pidfile /var/www/shared/pids/puma.pid

[Install]
WantedBy=multi-user.target

but when I run it, it does not work. 但是当我运行它时,它不起作用。 I get error (from journalctl): 我收到错误消息(来自journalctl):

  kwi 18 22:56:15 vps150852.ovh.net systemd[1]: Starting Puma application server...
kwi 18 22:56:15 vps150852.ovh.net systemd[1]: Started Puma application server.
kwi 18 22:56:15 vps150852.ovh.net bundle[2072]: /usr/bin/env: ruby: No such file or directory
kwi 18 22:56:15 vps150852.ovh.net systemd[1]: puma_test.service: main process exited, code=exited, status=127/n/a
kwi 18 22:56:15 vps150852.ovh.net systemd[1]: Unit puma_test.service entered failed state.

when I run i /usr/www/test_app 当我运行我/ usr / www / test_app

/usr/local/rvm/gems/ruby-2.2.1/gems/bundler-1.9.4/bin/bundle exec puma -e development -b unix:///var/www/shared/pids/puma.sock --pidfile /var/www/shared/pids/puma.pid

everything works fine, but I am probably doing something wrong 一切正常,但我可能做错了

Looks like you need to load rvm when you run your task. 看起来您在运行任务时需要加载rvm。 systemd run in shell, not in bash, your bashrc will not be loaded systemd在shell中运行,而不是在bash中运行,因此不会加载您的bashrc

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

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