-
Notifications
You must be signed in to change notification settings - Fork 95
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
Does it expose OpsWorks ENV variables to a sidekiq process? #14
Comments
I have a similar issue. It doesn't seem that OpsWorks ENV variables are available in the delayed job workers. |
Hi wzcolon, what do you mean they're not available? I can access them just fine from this cookbook by using the environment_variables hash inside node[:deploy]. For me, the delayed_job workers weren't sending any emails because the workers themselves needed to be started with the SMTP password as an ENV variable. I don't know if there's a better or cleaner way to do this, but in my case the only way I found to make it work was this in delayed_job.monitrc.erb:
I hope someone finds this useful! |
I haven't used Opsworks' environment variables feature because they were limited in number and/or length. (I don't recall which... and it's possible they've been fixed in the meantime.) I'd happily review a pull request that employed the Opsworks-provided environment variables, if you're interested in working on that. As far as how it would be implemented, you'd probably have to write the environment variables to a file, and then source them from the start script. I've used the opsworks_custom_env custom cookbook in combination with the figaro gem to automatically load variables from a config/application.yml file into our Rails app's ENV. This works for both the web apps and the delayed_job processes. |
I noodled around with trying to modify this library to pass in environment variables, but it's a bit tricky to make that work without rewriting the monit template on every deploy. Instead, since we were already using file ::File.join(release_path, '.env.production') do
content new_resource.environment.map { |k, v| "#{k}=#{v}" }.join("\n")
end This (redundantly) copies all of the opsworks environment variables into a file, which |
I could see this working. It's similar to what we accomplish with figaro, described above. If you do want to update the monit configuration that this cookbook writes out, I don't think "rewriting the monit template on every deploy" will be a problem. The opsworks_delayed_job/recipes/setup.rb Line 35 in 3e6519a
|
This is what I did to inject environment variables directly into the monit template, but after some discussions we decided to go with the |
No description provided.
The text was updated successfully, but these errors were encountered: