-
-
Save allenfantasy/7288560 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/capistrano" | |
set :application, "blog" | |
set :repository, "git@github.com:happypeter/blog.git" | |
set :scm, :git | |
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` | |
set :user, "deployer" | |
set :deploy_to, "/home/#{user}/#{application}" | |
set :deploy_via, :remote_cache | |
set :use_sudo, true | |
set :branch, "master" | |
default_run_options[:pty] = true | |
server "billie.happyec.org", :web, :app, :db, :primary => true | |
namespace :deploy do | |
%w[start stop restart].each do |command| | |
desc "#{command} unicorn server" | |
task command, :roles => :app, except: {no_release: true} do | |
run "/etc/init.d/unicorn_#{application} #{command}" | |
end | |
end | |
desc "things I need to do after deploy:setup" | |
task :setup_config, :roles => :app do | |
run "#{try_sudo} ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}" | |
run "#{try_sudo} ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}" | |
run "mkdir -p #{shared_path}/config" | |
put File.read("config/database.yml.example"), "#{shared_path}/config/database.yml" | |
puts "Now edit the config files in #{shared_path}. create db" | |
end | |
after "deploy:setup", "deploy:setup_config" | |
task :symlink_config, :roles => :app do | |
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml" | |
end | |
after "deploy:finalize_update", "deploy:symlink_config" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment