Created
November 28, 2013 22:04
-
-
Save klebershimabuku/7698702 to your computer and use it in GitHub Desktop.
Capistrano receipt to deploy a rails application to DigitalOcean's host. This is a working receipt for:
* capistrano 2.15.4
* capistrano-ext 1.2.1
* rvm-capistrano 1.4.4
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 'rvm/capistrano' | |
require 'bundler/capistrano' | |
set :normalize_asset_timestamps, false | |
set :application, "app_name" | |
set :repository, "git@github.com:username/repository.git" | |
set :branch, 'master' | |
set :scm_password, 'yourpassword' | |
set :user, 'your_user' | |
set :use_sudo, false | |
set :rails_env, 'production' | |
set :rvm_ruby_string, '2.0.0' | |
set :deploy_to, "/var/www/yourdomain" | |
role :app, 'yourdomain.com' | |
role :web, 'yourdomain.com' | |
role :db, 'yourdomain.com', :primary => true | |
task :create_database_symlink do | |
run "rm -rf #{release_path}/config/environments/production.rb" | |
run "ln -s /home/#{user}/production.rb #{release_path}/config/environments/production.rb" | |
run "rm -r #{release_path}/config/database.yml" | |
run "ln -s /home/#{user}/database.yml #{release_path}/config/database.yml" | |
end | |
after "deploy:restart", "deploy:cleanup" | |
after "deploy:update_code", :create_database_symlink | |
after "deploy", "deploy:migrate" | |
ssh_options[:forward_agent] = true | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment