Und*_*ion 6 ruby ruby-on-rails process nginx foreman
我目前正在运行Foreman on staging(Ubuntu),一旦我开始工作就会切换到使用upstart.
我的Procfile.staging看起来像这样:
nginx: sudo service nginx start
unicorn: bundle exec unicorn -c ./config/unicorn.rb
redis: bundle exec redis-server
sidekiq: bundle exec sidekiq -v -C ./config/sidekiq.yml
Run Code Online (Sandbox Code Playgroud)
我可以使用以下命令成功启动nginx:
$ sudo service nginx start
Run Code Online (Sandbox Code Playgroud)
但是当我运行$ foreman start时,其他三个进程成功启动,nginx不会:
11:15:46 nginx.1 | started with pid 15966
11:15:46 unicorn.1 | started with pid 15968
11:15:46 redis.1 | started with pid 15971
11:15:46 sidekiq.1 | started with pid 15974
11:15:46 nginx.1 | Starting nginx: nginx.
11:15:46 nginx.1 | exited with code 0
11:15:46 system | sending SIGTERM to all processes
SIGTERM received
11:15:46 unicorn.1 | terminated by SIGTERM
11:15:46 redis.1 | terminated by SIGTERM
11:15:46 sidekiq.1 | terminated by SIGTERM
Run Code Online (Sandbox Code Playgroud)
那么为什么在Foreman开始时nginx不会出现呢?
这是您的 Procfile 中的问题。
该nginx命令不能使用sudoinside foreman,因为它always ask for a password会失败。这就是为什么您没有启动nginx并且日志为空的原因。
如果您确实需要在 procfile 中使用 sudo,您可以使用如下内容:
sudo_app: echo "sudo_password" | sudo -S app_command
nginx: echo "sudo_password" | sudo -S service nginx start
Run Code Online (Sandbox Code Playgroud)
我真的不推荐。其他选择是致电sudo foreman start
有关更多信息,请查看github 上的此问题,这正是您想要解决的问题。
如果它对你有用,请告诉我。
| 归档时间: |
|
| 查看次数: |
1321 次 |
| 最近记录: |