rvm - capistrano 3 + rvm1-capistrano3 rails 4.1 secrets.yml environmental variables issue -
i have been deploying rails 4.1 application capistrano 3. has been working fine. when tried rake tasks (uncommenting require 'capistrano/rails/assets'). error
cap aborted! sshkit::runner::executeerror: exception while executing on host xxx.xxx.xxx.xxx: rake exit status: 1 rake stdout: nothing written rake stderr: config.eager_load set nil. please update config/environments/*.rb files accordingly: * development - set false * test - set false (unless use tool preloads test environment) * production - set true rake aborted! argumenterror: missing required arguments: google_storage_access_key_id, google_storage_secret_access_key /home/deploy/yelo/shared/bundle/ruby/2.1.0/gems/fog-core-1.24.0/lib/fog/core/service.rb:237:in `validate_options' /home/deploy/yelo/shared/bundle/ruby/2.1.0/gems/fog-core-1.24.0/lib/fog/core/service.rb:261:in `handle_settings' /home/deploy/yelo/shared/bundle/ruby/2.1.0/gems/fog-core-1.24.0/lib/fog/core/service.rb:98:in `new' /home/deploy/yelo/shared/bundle/ruby/2.1.0/gems/fog-core-1.24.0/lib/fog/storage.rb:26:in `new' /home/deploy/yelo/shared/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:83:in `eager_load_fog' /home/deploy/yelo/shared/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:96:in `fog_credentials=' /home/deploy/yelo/releases/20140910131617/config/initializers/carrierwave.rb:8:in `block in <top (required)>' /home/deploy/yelo/shared/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:118:in `configure' /home/deploy/yelo/shared/bundle/ruby/2.1.0/gems/carrierwave-0.10.0/lib/carrierwave.rb:14:in `configure' /home/deploy/yelo/releases/20140910131617/config/initializers/carrierwave.rb:5:in `<top (required)>' /home/deploy/yelo/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `load' /home/deploy/yelo/shared/bundle/ruby/2.1.0/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in `block in load'
the config.eager_load set true. thing google_storage_access_key_id keys initialized inside initializer values config.secrets.yml
require 'fog' require 'rails' require 'carrierwave' carrierwave.configure |config| config.root = rails.root.join('tmp') config.cache_dir = 'carrierwave' config.fog_credentials = { :provider => 'google', :google_storage_access_key_id => rails.application.secrets.storage_access_key, :google_storage_secret_access_key => rails.application.secrets.storage_access_secret } config.fog_directory = 'yelostore' end
config.secrets.yml
storage_access_key: <%= env['storage_access_key']%> storage_access_secret: <%= env['storage_access_secret']%>
i stored environmental variables in /etc/profile.
there issues arise if rake or execute tasks. if removed initializer file error devise.secret_key not set. please add following devise initializer:
config.secret_key = '6b88a299ed1361b5c0275e.....'
this essentiall because of secret_key_base: <%= env["secret_key_base"] %> not getting loaded @ point.
finally can run tasks go root path. while doing through capistarno these errors arise. capistarno not getting config.scecrets env variables stored in /etc/profile
capistrano seems environmental variables /etc/environment rather shell bashrc or profile didnt't work.
the config.eager_load issue solved after upgraded capistrano 3.0rc 3.2
Comments
Post a Comment