Skip to content
Browse files

ready to deploy"

  • Loading branch information...
1 parent d4a717e commit 1da4b44cf889bdde03f744c194f48787a4f8a546 @paulanthonywilson paulanthonywilson committed
Showing with 88 additions and 4 deletions.
  1. +5 −0 Capfile
  2. +1 −0 Gemfile
  3. +15 −0 Gemfile.lock
  4. +6 −4 config/database.yml
  5. +61 −0 config/deploy.rb
View
5 Capfile
@@ -0,0 +1,5 @@
+load 'deploy'
+# 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
1 Gemfile
@@ -28,6 +28,7 @@ group :test, :development do
gem 'shoulda'
gem 'factory_girl_rails'
gem 'test-unit'
+ gem 'capistrano'
end
gem 'jquery-rails'
View
15 Gemfile.lock
@@ -32,6 +32,12 @@ GEM
multi_json (~> 1.0)
arel (3.0.2)
builder (3.0.0)
+ capistrano (2.11.2)
+ 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.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
@@ -48,6 +54,7 @@ GEM
factory_girl (~> 2.3.0)
railties (>= 3.0.0)
flexmock (0.9.0)
+ highline (1.6.11)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.3)
@@ -61,6 +68,13 @@ GEM
treetop (~> 1.4.8)
mime-types (1.17.2)
multi_json (1.1.0)
+ net-scp (1.0.4)
+ net-ssh (>= 1.99.1)
+ net-sftp (2.0.5)
+ net-ssh (>= 2.0.9)
+ net-ssh (2.3.0)
+ net-ssh-gateway (1.1.0)
+ net-ssh (>= 1.99.1)
oauth (0.4.5)
polyglot (0.3.3)
rack (1.4.1)
@@ -124,6 +138,7 @@ PLATFORMS
DEPENDENCIES
aasm
+ capistrano
coffee-rails (~> 3.2.1)
factory_girl_rails
flexmock
View
10 config/database.yml
@@ -17,9 +17,11 @@ test:
database: db/test.sqlite3
pool: 5
timeout: 5000
-
production:
- adapter: sqlite3
- database: db/production.sqlite3
+ adapter: postgresql
+ encoding: unicode
+ database: src_cfp2012
pool: 5
- timeout: 5000
+ username: submissions
+ password: b1gp4ws
+
View
61 config/deploy.rb
@@ -0,0 +1,61 @@
+require "bundler/capistrano"
+load 'deploy/assets'
+
+set :application, "submission_review2"
+set :repository, "git@github.com:scotlandonrails/submission_review2.git"
+set :use_sudo, false
+set :user, 'ubuntu'
+ssh_options[:forward_agent] = true
+set :deploy_to, "/home/#{user}/apps/#{application}"
+
+set :scm, :git
+# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
+
+role :web, "submissionreview2.scottishrubyconference.com"
+role :app, "submissionreview2.scottishrubyconference.com"
+role :db, "submissionreview2.scottishrubyconference.com", :primary=>true
+
+default_environment["PATH"] = "/home/ubuntu/.rvm/gems/ruby-1.9.3-p0/bin:/home/ubuntu/.rvm/gems/ruby-1.9.3-p0@global/bin:/home/ubuntu/.rvm/rubies/ruby-1.9.3-p0/bin:/home/ubuntu/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
+default_environment["GEM_HOME"] = "/home/ubuntu/.rvm/gems/ruby-1.9.3-p0"
+default_environment["GEM_PATH"] = "/home/ubuntu/.rvm/gems/ruby-1.9.3-p0:/home/ubuntu/.rvm/gems/ruby-1.9.3-p0@global"
+default_environment["RUBY_VERSION"] = "1.9.3p0"
+
+default_run_options[:shell] = 'bash'
+
+
+set :rails_env, :production
+set :unicorn_binary, "bundle exec unicorn_rails"
+set :unicorn_config, "#{current_path}/config/unicorn.rb"
+set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.submission_review2.pid"
+
+
+namespace :unicorn do
+ task :start, :roles => :app, :except => { :no_release => true } do
+ run "cd #{current_path} && #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
+ end
+ task :stop, :roles => :app, :except => { :no_release => true } do
+ run "kill `cat #{unicorn_pid}`"
+ end
+ task :graceful_stop, :roles => :app, :except => { :no_release => true } do
+ run "kill -s QUIT `cat #{unicorn_pid}`"
+ end
+ task :reload, :roles => :app, :except => { :no_release => true } do
+ run "kill -s USR2 `cat #{unicorn_pid}`"
+ end
+ task :restart, :roles => :app, :except => { :no_release => true } do
+ if remote_file_exists?(unicorn_pid)
+ stop
+ end
+ start
+ end
+end
+
+after 'deploy', 'unicorn:restart'
+
+task :configlink do
+ run "cd #{current_path}/config && rm database.yml && ln -s #{shared_path}/database.yml"
+end
+
+def remote_file_exists?(full_path)
+ 'true' == capture("if [ -e #{full_path} ]; then echo 'true'; fi").strip
+end

0 comments on commit 1da4b44

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