简体   繁体   English

如何在Rails4中使用Capistrano

[英]How to use capistrano in Rails4

I am using rails 4 and capistrano gem 'capistrano','~> 3.0.0' and 'capistrano-rails','~> 1.1.0' 我正在使用rails 4和capistrano gem'capistrano','〜> 3.0.0'和'capistrano-rails','〜> 1.1.0'

I am getting a problem when I am running cap staging deploy:setup --trace 我在运行cap登载deploy:setup --trace时遇到问题

Error: ** Invoke staging (first_time) ** Execute staging ** Invoke load:defaults (first_time) ** Execute load:defaults capistrano/ext/multistage requires Capistrano 2 错误:**调用登台(first_time)**执行登台**调用加载:默认值(first_time)**执行加载:默认值capistrano / ext / multistage需要Capistrano 2

I have already included 'require capistrano/ext/multistage' in deploy.rb file 我已经在deploy.rb文件中包含了“ require capistrano / ext / multistage”

deploy.rb file deploy.rb文件


 #require "bundler/capistrano"
 require 'capistrano/ext/multistage'

 set :application, 'management.zisoo.nl'
 # ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }

 # set :deploy_to, '/var/www/my_app'
 set :scm, :git
 set :repo_url, 'https://brails@bitbucket.org/johnmuller/motoronderdelen.nl.git'
 set :stages, %w(production staging dev)
 set :default_stage, "staging"

 #set :user, "server-user-name"

 # set :format, :pretty
 # set :log_level, :debug
 # set :pty, true

 # set :linked_files, %w{config/database.yml}
 # set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle
   public/system}

 # set :default_env, { path: "/opt/ruby/bin:$PATH" }
 # set :keep_releases, 5

 namespace :deploy do

   desc 'Restart application'
   task :restart do
     on roles(:app), in: :sequence, wait: 5 do
     # Your restart mechanism here, for example:
     # execute :touch, release_path.join('tmp/restart.txt')
   end
 end

  after :restart, :clear_cache do
    on roles(:web), in: :groups, limit: 3, wait: 10 do
      # Here we can do anything such as:
      # within release_path do
      #   execute :rake, 'cache:clear'
    # end
   end
 end

 after :finishing, 'deploy:cleanup'

end 结束

由于capistrano-rails依赖性问题,您需要在Gemfile指定Capistrano的版本2,例如:

gem 'capistrano', '~> 2.15'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM