我正在尝试使用capistrano 3将我的ruby on rails 4项目部署到我的服务器中,但出现了一些错误。
首先,当我这样做时
cap production deploy:check
一切看起来都不错!但是当我这样做时
cap production deploy
我有两个错误:
DEBUG [e3cf53e3] Running [ -L /var/www/myapp/releases/20131026111326/public/assets ] on mydomain.com
DEBUG [e3cf53e3] Command: [ -L /var/www/myapp/releases/20131026111326/public/assets ]
DEBUG [e3cf53e3] Finished in 0.104 seconds with exit status 1 (failed).
DEBUG [304388e5] Running [ -d /var/www/myapp/releases/20131026111326/public/assets ] on mydomain.com
DEBUG [304388e5] Command: [ -d /var/www/myapp/releases/20131026111326/public/assets ]
DEBUG [304388e5] Finished in 0.104 seconds with exit status 1 (failed).
我得到的最后一个错误是:
DEBUG [4e4c65ef] rake aborted!
DEBUG [4e4c65ef] Unknown database 'myapp_production'
所以我认为我应该做
cap production deploy:migrate
但我得到了一个不同的错误:当前目录不存在......
我很失落。我的配置文件是这些:
生产.rb
set :stage, :production
role :all, %w{myuser@mydomain.com}
server 'mydomain.com', user: 'myuser', roles: %w{web app db}
set :ssh_options, {
keys: %w(/path/mykey.pem),
forward_agent: true,
auth_methods: %w(publickey)
}
fetch(:default_env).merge!(rails_env: :production)
set :rvm_type, :user
set :rvm_ruby_version, 'ruby-2.0.0-p247'
set :rake, "rake"
set :rails_env, "production"
set :migrate_env, ""
set :migrate_target, :latest
头文件
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/rails'
require 'capistrano/rvm'
require 'capistrano/bundler'
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
我在 Gemfile 中使用 capistrano-bundler、capistrano-rvm 和 capistrano-rails
非常感谢。