Ruby on rails Capistrano 3不';t创建';当前';部署rails项目时的目录
我正试图使用Capistrano3将我的RubyonRails4项目部署到我的服务器上,但是我遇到了一些错误 首先,当我这样做的时候Ruby on rails Capistrano 3不';t创建';当前';部署rails项目时的目录,ruby-on-rails,ruby-on-rails-4,capistrano,Ruby On Rails,Ruby On Rails 4,Capistrano,我正试图使用Capistrano3将我的RubyonRails4项目部署到我的服务器上,但是我遇到了一些错误 首先,当我这样做的时候 cap production deploy:check cap production deploy 一切看起来都很好!但当我这么做的时候 cap production deploy:check cap production deploy 我有两个错误: DEBUG [e3cf53e3] Running [ -L /var/www/myapp/release
cap production deploy:check
cap production deploy
一切看起来都很好!但当我这么做的时候
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, :latest
Capfile
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
非常感谢。Capistrano无法为您创建数据库,当前的符号链接从未被创建,因为您没有完成部署 您看到的错误是因为数据库服务器上不存在该数据库,它完全取决于您的服务器(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.
然后您应该能够完成部署。在我的情况下,我试图在安装完成之前停止独角兽。在unicorn脚本中,我提到了
current
目录的路径,我从部署脚本中删除了这些行,并在安装完成后重新添加
检查部署脚本是否存在此类情况