我想在Procfile
环境中使用下一个production
运行puma:
web: bundle exec puma
接下来我跑领工头:
» RAILS_ENV=production foreman start
15:47:57 web.1 | started with pid 99864
15:47:57 web.1 | Puma starting in single mode...
15:47:57 web.1 | * Version 2.8.2 (ruby 2.1.1-p76), codename: Sir Edmund Percival Hillary
15:47:57 web.1 | * Min threads: 0, max threads: 16
15:47:57 web.1 | * Environment: development
15:47:58 web.1 | * Listening on tcp://0.0.0.0:9292
15:47:58 web.1 | Use Ctrl-C to stop
请参阅此Environment: development
行?为什么不在这里production
?
但如果我使用foreman run
查看环境,则会显示production
。
» RAILS_ENV=production foreman run rails runner 'puts Rails.env'
production
是foreman
问题,还是puma
问题或其他问题?
答案 0 :(得分:-1)
我找到了Puma issues中建议的解决方案 - 使用RACK_ENV
代替RAILS_ENV
:
» RACK_ENV=production foreman start
16:04:34 web.1 | started with pid 372
16:04:34 web.1 | Puma starting in single mode...
16:04:34 web.1 | * Version 2.8.2 (ruby 2.1.1-p76), codename: Sir Edmund Percival Hillary
16:04:34 web.1 | * Min threads: 0, max threads: 16
16:04:34 web.1 | * Environment: production
16:04:35 web.1 | * Listening on tcp://0.0.0.0:9292
16:04:35 web.1 | Use Ctrl-C to stop