Skip to content

Instantly share code, notes, and snippets.

@davidpdrsn
Created May 15, 2014 07:49
Show Gist options
  • Save davidpdrsn/10e94fb4288996e35933 to your computer and use it in GitHub Desktop.
Save davidpdrsn/10e94fb4288996e35933 to your computer and use it in GitHub Desktop.
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
# Uncomment if you are using Rails' asset pipeline
# load 'deploy/assets'
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
# Make bundler work
require "bundler/capistrano"
set :stages, %w(staging production)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
set :application, "tuborg-cms"
set :user, "deploy"
set :port, 8022
set :scm, "git"
set :repository, "ssh://[email protected]/HTML24DK/wdp_tuborg-cms.git"
set :branch, "master"
set :deploy_via, :remote_cache
# Ensure gems are loaded
set :default_environment, {
'PATH' => "/var/lib/gems/1.9.1/bin/:$PATH"
}
# Must be set for the password prompt from git to work
default_run_options[:pty] = true
# Deploy user settings
set :runner, user
set :use_sudo, false
after "deploy", "deploy:cleanup"
# Tasks
# Don't use this anymore, production content is online
# task :empty_and_reset_prod_db_and_files, :roles => :db do
# run "rm -rf #{current_release}/public/attachments/production;"
# run "cd #{current_release}; rake RAILS_ENV=production db:reset"
# end
namespace :deploy do
desc "Restarting mod_rails with restart.txt"
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{File.join(current_path, 'tmp', 'restart.txt')}"
end
[:start, :stop].each do |t|
desc "#{t} task is a no-op with mod_rails"
task t, :roles => :app do ; end
end
desc "Symlink directories"
task :finalize_update, :roles => :app do
run "ln -s #{shared_path}/database.yml #{current_release}/config/database.yml"
run "ln -s #{shared_path}/tmp #{current_release}/tmp"
run "ln -s #{shared_path}/log #{current_release}/log"
run "ln -s #{shared_path}/attachments #{current_release}/public/attachments"
end
end
server "tuborg.dk", :app, :web, :db, :primary => true
set :deploy_to, "/var/www/tuborg-cms"
server "staging.tuborg.hvadhedderde.com", :app, :web, :db, :primary => true
set :deploy_to, "/var/www/tuborg-cms-staging"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment