New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment variables fail to update on clean restart #142

kschutt opened this Issue Jan 23, 2018 · 1 comment


None yet
2 participants
Copy link

kschutt commented Jan 23, 2018


This is more informational than an actual bug, but it caused us a ton of headaches.

Here is our setup:

Appserver: Unicorn
Env: Figaro (app.yml)

It seems that e46d5fe#diff-371a459048a25bfa4ce43154b9d9fd55R6 introduced a change for all appservers where it defines all the environment variables in the script as ENV['VAR1']. This is fine because the after_deploy method does a stop-start on the appserver itself.

However, if we change the after_deploy to be a clean-restart using USR2 instead, then any changes to the ENV variables in OpsWorks are not picked up. This is because the user's ENV isn't changed with a clean-restart which override any variables set in application.yml. This was visible when launching rails console with errors similar to below:

WARNING: Skipping key "SECRET_KEY_BASE". Already set in ENV.

The solution for us was to remove the ENV setters in the appserver.service.erb and let Unicorn pick up the variables from application.yml which is updated on deployment.

Note: This is specifically for -updating- an environment variable's value. Any -new- environment variables are unaffected because the clean-restart'd Unicorn process loads them from the application.yml.


This comment has been minimized.

Copy link

ajgon commented Feb 25, 2018

Thank you for this feedback! I'll add it to "Troubleshoot" section of the documentation.

@ajgon ajgon closed this Feb 25, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment