我目前正在使用Capistrano中的多级扩展来部署我的代码。我所拥有的两个阶段是“生产”和“分期”。
现在我希望能够在Git中指定我的一个分支用于在staging中进行部署。目前,prod和staging都是从master下部署的 - 但是我想实现Gitflow并将我的develop分支用于我的暂存环境。
我环顾四周,发现这是我的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
答案 0 :(得分:0)
问题是您的staging
中没有database.yml
部分。也许你在另一个分支中有一个,当你移动时你删除了它?无论哪种方式,如果您重新添加一个,它应该消除此错误消息。