2015-05-07 8 views
5

im mit Capistrano 3.1.4, mit capfileCapistrano das Werfen ersinnen secret_key nicht gesetzt

require 'capistrano/setup' 
require 'capistrano/deploy' 
require 'capistrano/rvm' 
require 'capistrano/rails' 
require 'capistrano/rails/assets' 
require 'capistrano/faster_assets' 
require 'capistrano/rails/migrations' 

ive Setup meine Edelsteine ​​figaro und entwickeln zu können. , wenn ich an die Box ssh und lief (mit Bash_profile Export RAILS_ENV = Produktion)

bundle install # works fine 
bundle exec rake db:migrate # works fine 

aber wenn ich ausführen:

cap production deploy:compile 

erhalte ich die Fehler geheimen Schlüssel besagt, ersinnen nicht gesetzt ist, ist es, weil bash -login nicht auf dem Server ausgeführt wurde?

** Invoke deploy:compile_assets (first_time) 
** Invoke deploy:set_rails_env 
** Execute deploy:compile_assets 
** Invoke deploy:assets:precompile (first_time) 
** Execute deploy:assets:precompile 
DEBUG [05812cf9] Running /usr/bin/env if test ! -d /home/user1/rails/releases/20150507175646; then echo "Directory does not exist '/home/user1/rails/releases/20150507175646'" 1>&2; false; fi as [email protected] 
DEBUG [05812cf9] Command: if test ! -d /home/user1/rails/releases/20150507175646; then echo "Directory does not exist '/home/user1/rails/releases/20150507175646'" 1>&2; false; fi 
DEBUG [05812cf9] stdin: is not a tty 
DEBUG [05812cf9] Finished in 0.458 seconds with exit status 0 (successful). 
DEBUG [4713c277] Running /usr/bin/env ls -xr /home/user1/rails/releases as [email protected] 
DEBUG [4713c277] Command: cd /home/user1/rails/releases/20150507175646 && (RAILS_ENV=production /usr/bin/env ls -xr /home/user1/rails/releases) 
DEBUG [4713c277] stdin: is not a tty 
DEBUG [4713c277] 20150507175646 20150507175448 20150507173408 20150507171913 20150507162459 
DEBUG [4713c277] 20150507161419 20150507155316 20150507153253 20150507151908 20150507150428 
DEBUG [4713c277] 20150507145904 20150507142928 20150507104745 20150504061059 20150504051818 
DEBUG [4713c277] 20150429060420 20150417025054 
DEBUG [4713c277] Finished in 0.404 seconds with exit status 0 (successful). 
INFO [f226806f] Running /usr/bin/env ls /home/user1/rails/releases/20150507175448/assets_manifest_backup as [email protected] 
DEBUG [f226806f] Command: cd /home/user1/rails/releases/20150507175646 && (RAILS_ENV=production /usr/bin/env ls /home/user1/rails/releases/20150507175448/assets_manifest_backup) 
DEBUG [f226806f] stdin: is not a tty 
DEBUG [f226806f] ls: 
DEBUG [f226806f] cannot access /home/user1/rails/releases/20150507175448/assets_manifest_backup 
DEBUG [f226806f] : No such file or directory 
DEBUG [f226806f]  
INFO [07c227d5] Running /usr/local/rvm/bin/rvm default do bundle exec rake assets:precompile as [email protected] 
DEBUG [07c227d5] Command: cd /home/user1/rails/releases/20150507175646 && (RAILS_ENV=production /usr/local/rvm/bin/rvm default do bundle exec rake assets:precompile) 
DEBUG [07c227d5] stdin: is not a tty 
DEBUG [07c227d5] rake aborted! 
DEBUG [07c227d5] Devise.secret_key was not set. Please add the following to your Devise initializer: 
DEBUG [07c227d5]  
DEBUG [07c227d5]  config.secret_key = '2b23a31ec3325533df50c4384f2b0d62fa8430c606adb7d24259cbdadd329e3d659a2c0dd2b42c19cc7761b836e9200ed413a3d0d1ab530369bf20198d9c39c7' 
DEBUG [07c227d5]  
DEBUG [07c227d5] Please ensure you restarted your application after installing Devise or setting the key. 
DEBUG [07c227d5] /home/user1/rails/shared/bundle/ruby/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:483:in `raise_no_secret_key' 
DEBUG [07c227d5] /home/user1/rails/shared/bundle/ruby/2.1.0/gems/devise-3.3.0/lib/devise/rails/routes.rb:209:in `devise_for' 
DEBUG [07c227d5] /home/user1/rails/releases/20150507175646/config/routes.rb:91:in `block in <top (required)>' 
DEBUG [07c227d5] /home/user1/rails/shared/bundle/ruby/2.1.0/gems/actionpack-4.1.6/lib/action_dispatch/routing/route_set.rb:337:in `instance_exec' 
DEBUG [07c227d5] /home/user1/rails/shared/bundle/ruby/2.1.0/gems/actionpack-4.1.6/lib/action_dispatch/routing/route_set.rb:337:in `eval_block' 
DEBUG [07c227d5] /home/user1/rails/shared/bundle/ruby/2.1.0/gems/actionpack-4.1.6/lib/action_dispatch/routing/route_set.rb:315:in `draw' 
DEBUG [07c227d5] /home/user1/rails/releases/20150507175646/config/routes.rb:1:in `<top (required)>' 
... 
+1

jetzt Tage nützlich sein, ive die Methode geändert der Bereitstellung, um secrets.yml zu verwenden und Abhängigkeiten von figaro zu entfernen. Um auf die secrets.yml-Variable zuzugreifen, verwenden Sie <% = ENV ['fieldname']%> ​​in der YML-Datei und ENV ['fieldname'] in Ruby-Code –

Antwort

4

es stellte mir heraus, dass mein figaro Aufgaben nicht vor dem Vermögen ausgeführt wurden: precompile. ive hat mein Ereignis in before geändert: aktualisiert, um das Problem zu beheben. hier sind das Beispiel einer Arbeits figaro in config/deploy.rb

Kappe Produktion --trace # einsetzen wird für debuggging

mehr auf capistrano flow

namespace :figaro do 
    desc "SCP transfer figaro configuration to the shared folder" 
    task :setup do 
     on roles(:app) do 
      upload! "config/application.yml", "#{shared_path}/application.yml", via: :scp 
     end 
    end 

    desc "Symlink application.yml to the release path" 
    task :symlink do 
     on roles(:app) do 
      execute "ln -sf #{shared_path}/application.yml #{release_path}/config/application.yml" 
     end 
    end 

end 

namespace :deploy do 
    before :updated, "figaro:setup" 
    before :updated, "figaro:symlink" 
end