Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fiddling with a deploy to staging on the new box

  • Loading branch information...
commit 53ff63b9a02e3a45440866e6b40a8d3cbdd1af75 1 parent fc2f016
@tcopeland tcopeland authored
Showing with 54 additions and 0 deletions.
  1. +3 −0  Capfile
  2. +50 −0 config/deploy.rb
  3. +1 −0  config/deploy/staging.rb
View
3  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'
View
50 config/deploy.rb
@@ -0,0 +1,50 @@
+set :stages, %w(staging production)
+set :default_stage, "staging"
+
+require 'capistrano/ext/multistage'
+
+default_run_options[:pty] = true
+
+set :ssh_options, { :forward_agent => true }
+
+set :application, "gemcutter"
+set(:rails_env) { "#{stage}"}
+
+role :app, "rubycentral.org"
+role :web, "rubycentral.org"
+role :db, "rubycentral.org", :primary => true
+
+# Note that this requires you run 'ssh-add' on your workstation in order to
+# add your private key to the ssh agent. If that's not good for you, just uncomment the
+# "set :deploy_via, :copy" and comment "set :deploy_via, :remote_cache"
+set :scm, :git
+set :repository, "git@github.com:tcopeland/gemcutter.git"
+set :repository_cache, "git_cache"
+set :git_enable_submodules, 1
+set :deploy_via, :remote_cache
+set :git_shallow_clone, 1
+set :use_sudo, false
+
+set :group, "rubycentral"
+set :user, "tom"
+
+namespace :deploy do
+ 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
+
+ desc "Move in database.yml for this environment"
+ task :move_in_database_yml, :roles => :app do
+ run "cp #{deploy_to}/shared/system/database.yml #{current_path}/config/"
+ end
+end
+
+after "deploy", "deploy:migrate"
+after "deploy", "deploy:cleanup"
+after "deploy:symlink", "deploy:move_in_database_yml"
View
1  config/deploy/staging.rb
@@ -0,0 +1 @@
+set :deploy_to, "/var/www/rubycentral/staging.gemcutter.org/"
Please sign in to comment.
Something went wrong with that request. Please try again.