0

I am currently using multistage extension in Capistrano to deploy my code. The two stages I have are "production" and "staging".

Now I would like to be able to specify one of my branches in Git to be used for deployment in staging. Currently, both prod and staging are deployed off of master - but I would like to implement Gitflow and use my develop branch for my staging environment.

I've looked around and found this to be the answer in my staging.rb file:

set :rails_env, "staging"
set :deploy_to, "/path/to/project"
set :branch, "develop"

But once I include this and try to run cap staging deploy, I get this error:

* executing "cd -- /path/to/project/releases/201309131 && bundle exec rake RAILS_ENV=staging RAILS_GROUPS=assets assets:precompile && cp -- /path/to/project/shared/assets/manifest.yml /path/to/project/releases/201309131/assets_manifest.yml"
    servers: \["10.1.171.106"\]
    \[10.1.171.106\] executing command
 ** \[out :: 10.1.171.106\] rake aborted!
 ** \[out :: 10.1.171.106\] database configuration does not specify adapter

I see this question: Thin / Capistrano cannot connect to database

But when I look at my tasks they look just like this:

  task :start do ; end
  task :stop do ; end

I wasn't the one who set these environments up nor am I very familiar with Capistrano, so I'm not so sure whats happening here.

Any ideas about what is going on?

EDIT: Including my database.yml

# MySQL.  Versions 4.1 and 5.0 are recommended.
# 
# Install the MYSQL driver
#   gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
#   gem 'mysql2'
#
# And be sure to use new-style password hashing:
#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: project_development
  pool: 5
  username: user
  password:
  socket: /tmp/mysql.sock

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: project_test
  pool: 5
  username: user
  password:
  socket: /tmp/mysql.sock

production:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: project_production
  pool: 5
  username: user
  password:
  socket: /tmp/mysql.sock
Community
  • 1
  • 1
Anthony To
  • 2,193
  • 2
  • 21
  • 29
  • 1
    This most probably means that you don't have a `staging` section in your `database.yml`, or if you do have one it's misconfigured. Including your `database.yml` would be pretty helpful. – Veraticus Sep 13 '13 at 19:34
  • I thought the same thing, but deployment to staging and prod were both working until I added `set :branch, "develop"`. I figured if staging was working correctly with the databse.yml as is then something else must be wrong – Anthony To Sep 13 '13 at 19:47

1 Answers1

0

The problem is you have no section for staging in your database.yml. Maybe you had one in the other branch and you removed it when you moved over? Either way, if you add one back in, it should eliminate this error message.

Veraticus
  • 15,944
  • 3
  • 41
  • 45
  • but if I take out `set :branch, "develop"` from staging.rb without touching database.yml, deployment to staging works again. doesn't that lead us to believe the issue doesn't lie with database.yml? Either way, I will put a staging section in the database file and update. – Anthony To Sep 13 '13 at 19:54
  • That probably means your `develop` branch has a different `database.yml`. – Veraticus Sep 13 '13 at 19:57
  • I verified that they definitely are the same. I personally branched develop off master – Anthony To Sep 13 '13 at 20:02