0

我目前在 Capistrano 中使用多级扩展来部署我的代码。我拥有的两个阶段是“生产”和“分期”。

现在我希望能够在 Git 中指定我的一个分支以用于在登台中进行部署。目前,prod 和 staging 都是从 master 部署的——但我想实现 Gitflow 并将我的开发分支用于我的 staging 环境。

我环顾四周,发现这是我的 staging.rb 文件中的答案:

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

但是一旦我包含这个并尝试运行cap staging deploy,我就会收到这个错误:

* 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

我看到这个问题:Thin / Capistrano cannot connect to database

但是当我查看我的任务时,它们看起来就像这样:

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

我不是设置这些环境的人,我对 Capistrano 也不是很熟悉,所以我不太确定这里发生了什么。

关于发生了什么的任何想法?

编辑:包括我的 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
4

1 回答 1

0

问题是您stagingdatabase.yml. 也许您在另一个分支中有一个,并且在您搬家时将其删除?无论哪种方式,如果您重新添加一个,它应该会消除此错误消息。

于 2013-09-13T19:49:49.240 回答