Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

deploy via capistrano!

  • Loading branch information...
commit c35a0af2315b74b18538aa7ebbe1c2eb8b746e61 1 parent 8dc904f
@dwradcliffe dwradcliffe authored
View
5 Capfile
@@ -1,4 +1,3 @@
-load 'deploy' if respond_to?(:namespace) # cap2 differentiator
-Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
-Dir['lib/deploy/*.rb'].each { |r| load(r) }
+load 'deploy'
+# load 'deploy/assets' # uncomment this once we move to the asset pipeline
load 'config/deploy'
View
1  Gemfile
@@ -37,6 +37,7 @@ gem 'yajl-ruby', :require => 'yajl'
#gem 'heroku_asset_cacher', :git => "git@github.com/qrush/heroku_asset_cacher"
group :development do
+ gem 'capistrano', '~> 2.0'
gem 'rails-erd'
gem 'pry'
end
View
11 Gemfile.lock
@@ -38,6 +38,12 @@ GEM
i18n (>= 0.5.0)
state_machine (~> 1.1)
builder (3.0.4)
+ capistrano (2.15.5)
+ highline
+ net-scp (>= 1.0.0)
+ net-sftp (>= 2.0.0)
+ net-ssh (>= 2.0.14)
+ net-ssh-gateway (>= 1.1.0)
capybara (2.2.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
@@ -133,7 +139,11 @@ GEM
multipart-post (1.2.0)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
+ net-sftp (2.1.2)
+ net-ssh (>= 2.6.5)
net-ssh (2.7.0)
+ net-ssh-gateway (1.2.0)
+ net-ssh (>= 2.6.5)
newrelic-redis (1.4.0)
newrelic_rpm (~> 3.0)
redis (< 4.0)
@@ -237,6 +247,7 @@ PLATFORMS
DEPENDENCIES
bluepill
builder
+ capistrano (~> 2.0)
capybara
clearance (~> 1.1)
cucumber-rails
View
41 config/deploy.rb
@@ -1,34 +1,43 @@
-set :stages, %w(staging production)
+set :stages, %w(vagrant staging production)
set :default_stage, "staging"
require 'capistrano/ext/multistage'
require 'bundler/capistrano'
-require 'rvm/capistrano'
-
-set :rvm_ruby_string, '1.9.3-p0'
default_run_options[:pty] = true
set :ssh_options, { :forward_agent => true }
-set :application, "gemcutter"
+set :application, "rubygems"
set(:rails_env) { "#{stage}"}
-
-# 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 :deploy_to, "/applications/rubygems"
+set :bundle_cmd, "/usr/local/bin/bundle"
set :scm, :git
-set :repository, "git://github.com/rubygems/rubygems.org"
+set :repository, "https://github.com/rubygems/rubygems.org.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, "rubycentral"
+set :group, "deploy"
after "deploy", "deploy:migrate"
-after "deploy:update", "bluepill:quit", "bluepill:start"
after "deploy", "deploy:cleanup"
after "deploy:create_symlink", "deploy:move_in_database_yml", "deploy:move_in_secret_settings"
-before "bundle:install", "deploy:set_config_for_pg_gem"
-require './config/boot'
+namespace :deploy do
+
+ desc "Move in database.yml for this environment"
+ task :move_in_database_yml, :roles => :app do
+ run "cp #{deploy_to}/shared/database.yml #{current_path}/config/"
+ end
+
+ desc "Move in secret settings for this environment"
+ task :move_in_secret_settings, :roles => :app do
+ run "cp #{deploy_to}/shared/secret.rb #{current_path}/config/secret.rb"
+ end
+
+ desc "Restart unicorn and delayed_job"
+ task :restart, :roles => :restart do
+ sudo "service unicorn restart"
+ sudo "service delayed_job restart"
+ end
+
+end
View
9 config/deploy/production.rb
@@ -1,6 +1,3 @@
-role :app, "b1.rubygems.org"
-role :web, "b1.rubygems.org"
-role :db, "b1.rubygems.org", :primary => true
-
-set :branch, "production"
-set :deploy_to, "/var/www/rubycentral/gemcutter.org/"
+server 'deploy@app02-aws.rubygems.org', :app, :db, :primary => true
+role :restart, 'app02-aws.rubygems.org', :no_release => true
+set :branch, 'master'
View
23 config/deploy/staging.rb
@@ -1,15 +1,12 @@
-role :app, "staging.gemcutter.org"
-role :web, "staging.gemcutter.org"
-role :db, "staging.gemcutter.org", :primary => true
+raise "No staging server setup yet!"
+# server ".us-west-2.compute.amazonaws.com", :app, :db, :primary => true
+# set :branch, "staging"
-set :branch, "staging"
-set :deploy_to, "/var/www/rubycentral/staging.gemcutter.org/"
+# namespace :deploy do
+# desc "For the staging environment, move in a robots.txt that blocks robots from the entire site"
+# task :move_in_staging_robots_txt, :roles => :app do
+# run "cp #{deploy_to}/shared/config/robots.txt #{current_path}/public/robots.txt"
+# end
+# end
-namespace :deploy do
- desc "For the staging environment, move in a robots.txt that blocks robots from the entire site"
- task :move_in_staging_robots_txt, :roles => :app do
- run "cp #{deploy_to}/shared/config/robots.txt #{current_path}/public/robots.txt"
- end
-end
-
-after "deploy:symlink", "deploy:move_in_staging_robots_txt"
+# after "deploy:symlink", "deploy:move_in_staging_robots_txt"
View
2  config/deploy/vagrant.rb
@@ -0,0 +1,2 @@
+server '33.33.33.10', :app, :db, :primary => true
+set :branch, 'master'
View
20 lib/deploy/bluepill.rb
@@ -1,20 +0,0 @@
-namespace :bluepill do
- set(:bluepill_options) { "--no-privileged -c /tmp/bluepill" }
-
- desc "Stop processes that bluepill is monitoring and quit bluepill"
- task :quit, :roles => [:app] do
- run "bluepill stop #{bluepill_options}; true"
- run "bluepill quit #{bluepill_options}; true"
- end
-
- desc "Load bluepill configuration and start it"
- task :start, :roles => [:app] do
- run "bluepill load #{release_path}/config/pills/#{rails_env}.rb #{bluepill_options}"
- end
-
- desc "Prints bluepills monitored processes statuses"
- task :status, :roles => [:app] do
- run "bluepill status #{bluepill_options}"
- end
-end
-
View
31 lib/deploy/misc.rb
@@ -1,31 +0,0 @@
-namespace :deploy do
- desc "Move in database.yml for this environment"
- task :move_in_database_yml, :roles => :app do
- run "cp #{deploy_to}/shared/config/database.yml #{current_path}/config/"
- end
-
- desc "Move in secret settings for this environment"
- task :move_in_secret_settings, :roles => :app do
- run "cp #{deploy_to}/shared/config/secret.rb #{current_path}/config/secret.rb"
- run "cp #{deploy_to}/shared/config/newrelic.yml #{current_path}/config/newrelic.yml"
- end
-
- task :set_config_for_pg_gem, :roles => [:app, :db] do
- run "cd #{current_path} && bundle config build.pg --with-pg-config=/usr/local/pgsql/bin/pg_config --no-rdoc --no-ri"
- end
-
-end
-
-namespace :maintenance do
- desc "Go to maintenance mode"
- task :on, :roles => :app do
- run "touch #{current_path}/tmp/maintenance_mode"
- deploy.restart
- end
- desc "Back to normal non-maintenance mode"
- task :off, :roles => :app do
- run "rm -f #{current_path}/tmp/maintenance_mode"
- deploy.restart
- end
-end
-
View
11 lib/deploy/passenger.rb
@@ -1,11 +0,0 @@
-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
-end
View
BIN  vendor/cache/capistrano-2.15.5.gem
Binary file not shown
View
BIN  vendor/cache/net-sftp-2.1.2.gem
Binary file not shown
View
BIN  vendor/cache/net-ssh-gateway-1.2.0.gem
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.