Question

I want to run puma with next Procfile in production environment:

web: bundle exec puma

Next I run foreman:

» 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

See this Environment: development line? Why not production here?

But if I check environment with foreman run it shows production.

» RAILS_ENV=production foreman run rails runner 'puts Rails.env'
production

Is it foreman issue, or puma issue or something else?

Was it helpful?

Solution

I found a solution, as recommended in Puma issues - to use RACK_ENV instead of 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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top