【发布时间】:2016-02-19 07:01:10
【问题描述】:
我的 Ruby on Rails 应用程序使用工头 (https://github.com/ddollar/foreman) 来管理应用程序运行时需要启动的进程。
我的Procfile 看起来像这样:
precompile: bundle exec rake assets:precompile
web: bundle exec puma -e $PUMA_ENV
worker: bundle exec rake jobs:work
search: bundle exec rake sunspot:solr:run
运行 $ foreman start 按预期工作,直到我添加第一行(precompile 任务)。
当我运行 $ foreman start 时,我的输出如下所示:
$ foreman start -e .env.dev
10:30:20 precompile.1 | started with pid 7309
10:30:20 web.1 | started with pid 7310
10:30:20 worker.1 | started with pid 7311
10:30:20 search.1 | started with pid 7312
10:30:22 web.1 | [7310] Puma starting in cluster mode...
10:30:22 web.1 | [7310] * Version 2.8.2 (ruby 2.1.0-p0), codename: Sir Edmund Percival Hillary
10:30:22 web.1 | [7310] * Min threads: 4, max threads: 16
10:30:22 web.1 | [7310] * Environment: development
10:30:22 web.1 | [7310] * Process workers: 2
10:30:22 web.1 | [7310] * Phased restart available
10:30:22 web.1 | [7310] * Listening on tcp://0.0.0.0:3000
10:30:22 web.1 | [7310] Use Ctrl-C to stop
10:30:23 web.1 | [7313] + Gemfile in context: /Users/username/rails_projects/lcms/Gemfile
10:30:23 web.1 | [7314] + Gemfile in context: /Users/username/rails_projects/lcms/Gemfile
10:30:30 web.1 | [7310] - Worker 1 (pid: 7314) booted, phase: 0
10:30:30 worker.1 | [Worker(host:MacBook-Pro.local pid:7311)] Starting job worker
10:30:30 web.1 | [7310] - Worker 0 (pid: 7313) booted, phase: 0
10:30:32 precompile.1 | exited with code 0
10:30:32 system | sending SIGTERM to all processes
SIGTERM received
10:30:32 web.1 | [7310] - Gracefully shutting down workers...
10:30:32 worker.1 | [Worker(host:MacBook-Pro.local pid:7311)] Exiting...
10:30:32 search.1 | exited with code 143
10:30:32 web.1 | [7310] - Goodbye!
10:30:32 web.1 | exited with code 0
10:30:33 worker.1 | exited with code 0
我不知道如何获得有关该问题的更多详细信息。我已经将$stdout.sync = true添加到我的config/environments/development.rb中,输出和没有的一样。
我还尝试将RAILS_ENV=development 和RAILS_ENV=production 附加和前置到预编译任务中。
如何让我的工头/Procfile 设置成功地预编译资产,然后继续启动应用程序的其他任务?
【问题讨论】:
-
我怀疑
10:30:32 precompile.1 | exited with code 0是rake assets:precompile任务的结束,0的退出码告诉工头杀死所有进程。我不确定如何覆盖它,如果我这样做了,我不知道这是否明智。
标签: ruby-on-rails-4 rake foreman