首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在部署rails项目时,Capistrano 3不创建“当前”目录

问在部署rails项目时,Capistrano 3不创建“当前”目录
EN

Stack Overflow用户
提问于 2013-10-26 11:26:10
回答 2查看 6K关注 0票数 3

我试图使用capistrano 3将rails 4项目部署到服务器上,但我遇到了一些错误。

首先,当我

代码语言:javascript
复制
cap production deploy:check

一切看起来都还好!但当我做的时候

代码语言:javascript
复制
cap production deploy

我有两个错误:

代码语言:javascript
复制
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).

最后一个错误是:

代码语言:javascript
复制
DEBUG [4e4c65ef]    rake aborted!
DEBUG [4e4c65ef]    Unknown database 'myapp_production'

所以我想我应该

代码语言:javascript
复制
cap production deploy:migrate

但我有一个不同的错误:当前目录不存在.

我很迷茫。我的配置文件如下:

production.rb

代码语言:javascript
复制
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

代码语言:javascript
复制
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

非常感谢。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-10-26 13:23:04

Capistrano无法为您创建数据库,current符号链接永远不会被创建,因为您没有完成部署。

您所看到的错误是因为数据库服务器上不存在数据库,它完全依赖于您的服务器(postgresql、mysql等),但是您需要进入数据库服务器并运行如下所示:

代码语言:javascript
复制
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.

那么您应该能够完成部署。

票数 5
EN

Stack Overflow用户

发布于 2016-07-03 12:23:48

在我的例子中,我试图在安装完成之前停止unicorn。在独角兽脚本中,我提到了current目录的路径,我从部署脚本中删除了这些行,并在安装完成后添加了这些行。

检查您的部署脚本是否有这样的情况。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19606123

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档