From 74dbdc24e3a3db9470d4219eab19c27881748c90 Mon Sep 17 00:00:00 2001 From: Tyler Mercier Date: Thu, 25 Jul 2013 16:46:52 -0600 Subject: run db migrations by default --- config/deploy.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/deploy.rb b/config/deploy.rb index 33876a1..51d6aee 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -25,6 +25,7 @@ set :repository, "git@github.com:madebyuppercut/parley.git" default_run_options[:pty] = true # password prompt ssh_options[:forward_agent] = true # no deploy key for github +after "deploy:update_code", "deploy:migrate" after "deploy", "deploy:cleanup" # keep only the last 5 releases # Instructions -- cgit v1.2.3 From c48137d5377f5fe052a1e5c8f4e521110e5e1968 Mon Sep 17 00:00:00 2001 From: Tyler Mercier Date: Fri, 26 Jul 2013 09:13:15 -0600 Subject: switch to copy deployments. add environment config receipe. add qa environment --- config/deploy.rb | 18 ++++++------------ config/deploy/mo.rb | 9 +-------- config/deploy/prod.rb | 8 ++++++++ config/deploy/production.rb | 8 -------- config/deploy/qa.rb | 1 + config/recipes/environments.rb | 5 +++++ 6 files changed, 21 insertions(+), 28 deletions(-) create mode 100644 config/deploy/prod.rb delete mode 100644 config/deploy/production.rb create mode 100644 config/deploy/qa.rb create mode 100644 config/recipes/environments.rb diff --git a/config/deploy.rb b/config/deploy.rb index 51d6aee..d366501 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,29 +1,23 @@ require "bundler/capistrano" -set :stages, %w(production mo) # this needs to be set before 'capistrano/ext/multistage' is required in -set :default_stage, "production" # this needs to be set before 'capistrano/ext/multistage' is required in -require 'capistrano/ext/multistage' +load "config/recipes/environments" load "config/recipes/base" load "config/recipes/nginx" load "config/recipes/unicorn" load "config/recipes/postgresql" load "config/recipes/nodejs" load "config/recipes/rbenv" -load "config/recipes/check" load "config/recipes/newrelic" set :application, "parley" set :user, "deployer" -set :deploy_to, "/home/#{user}/apps/#{application}" -set :deploy_via, :remote_cache # keeps git repo on server cache set :use_sudo, false - -set :scm, "git" -set :branch, "master" -set :repository, "git@github.com:madebyuppercut/parley.git" - default_run_options[:pty] = true # password prompt -ssh_options[:forward_agent] = true # no deploy key for github + +set :scm, :none +set :repository, "." +set :deploy_via, :copy +set :deploy_to, "/home/#{user}/apps/#{application}" after "deploy:update_code", "deploy:migrate" after "deploy", "deploy:cleanup" # keep only the last 5 releases diff --git a/config/deploy/mo.rb b/config/deploy/mo.rb index 7a4aa1a..8303ec5 100644 --- a/config/deploy/mo.rb +++ b/config/deploy/mo.rb @@ -1,8 +1 @@ -# Your HTTP server, Apache/etc -role :web, "192.241.151.56" -# This may be the same as your `Web` server -role :app, "192.241.151.56" -# This is where Rails migrations will run -role :db, "192.241.151.56", primary: true - -set :branch, "mo" +server "192.241.151.56", :web, :app, :db, primary: true diff --git a/config/deploy/prod.rb b/config/deploy/prod.rb new file mode 100644 index 0000000..90192d5 --- /dev/null +++ b/config/deploy/prod.rb @@ -0,0 +1,8 @@ +# Your HTTP server, Apache/etc +role :web, "198.199.101.128" +# This may be the same as your `Web` server +role :app, "198.199.101.128" +# This is where Rails migrations will run +role :db, "198.199.101.128", primary: true +#role :db, "your slave db-server here" + diff --git a/config/deploy/production.rb b/config/deploy/production.rb deleted file mode 100644 index b4224ee..0000000 --- a/config/deploy/production.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Your HTTP server, Apache/etc -role :web, "www.parleytool.com" -# This may be the same as your `Web` server -role :app, "www.parleytool.com" -# This is where Rails migrations will run -role :db, "www.parleytool.com", primary: true -#role :db, "your slave db-server here" - diff --git a/config/deploy/qa.rb b/config/deploy/qa.rb new file mode 100644 index 0000000..1d031f0 --- /dev/null +++ b/config/deploy/qa.rb @@ -0,0 +1 @@ +server "192.241.204.27", :web, :app, :db, primary: true diff --git a/config/recipes/environments.rb b/config/recipes/environments.rb new file mode 100644 index 0000000..cee0993 --- /dev/null +++ b/config/recipes/environments.rb @@ -0,0 +1,5 @@ +set :stages, %w(prod qa mo) +set :default_stage, "qa" + +# this needs to be set last +require 'capistrano/ext/multistage' -- cgit v1.2.3 From b86c55693b26ca57fc3373e45ba91eff325530c5 Mon Sep 17 00:00:00 2001 From: Tyler Mercier Date: Fri, 26 Jul 2013 09:54:17 -0600 Subject: remove git check recipe. update rbenv recipe to split into install and setup --- config/recipes/check.rb | 13 ------------- config/recipes/rbenv.rb | 9 +++++++-- 2 files changed, 7 insertions(+), 15 deletions(-) delete mode 100644 config/recipes/check.rb diff --git a/config/recipes/check.rb b/config/recipes/check.rb deleted file mode 100644 index 45a6e1f..0000000 --- a/config/recipes/check.rb +++ /dev/null @@ -1,13 +0,0 @@ -namespace :check do - desc "Make sure local git is in sync with remote." - task :revision, roles: :web do - unless `git rev-parse HEAD` == `git rev-parse origin/#{branch}` - puts "WARNING: HEAD is not the same as origin/#{branch}" - puts "Run `git push` to sync changes." - exit - end - end - before "deploy", "check:revision" - before "deploy:migrations", "check:revision" - before "deploy:cold", "check:revision" -end diff --git a/config/recipes/rbenv.rb b/config/recipes/rbenv.rb index b84adc8..0c4d905 100644 --- a/config/recipes/rbenv.rb +++ b/config/recipes/rbenv.rb @@ -1,7 +1,7 @@ set_default :ruby_version, "2.0.0-p247" namespace :rbenv do - desc "Install rbenv, Ruby, and the Bundler gem" + desc "Install rbenv" task :install, roles: :app do # Install development tools: run "#{sudo} apt-get -y install build-essential" @@ -26,10 +26,15 @@ BASHRC run "mv ~/.bashrc.tmp ~/.bashrc" run %q{export PATH="$HOME/.rbenv/bin:$PATH"} run %q{eval "$(rbenv init -)"} + end + after "deploy:install", "rbenv:install" + + desc "Setup rbenv with ruby and bundler" + task :setup, roles: :web do run "rbenv install #{ruby_version}" run "rbenv global #{ruby_version}" run "gem install bundler --no-ri --no-rdoc" run "rbenv rehash" end - after "deploy:install", "rbenv:install" + after "deploy:setup", "rbenv:setup" end -- cgit v1.2.3 From f6f238c88a0324a3ee60783479e35671b50bdf32 Mon Sep 17 00:00:00 2001 From: Tyler Mercier Date: Fri, 26 Jul 2013 10:23:47 -0600 Subject: update prod to new box --- config/deploy/prod.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/deploy/prod.rb b/config/deploy/prod.rb index 90192d5..dbf27dd 100644 --- a/config/deploy/prod.rb +++ b/config/deploy/prod.rb @@ -1,8 +1,8 @@ # Your HTTP server, Apache/etc -role :web, "198.199.101.128" +role :web, "198.199.118.206" # This may be the same as your `Web` server -role :app, "198.199.101.128" +role :app, "198.199.118.206" # This is where Rails migrations will run -role :db, "198.199.101.128", primary: true +role :db, "198.199.118.206", primary: true #role :db, "your slave db-server here" -- cgit v1.2.3