Capistrano deploy file for Thin & NginX & SCM Git

지금 프로젝트에서 사용중인 Capistrano Deploy File.

잡다한 작업은 plugin에 맡기니 일이 확실히 줄어든다. Capistrano Bells Plugin 사용.

# pty setting
default_run_options[:pty] = true

# General configuration settiongs, required for all recipes!
set :application, "#{application_name}"
role :web, "#{webserver_domain}"
role :app, "#{appserver_domain}"
role :db, "#{dbserver_domain}", :primary => true

# User Setting
set :user, "production"

# Deployment Settings
set :repository, "#{repository_location}"
set :scm, :git
set :deploy_to, "#{deploy_location}"
set :deploy_via, :remote_cache
set :config_files, %w()

# Change this to :thin if you want to use Thin instead.
set :app_server, :thin

# =============================================================
# Application Server Settings (Thin or Mongrel)
# =============================================================
set :thin_servers, 3
set :thin_port, 7007
set :thin_environment, 'production'
set :thin_address, '127.0.0.1'
set :thin_conf, "#{shared_path}/config/thin.yml"

# =============================================================
# Nginx Settings
# =============================================================
set :nginx_sites_available, "/etc/nginx/sites-available"
set :nginx_sites_enabled, "/etc/nginx/sites-enabled"

after "deploy:update_code", "db:symlink"
after "db:symlink", "attachment:symlink"

namespace :db do
  desc "Make symlink for database yaml"
  task :symlink do
    run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
  end
end

namespace :attachment do
  desc "Make symlink for attachment directory"
  task :symlink do
    run "ln -nfs #{shared_path}/attachments/article_images #{release_path}/public/images/article_images"
  end
end

Posted by Kenny Thu, 24 Apr 2008 08:41:00 GMT