了解此capistrano部署文件

时间:2017-11-09 04:11:50

标签: ruby-on-rails capistrano

我有一个config/deploy.rb文件,如下所示:

# require './config/boot'
# config valid only for Capistrano 3.2
lock '3.9.0'

set :application, 'arthousecoop'
set :repo_url, 'git@github.com:arthousecoop/arthousecoop.git'
set :ssh_options, {forward_agent: true}

set :deploy_to, '/home/sbp/rails'

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

# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }


namespace :deploy do
  # before :deploy, 'rvm1:install:gems'
  # before :deploy, 'deploy:check_revision'
  # after :finishing, 'deploy:cleanup'

  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      within release_path do
        execute :bundle, 'exec thin restart -C /etc/thin/sbp.yml'
      end
    end
  end

  after :publishing, :restart
  before :restart, 'rvm:hook'
  after :finished, 'airbrake:deploy'

  # 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

end
  1. linked_fileslinked_dirs部分的作用是什么?
  2. 文档说:

      

    :linked_files默认值:[]列出的文件将从中进行符号链接   应用程序的共享文件夹到每个版本目录期间   部署。可以用于持久化配置文件   database.yml的。请参阅结构以获取确切的目录。

    我真的不明白这意味着什么?符号链接是什么意思?

    1. on roles部分是什么意思? on方法有什么作用?

      task :restart do
      on roles(:app), in: :sequence, wait: 5 do
        within release_path do
          execute :bundle, 'exec thin restart -C /etc/thin/sbp.yml'
        end
      
    2. release_path Capistrano方法吗?

0 个答案:

没有答案