我试图使用capistrano 3将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但我有一个不同的错误:当前目录不存在.
我很迷茫。我的配置文件如下:
production.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, :latestCapfile
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
非常感谢。
发布于 2013-10-26 13:23:04
Capistrano无法为您创建数据库,current符号链接永远不会被创建,因为您没有完成部署。
您所看到的错误是因为数据库服务器上不存在数据库,它完全依赖于您的服务器(postgresql、mysql等),但是您需要进入数据库服务器并运行如下所示:
CREATE DATABASE myapp;
# Something else, too you'll need to GRANT permissions
# in the sql server for your production database user,
# or change the database ownership.那么您应该能够完成部署。
发布于 2016-07-03 12:23:48
在我的例子中,我试图在安装完成之前停止unicorn。在独角兽脚本中,我提到了current目录的路径,我从部署脚本中删除了这些行,并在安装完成后添加了这些行。
检查您的部署脚本是否有这样的情况。
https://stackoverflow.com/questions/19606123
复制相似问题