Permalink
Browse files

adding deploy script

  • Loading branch information...
1 parent 3360e90 commit 76d3d1a74bb28bf445bbff0e4d3fd6a120deb287 @ryanb committed Aug 22, 2009
Showing with 57 additions and 0 deletions.
  1. +3 −0 Capfile
  2. +54 −0 config/deploy.rb
View
@@ -0,0 +1,3 @@
+load 'deploy' if respond_to?(:namespace) # cap2 differentiator
+Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
+load 'config/deploy'
View
@@ -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.