Skip to content

Instantly share code, notes, and snippets.

@minitau
Created April 19, 2009 10:03
Show Gist options
  • Save minitau/98001 to your computer and use it in GitHub Desktop.
Save minitau/98001 to your computer and use it in GitHub Desktop.
deploy for shinjiko
set :application, "shinjiko"
set :deploy_to, "/var/rails/#{application}"
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
set :use_sudo, false
set :scm_verbose, true
set :rails_env, "production"
set :user, "rails"
set :domain, "localhost"
server domain, :app, :web
role :db, domain, :primary => true
set :scm, :git
set :branch, "master"
set :repository, "ssh://localhost/home/kog/git/#{application}"
set :deploy_via, :remote_cache
task :change_url do
run "cd #{shared_path}/cached-copy; git config remote.origin.url ssh://localhost/home/kog/git/#{application}"
end
namespace :deploy do
desc "setup shared_path"
task :after_setup do
run "mkdir #{shared_path}/config"
upload
end
desc "upload"
task :upload do
top.upload "config/database.yml", "#{shared_path}/config/database.yml"
top.upload "config/shinjiko.yml", "#{shared_path}/config/shinjiko.yml"
end
desc "Symlink config files"
task :before_symlink do
run "rm #{release_path}/public/.htaccess" #not compatible with Passenger
run "ln -s #{shared_path}/config/database.yml #{release_path}/config/database.yml"
run "ln -s #{shared_path}/config/shinjiko.yml #{release_path}/config/shinjiko.yml"
end
# Restart passenger on deploy
desc "Restarting mod_rails with restart.txt"
task :restart, :roles => :app, :except => { :no_release => true } do
run "touch #{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
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment