工头在错误的环境中运行美洲狮

时间:2014-05-08 12:54:29

标签: ruby-on-rails foreman puma

我想在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问题或其他问题?

1 个答案:

答案 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