部署 capistrano 关于 rails3 的问题

zyycode · 2013年01月19日 · 最后由 zyycode 回复于 2013年01月19日 · 2321 次阅读

我在用 cap deploy:cold 的时候报了以下错误 [out :: ...] find: /home/user/app/releases/20130119044833/public/images' ** [out :: ...] : No such file or directory ** [out :: ...] find:/home/user/app/releases/20130119044833/public/stylesheets' ** [out :: ...] : No such file or directory ** [out :: ...] find: `/home/user/app/releases/20130119044833/public/javascripts'

RAILS 3.2 的 ASSET 在 APP 文件夹里 怎么指定 capstrano 按照新版的 rails 来部署? 我用的 capistrano 是 rvm-capistrano (1.2.7) 还是说这个问题不会出现在 capistrano (2.14.1) 里? 但用原版 capistrano 的话会报 require 错误,不知道怎么解决。

lz 的头像不是台湾的主持人嘛,能不能把 deploy 脚本贴出来,大家好看看是哪里的问题

#1 楼 @geekontheway 哈哈哈 吴依洁嘛 一眼就被你认出来了

RVM

#$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) require "rvm/capistrano" set :rvm_ruby_string, 'default' set :rvm_type, :user

Bundler

require "bundler/capistrano"

Your Applications “Name”

set :application, "app_name"

The URL to your applications repository

set :repository, "." set :scm, :none set :deploy_via, :copy

Require subversion to do an export instead of a checkout.

set :checkout, 'export'

The user you are using to deploy with (This user should have SSH access to your server)

set :user, "user"

We want to deploy everything under your user, and we don’t want to use sudo

set :use_sudo, true

Where to deploy your application to.

set :deploy_to, "/var/www/#{application}"

——————————– Server Definitions ——————————–

Define the hostname of your server. If you have multiple servers for multiple purposes, we can define those below as well.

set :server_name, "domain.com"

We’re assuming you’re using a single server for your site, but if you have a seperate asset server or database server, you can specify that here.

role :app, server_name role :web, server_name role :db, server_name, :primary => true

——————————– Final Config ——————————–

This configuration option is helpful when using svn+ssh but doesn’t hurt anything to leave it enabled always.

default_run_options[:pty] = true namespace :deploy do task :restart do run "touch #{deploy_to}current/tmp/restart.txt" end task :start do run "cd #{deploy_to} && ln -s current/public public_html" run "touch #{deploy_to}current/tmp/restart.txt" end task :symlink do run "cd #{deploy_to} && rm current ; ln -s releases/#{release_name} current" run <<-CMD rm -rf #{latest_release}/log /home/#{user}/#{latest_release}/public/system #{latest_release}/tmp/pids && ln -s /home/#{user}#{shared_path}/log /home/#{user}#{latest_release}/log && ln -s /home/#{user}#{shared_path}/system /home/#{user}#{latest_release}/public/system && ln -s /home/#{user}#{shared_path}/pids /home/#{user}#{latest_release}/tmp/pids CMD end task :stop do run "rm #{deploy_to}public_html" end namespace :web do task :disable do run "cd #{deploy_to} && rm public_html && ln -s static_site public_html" end task :enable do run "cd #{deploy_to} && rm public_html && ln -s current/public public_html" end end end task :after_setup do run "rm -rf #{deploy_to}public_html" run "mkdir #{deploy_to}static_site" end

需要 登录 后方可回复, 如果你还没有账号请 注册新账号