how does a rails app set its environment?

Finally figured it out today.

Since adding the staging environment to the application I guess I needed to add some config files inside a puma directory in the app itself to help puma figure out what it needed to do.

To be honest I’m still not sure why I needed this since puma would say it was running in development, which I thought was setting the environment.

What I did was add a puma directory inside the config directory and then I added a file called developemnt.rb and in there put the setting for running in the development environment.

puma/development.rb

#!/usr/bin/env puma
root = "/Path/to/the/application"
daemonize false
environment "development"
directory root
pidfile "#{root}/tmp/pids/puma.pid"
stdout_redirect "#{root}/log/puma_stdout.log", "#{root}/log/puma_stderr.log", true
workers 2
threads 8,32
bind "unix:///#{root}/tmp/sockets/puma.sock"
bind "tcp://0.0.0.0:8080"
preload_app! 

It nows runs as expected on my local machine.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top