I found some issues with a worker running in the development environment and need to customize the foreman export task to set the ENV to production somehow:
task :export_worker, roles: :worker do
foreman_export = "foreman export --app #{application} --user #{user} --concurrency worker=3,worker_slow=2,clock=1 --log #{shared_path}/log upstart /etc/init"
run "cd #{current_path} && #{sudo} #{bundle_cmd} exec #{foreman_export}"
end
Anyone know how I can set it to production when it runs?
Foreman has an environment option that can be used to load custom
.env
files. You could try using that to set the environment to production.For example, if you had a
development.env
file containing the following:You could get Foreman to load it like this:
Then if you need to reference the environment in your
Procfile
(example assumes sidekiq worker):Heroku has a nice article on setting up a
.env
file for use with Foreman.