Permalink
Browse files

use cap to deploy blumine

  • Loading branch information...
daqing committed Apr 30, 2011
1 parent 5a646b8 commit 3e9dc48322ad380d2ccd08a255e44614ed25e745
Showing with 72 additions and 0 deletions.
  1. +4 −0 Capfile
  2. +1 −0 Gemfile
  3. +15 −0 Gemfile.lock
  4. +52 −0 config/deploy.rb
View
@@ -0,0 +1,4 @@
+load 'deploy' if respond_to?(:namespace) # cap2 differentiator
+Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
+
+load 'config/deploy' # remove this line to skip loading any of the default tasks
View
@@ -15,6 +15,7 @@ gem 'acts_as_list'
gem 'carrierwave'
gem 'rmmseg-cpp'
gem 'ferret'
+gem 'capistrano'
# Use unicorn as the web server
# gem 'unicorn'
View
@@ -37,13 +37,20 @@ GEM
breadcrumbs (0.1.6)
i18n
builder (2.1.2)
+ capistrano (2.5.21)
+ highline
+ net-scp (>= 1.0.0)
+ net-sftp (>= 2.0.0)
+ net-ssh (>= 2.0.14)
+ net-ssh-gateway (>= 1.0.0)
carrierwave (0.5.3)
activesupport (~> 3.0)
columnize (0.3.2)
erubis (2.6.6)
abstract (>= 1.0.0)
ferret (0.11.6)
rake (> 0.0.0)
+ highline (1.6.1)
i18n (0.5.0)
jquery-rails (0.2.7)
rails (~> 3.0)
@@ -55,6 +62,13 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
+ net-scp (1.0.4)
+ net-ssh (>= 1.99.1)
+ net-sftp (2.0.5)
+ net-ssh (>= 2.0.9)
+ net-ssh (2.1.4)
+ net-ssh-gateway (1.0.1)
+ net-ssh (>= 1.99.1)
polyglot (0.3.1)
rack (1.2.2)
rack-mount (0.6.14)
@@ -98,6 +112,7 @@ DEPENDENCIES
annotate-models
authlogic
breadcrumbs
+ capistrano
carrierwave
ferret
jquery-rails (>= 0.2.6)
View
@@ -0,0 +1,52 @@
+ssh_options[:username] = 'ubuntu'
+ssh_options[:keys] = [File.join(ENV['HOME'], '.ec2', 'gsg-keypair.pem')]
+
+set :application, "blumine"
+set :repository, "git://github.com/daqing/blumine.git"
+
+set :scm, :git
+# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
+
+role :web, "blumine.forkgeek.com"
+role :app, "blumine.forkgeek.com" # This may be the same as your `Web` server
+role :db, "blumine.forkgeek.com", :primary => true # This is where Rails migrations will run
+role :db, "blumine.forkgeek.com"
+
+# if you're still using the script/reaper helper you will need
+# these http://github.com/rails/irs_process_scripts
+
+# If you are using Passenger mod_rails uncomment this:
+# namespace :deploy do
+# task :start do ; end
+# task :stop do ; end
+# task :restart, :roles => :app, :except => { :no_release => true } do
+# run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
+# end
+# end
+
+desc "Echo the server's hostname"
+task :echo, :roles => :web do
+ run "echo `hostname`"
+end
+
+namespace :blumine do
+ desc "update code from git repo"
+ after :update_code, :restart_thin, :restart_nginx
+ task :update_code do
+ run "cd ~/repo/blumine && git pull"
+ end
+
+ desc "restart thin"
+ task :restart_thin do
+ run "sudo /etc/init.d/thin restart"
+ end
+
+ desc "restart nginx"
+ task :restart_nginx do
+ run "sudo /usr/local/nginx/sbin/nginx -s reload"
+ end
+end
+
+after "blumine:update_code", "blumine:restart_thin", "blumine:restart_nginx"
+
+

0 comments on commit 3e9dc48

Please sign in to comment.