【问题标题】:Capistrano install directory problemCapistrano安装目录问题
【发布时间】:2010-02-09 11:17:04
【问题描述】:

我正在按照主人的指示进行我的第一次 Rails 部署并使用 capistrano:

我有域名 plantality.com。

我已经为我的应用创建了 gws 文件夹。

我已经安装了 capistrano,并按照我能找到的所有 wiki 说明进行操作。

public_html 指向 gws/public,但 capistano 已将我的应用安装到 gws/current

我已经仔细检查了我的 deploy.rb 路径是否正确。

我在 gws/public 和 public_html 之间创建了一个符号链接(我尝试在 gws/current/public 和 public_html 之间创建一个符号链接,但没有帮助。

如果有什么不同,我会尝试使用Passenger。

这是我的 deploy.rb:

set :user, 'plantali'
set :scm_username, 'solent'
set :scm_password, '<removed>'
set :svnserver, 'plantality.sourcerepo.com'
set :application, "gws"
set :repository, "http://#{svnserver}/plantality/gws/gws"
set :server, 'plantality.com'
set :applicationdir, 'gws'
set :use_sudo, false
set :keep_releases, 5
set :scm, :subversion

role :web, "plantality.com" # Your HTTP server, Apache/etc
role :app, "plantality.com" # This may be the same as your `Web` server
role :db, "plantality.com", :primary => true # This is where Rails migrations will run
#role :db, ""

set :deploy_to, "/home/#{user}/#{applicationdir}"
set :group_writeable, false

【问题讨论】:

  • 请注意,在上面的示例中,您不需要 :applicationdir 指令。 Capistrano 约定只使用:application,因为假设应用程序目录名称将与应用程序名称相同。

标签: ruby-on-rails deployment directory capistrano


【解决方案1】:

Capistrano 将发布部署到 releases 目录下的时间戳目录中,并创建一个名为 current 的符号链接,该链接指向最新发布目录中 Rails 应用程序的根目录。†

因此,您的应用程序的 Rails 根是/home/&lt;user&gt;/gws/current/,并且需要配置Passenger 以相应地从那里为应用程序提供服务。将Passenger正在使用的虚拟主机中的ApacheDocumentRoot设置为/home/&lt;user&gt;/gws/current/public并重启Passenger。

† 顺便说一句,这就是 Capistrano 可以轻松回滚错误版本的方式 - 它只是重新创建符号链接以指向以前的时间戳版本。

【讨论】:

  • 我正试图弄清楚如何在木偶和 capistrano 的情况下做到这一点。我希望 puppet 将 vhost 设置为指向 ..../current/public ,但这在 cap 部署之前不存在,这使 puppet 适合。有什么想法吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-10
  • 2011-09-30
  • 2011-02-19
相关资源
最近更新 更多