TalkingQuickly / capistrano-3-rails-template

Template for deploying Rails applications with Capistrano 3
270 stars 149 forks source link

Error when running cap production deploy #12

Open nanounanue opened 10 years ago

nanounanue commented 10 years ago

When running cap production deploy it returns two erros as show below:

blog git/master  
❯ cap production deploy
DEBUG [96e3b038] Running /usr/bin/env [ ! -d /usr/local/rbenv/versions/2.0.0-p247 ] on 107.170.81.168
DEBUG [96e3b038] Command: [ ! -d /usr/local/rbenv/versions/2.0.0-p247 ]
DEBUG [96e3b038] Finished in 1.216 seconds with exit status 1 (failed).
--> All tests passed
rm: no se puede borrar «log/capistrano.test.log»: No existe el archivo o el directorio
 INFO [fc0e6068] Running /usr/bin/env mkdir -p /tmp/blog/ on 107.170.81.168
DEBUG [fc0e6068] Command: ( RBENV_ROOT=/usr/local/rbenv RBENV_VERSION=2.0.0-p247 /usr/bin/env mkdir -p /tmp/blog/ )

...
...
)
 INFO [e4f96f8f] Finished in 0.150 seconds with exit status 0 (successful).                                                                                                                                                        
 INFO [2fe24c52] Running /usr/bin/env RAILS_ENV=production bundle exec rake assets:precompile on 
DEBUG [2fe24c52] Command: RAILS_ENV=production bundle exec rake assets:precompile
cap aborted!
SSHKit::Command::Failed: RAILS_ENV=production bundle exec rake assets:precompile exit status: 256
RAILS_ENV=production bundle exec rake assets:precompile stdout: Nothing written
RAILS_ENV=production bundle exec rake assets:precompile stderr: rake aborted!
ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:52:in `resolve_hash_connection'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:46:in `resolve_string_connection'                                                                   
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:30:in `spec'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/connection_handling.rb:39:in `establish_connection'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/railtie.rb:176:in `block (2 levels) in <class:Railtie>'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:27:in `each'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-4.0.2/lib/active_record/railtie.rb:174:in `block in <class:Railtie>'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/nano/tmp/blog/config/environment.rb:5:in `<top (required)>'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application.rb:189:in `require_environment!'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.0.2/lib/rails/application.rb:250:in `block in run_tasks_blocks'
/home/nano/.rvm/gems/ruby-2.0.0-p247/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:54:in `block (2 levels) in define'
/home/nano/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
/home/nano/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => environment
(See full trace by running task with --trace)

One is SSHKit::Command::Failed: RAILS_ENV=production bundle exec rake assets:precompile exit status: 256 and another (which seems unrelated) ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter

Any ideas?

nanounanue commented 10 years ago

I am using a very simple rails app as example, in this github repo you could see the code https://github.com/nanounanue/blog the app runs perfectly in my machine with rails s -e production

TalkingQuickly commented 10 years ago

The error looks like it's trying to compile assets locally but to do that you need to define a production entry in your local database.yml. This can be the same as development as it won't be used for anything. Alternatively you can disable the compile assets locally task and uncomment the rails/assets line in your Capfile which will compile them remotely when you deploy.

nanounanue commented 10 years ago

The solution as you said is setting a production environment in database.yml, but it seems weird to me...

TalkingQuickly commented 10 years ago

Hey, which bit seems weird?

Ben Dixon

+44 (0)2 032 894 803 +33 (0)7 81 83 27 78 http://www.twitter.com/TalkingQuickly http://www.talkingquickly.co.uk

Dxnx Ltd Trading as Hills Bede UK Registered Company Number: 6751002

Registered Address: DXNX LTD Techhub @ Google Campus 4 - 5 Bonhill Street London EC2A 4BX

On 25 June 2014 21:48, Adolfo De Unánue notifications@github.com wrote:

The solution as you said is setting a production environment in database.yml, but it seems weird to me...

— Reply to this email directly or view it on GitHub https://github.com/TalkingQuickly/capistrano-3-rails-template/issues/12#issuecomment-47156538 .

bartgras commented 9 years ago

If none of above worked for you, try to create, on your localhost, production/staging database (depending to what environment you're trying to deploy)