Background Info: I have made a Ruby on Rails application that utilizes the ruby gem Devise. When using the gem I have configured the gem's secret key in OpsWorks console as an environment variable.
When running the before_migrate.rb deployment hook I run the command rake assets:precompile. But I receive an error in the deployment log.
execute "rake assets:precompile" do
cwd release_path
command "bundle exec rake assets:precompile"
environment "RAILS_ENV" => rails_env
end
Error executing action
runon resource 'execute[rake assets:precompile]' Mixlib::ShellOut::ShellCommandFailedExpected process to exit with [0], but received '1' ---- Begin output of bundle exec rake assets:precompile --trace ---- STDOUT: STDERR:
** Invoke assets:precompile (first_time) ** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment rake aborted! Devise.secret_key was not set. Please add the following to your Devise initializer:
config.secret_key = '*****'
I know the environment variables are eventually being set because in my before_migrate.rb file I output the environment variables to log. When I hard code the config.secret_key everything works correctly.
Question: When using OpsWorks do the initializers config/initializers/* from my project get run before any of the environment variables get set? Is there another way around this without hard coding keys or SSHing into every instance?
