Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Commit

Permalink
adding deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanb committed Aug 22, 2009
1 parent 3360e90 commit 76d3d1a
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Capfile
@@ -0,0 +1,3 @@
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy'
54 changes: 54 additions & 0 deletions config/deploy.rb
@@ -0,0 +1,54 @@
set :application, "dailystamp.r09.railsrumble.com"
role :app, application
role :web, application
role :db, application, :primary => true

set :user, "rbates"
set :deploy_to, "/var/apps/dailystamp"
set :deploy_via, :remote_cache
set :use_sudo, false
set :ssh_options, { :forward_agent => true }

set :scm, "git"
set :repository, "git@github.com:railsrumble/rr09-team-16.git"
set :branch, "master"

namespace :deploy do
desc "Tell Passenger to restart."
task :restart, :roles => :web do
run "touch #{deploy_to}/current/tmp/restart.txt"
end

desc "Do nothing on startup so we don't get a script/spin error."
task :start do
puts "You may need to restart Apache."
end

desc "Symlink extra configs and folders."
task :symlink_extras do
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
run "ln -nfs #{shared_path}/config/app_config.yml #{release_path}/config/app_config.yml"
run "ln -nfs #{shared_path}/db/production.sqlite3 #{release_path}/db/production.sqlite3"
run "ln -nfs #{shared_path}/assets #{release_path}/public/assets"
end

desc "Setup shared directory."
task :setup_shared do
run "mkdir #{shared_path}/assets"
run "mkdir #{shared_path}/config"
run "mkdir #{shared_path}/db"
run "mkdir #{shared_path}/db/sphinx"
put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
puts "Now edit the config files and fill assets folder in #{shared_path}."
end

desc "Update the crontab file"
task :update_crontab, :roles => :db do
run "cd #{release_path} && whenever --update-crontab #{application}"
end
end

after "deploy", "deploy:cleanup" # keeps only last 5 releases
after "deploy:setup", "deploy:setup_shared"
after "deploy:update_code", "deploy:symlink_extras"
# after "deploy:symlink", "deploy:update_crontab"

0 comments on commit 76d3d1a

Please sign in to comment.