【发布时间】:2011-12-13 12:19:13
【问题描述】:
我有一个 Rails 应用程序,我想用 apache、passenger 和 capistrano 部署它。
应用程序在/var/www/myapp/。
在我的http.conf 文件中,我添加了这个块:
<VirtualHost *:80>
ServerName myapp.mydomain.co.uk
DocumentRoot /var/www/myapp/current/public
<Directory /var/www/myapp/public>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
我的/etc/hosts 文件包含 4 行。前 3 行已经存在,我为我的 rails 应用程序添加了第 4 行。
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
130.88.111.33 mydomain.ac.uk ngrl
127.0.0.1 myapp.mydomain.co.uk
我的deploy.rb 文件如下所示:
set :user, 'me'
set :domain, 'mydomain.co.uk'
set :application, 'myapp'
set :repository, "me@mydomain.co.uk:git/myapp.git"
set :deploy_to, "/var/www/myapp"
set :normalize_asset_timestamps, false
role :app, domain
role :web, domain
role :db, domain, :primary => true
default_run_options[:pty] = true
set :deploy_via, :remote_cache
set :scm, 'git'
set :branch, 'master'
set :scm_verbose, true
set :use_sudo, false
namespace :deploy do
desc "cause Passenger to initiate a restart"
task :restart do
run "touch #{File.join(current_path, 'tmp','restart.txt')}"
end
desc "reload the database with seed data"
task :seed do
run "cd #{current_path}; rake db:seed RAILS_ENV=production"
end
end
after "deploy:update_code", :bundle_install
desc "install the necessary prereqisites"
task :bundle_install, :roles => :app do
run "cd #{release_path} && bundle install"
end
我跑了cap deploy:setup、cap deploy:check 和cap deploy:migrations。一切似乎都很好。 Capistrano 不会吐出任何错误。它创建一个新的发布目录,创建restart.txt 文件。但是如果我尝试在浏览器中打开myapp.mydomain.co.uk,它就无法打开它。日志文件为空。
有什么想法可能会出错吗?
【问题讨论】:
标签: ruby-on-rails apache capistrano passenger