【问题标题】:Unable to run cap deploy:setup on ec2, the task `deploy:setup' does not exist无法在 ec2 上运行 cap deploy:setup,任务 `deploy:setup' 不存在
【发布时间】:2012-03-15 21:18:41
【问题描述】:

我已经安装了 ruby​​(使用 rvm)、phusion 乘客和所有或要求。

同样在 ec2 上,我在运行 $ ssh -T git@github.com 时收到成功消息

但是当我尝试运行 -> $cap deploy:setup 时,我收到一条错误消息 任务 `deploy:setup' 不存在

上限-vT

➜  bridge1 git:(master) cap -vT
cap bundle:install # Install the current Bundler environment.
cap deploy:restart # 
cap deploy:start   # 
cap deploy:stop    # 
cap invoke         # Invoke a single command on the remote servers.
cap shell          # Begin an interactive Capistrano session.

Extended help may be available for these tasks.
Type `cap -e taskname' to view it.

这是我的 deploy.rb

require 'bundler/capistrano'
#using  RVM!
$:.unshift("#{ENV["HOME"]}/.rvm/lib")
require "rvm/capistrano"
set :rvm_type, :user


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

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


default_run_options[:pty] =  true
set :repository,  "git@github.com:jaipratik/gibridge1.git"
set :scm, :git
set :branch, "master"


set :user, "ubuntu"            
set :use_sudo, false
set :admin_runner, "ubuntu"

set :rails_env, 'production'     
#set :use_sudo, false   #if error delete this


# If you are using Passenger mod_rails uncomment this:
namespace :deploy do
  task :start do ; end
  task :stop do ; end
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  end
end

宝石文件

source 'https://rubygems.org'

gem 'rails', '3.2.1'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer'

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
 gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'


group :test do
  # Pretty printed test output
  gem 'turn', :require => false
end


group :production do
  gem 'therubyracer'
end

【问题讨论】:

  • 你的 Capfile 里有什么?

标签: ruby-on-rails-3 amazon-ec2 capistrano


【解决方案1】:

转到您的应用程序目录并运行:

capify .

【讨论】:

【解决方案2】:

这只是发生在我身上,我错误地将命令输入到连接到 vps 服务器的终端窗口中并得到相同的错误:任务部署:更新不存在。

您需要在本地终端窗口中键入 cap 命令。

【讨论】:

    【解决方案3】:

    如果您已启用

    require 'capistrano/ext/multistage'
    

    在您的 deploy.rb 中,正确的命令是

    cap production deploy:setup
    

    【讨论】:

      【解决方案4】:

      Capify 确实像 user1524695 指出的那样工作,但它真正要找的是这条线

      load 'deploy'
      

      加载内置部署任务。如果您在标准位置运行标准 Capistrano 脚本(相对于您的工作目录设置 config/deploy.rb 和 Capfile),Capfile 将加载默认生成的 config/deploy.rb。如果您出于某种原因在任意位置运行脚本,只需将该行添加到脚本顶部,然后

      cap -f /path/to/myscript.rb deploy:setup
      

      应该按预期工作,即使该目录没有 Capified。

      【讨论】:

        【解决方案5】:

        特定文件夹的权限不对,chmod 700 帮助。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-02-22
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多