Skip to content
Browse files

Adding Capistrano recipe and yaml_db to migrate the database.

  • Loading branch information...
1 parent f2c6e91 commit a0fa19f5d94cb7df3ff98d44d2b62546bb36ea9e @andmej committed Oct 2, 2011
Showing with 81 additions and 0 deletions.
  1. +8 −0 Capfile
  2. +2 −0 Gemfile
  3. +17 −0 Gemfile.lock
  4. +54 −0 config/deploy.rb
View
8 Capfile
@@ -0,0 +1,8 @@
+load 'deploy' if respond_to?(:namespace) # cap2 differentiator
+
+# Uncomment if you are using Rails' asset pipeline
+# load 'deploy/assets'
+
+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
2 Gemfile
@@ -12,6 +12,8 @@ gem 'nested_form', :git => "git://github.com/ryanb/nested_form.git"
gem 'mechanize'
gem 'cancan'
gem 'foreman'
+gem 'capistrano'
+gem 'yaml_db'
# Gems used only for assets and not required
# in production environments by default.
View
17 Gemfile.lock
@@ -41,6 +41,12 @@ GEM
bcrypt-ruby (3.0.1)
builder (3.0.0)
cancan (1.6.5)
+ capistrano (2.8.0)
+ highline
+ net-scp (>= 1.0.0)
+ net-sftp (>= 2.0.0)
+ net-ssh (>= 2.0.14)
+ net-ssh-gateway (>= 1.1.0)
coffee-rails (3.1.1)
coffee-script (>= 2.2.0)
railties (~> 3.1.0)
@@ -54,6 +60,7 @@ GEM
foreman (0.22.0)
term-ansicolor (~> 1.0.5)
thor (>= 0.13.6)
+ highline (1.6.2)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.14)
@@ -75,6 +82,13 @@ GEM
multi_json (1.0.3)
net-http-digest_auth (1.1.1)
net-http-persistent (1.9)
+ net-scp (1.0.4)
+ net-ssh (>= 1.99.1)
+ net-sftp (2.0.5)
+ net-ssh (>= 2.0.9)
+ net-ssh (2.2.1)
+ net-ssh-gateway (1.1.0)
+ net-ssh (>= 1.99.1)
nifty-generators (0.4.6)
nokogiri (1.5.0)
polyglot (0.3.2)
@@ -130,12 +144,14 @@ GEM
multi_json (>= 1.0.2)
webrobots (0.0.11)
nokogiri (>= 1.4.4)
+ yaml_db (0.2.1)
PLATFORMS
ruby
DEPENDENCIES
cancan
+ capistrano
coffee-rails (~> 3.1.0)
foreman
jquery-rails
@@ -148,3 +164,4 @@ DEPENDENCIES
sqlite3
turn
uglifier
+ yaml_db
View
54 config/deploy.rb
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+
+set :application, "contests"
+role :app, "69.164.213.254"
+role :web, "69.164.213.254"
+role :db, "69.164.213.254", :primary => true
+
+set :user, "rails"
+set :deploy_to, "/home/#{user}/#{application}"
+set :deploy_via, :remote_cache
+set :use_sudo, false
+set :keep_releases, 30
+
+
+set :scm, "git"
+set :repository, "git@github.com:andmej/andr.esmejia.git"
+set :branch, "rails3"
+
+require 'bundler/capistrano'
+
+# RVM stuff
+set :rvm_ruby_string, '1.9.2-p290'
+set :rvm_type, :user
+$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
+require "rvm/capistrano" # Load RVM's capistrano plugin.
+
+
+#########################################################
+
+namespace :deploy do
+ desc "Tell Passenger to restart."
+ task :restart, :roles => :web do
+ run "touch #{current_path}/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 Nginx."
+ end
+
+ desc "Symlink extra configs and folders."
+ task :symlink_extras do
+ run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
+ end
+end
+
+namespace :db do
+ desc "Migrates the production database."
+ task :migrate do
+ run "cd #{current_path} && rake RAILS_ENV=production db:migrate"
+ end
+end
+
+after "deploy:update_code", "deploy:symlink_extras"

0 comments on commit a0fa19f

Please sign in to comment.
Something went wrong with that request. Please try again.