From 5a2b105061add599f7686a9000d3a805f4deb274 Mon Sep 17 00:00:00 2001 From: Darren Hardy Date: Wed, 30 Mar 2016 14:18:59 -0700 Subject: [PATCH] upgrade Capistrano deploy scripties --- Capfile | 4 ++-- config/deploy.rb | 9 ++++----- config/deploy/dev_solo.rb | 8 -------- config/deploy/development.rb | 8 ++------ config/deploy/production.rb | 7 ++++--- config/deploy/qa.rb | 7 +++++-- config/deploy/staging.rb | 9 +++++++++ config/deploy/sul-pub-dev.rb | 17 ----------------- 8 files changed, 26 insertions(+), 43 deletions(-) delete mode 100644 config/deploy/dev_solo.rb create mode 100644 config/deploy/staging.rb delete mode 100644 config/deploy/sul-pub-dev.rb diff --git a/Capfile b/Capfile index 7c69c7fd7..e69fe184f 100644 --- a/Capfile +++ b/Capfile @@ -22,10 +22,10 @@ require 'capistrano/deploy' # require 'capistrano/rails/migrations' require 'capistrano/bundler' -require 'capistrano/passenger' require 'capistrano/rails' +require 'capistrano/passenger' require 'dlss/capistrano' -require 'squash/rails/capistrano3' +require 'squash/rails/capistrano3' # Note that this inclusion requires a branch, not a tag, to be deployed # Loads custom tasks from `lib/capistrano/tasks' if you have any defined. Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } diff --git a/config/deploy.rb b/config/deploy.rb index 3ecf77077..155ef2a12 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -2,13 +2,14 @@ lock '3.4.0' set :application, 'sul-pub' -set :repo_url, 'git@github.com:sul-dlss/sul-pub.git' +set :user, 'pub' +set :repo_url, "git@github.com:sul-dlss/#{fetch(:application)}.git" set :ssh_options, keys: [Capistrano::OneTimeKey.temporary_ssh_private_key_path], forward_agent: true, auth_methods: %w(publickey password) -# Default deploy_to directory is /var/www/my_app_name -set :deploy_to, '/home/***REMOVED***/sulbib' +set :home_directory, "/opt/app/#{fetch(:user)}" +set :deploy_to, "#{fetch(:home_directory)}/#{fetch(:application)}" # Default branch is the current checkout branch ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call @@ -32,5 +33,3 @@ ) before 'deploy:publishing', 'squash:write_revision' - -# set :bundle_audit_ignore, %w(CVE-2015-3226) diff --git a/config/deploy/dev_solo.rb b/config/deploy/dev_solo.rb deleted file mode 100644 index 74288680c..000000000 --- a/config/deploy/dev_solo.rb +++ /dev/null @@ -1,8 +0,0 @@ -server 'sulcap-dev-solo.stanford.edu', user: '***REMOVED***', roles: %w(web db app) - -Capistrano::OneTimeKey.generate_one_time_key! - -set :rails_env, 'development' - -# This is a development box, do not exclude development gems. -set :bundle_without, 'test' diff --git a/config/deploy/development.rb b/config/deploy/development.rb index 64ca49346..1b14d2f64 100644 --- a/config/deploy/development.rb +++ b/config/deploy/development.rb @@ -1,9 +1,5 @@ -server 'sulcap-dev.stanford.edu', user: '***REMOVED***', roles: %w(web db app) +server 'sul-pub-dev.stanford.edu', user: fetch(:user), roles: %w(web db app) Capistrano::OneTimeKey.generate_one_time_key! -set :rails_env, 'development' -set :deploy_via, :copy - -# This is a development box, do not exclude development gems. -set :bundle_without, 'test' +set :bundle_without, %w(test).join(' ') diff --git a/config/deploy/production.rb b/config/deploy/production.rb index f55cfd4a5..5ab0ba565 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -1,6 +1,7 @@ -server 'sulcap-prod.stanford.edu', user: '***REMOVED***', roles: %w(web db app) +server 'sul-pub-prod.stanford.edu', user: fetch(:user), roles: %w(web db app) Capistrano::OneTimeKey.generate_one_time_key! -set :rails_env, 'production' -set :deploy_via, :copy +set :bundle_without, %w(test development).join(' ') + +set :log_level, :info diff --git a/config/deploy/qa.rb b/config/deploy/qa.rb index 46978fcb5..b80199292 100644 --- a/config/deploy/qa.rb +++ b/config/deploy/qa.rb @@ -1,6 +1,9 @@ -server 'sulcap-qa.stanford.edu', user: '***REMOVED***', roles: %w(web db app) +server 'sul-pub-qa.stanford.edu', user: fetch(:user), roles: %w(web db app) Capistrano::OneTimeKey.generate_one_time_key! set :rails_env, 'production' -set :deploy_via, :copy + +set :bundle_without, %w(test development).join(' ') + +set :log_level, :info diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb new file mode 100644 index 000000000..7de5d25d6 --- /dev/null +++ b/config/deploy/staging.rb @@ -0,0 +1,9 @@ +server 'sul-pub-stage.stanford.edu', user: fetch(:user), roles: %w(web db app) + +Capistrano::OneTimeKey.generate_one_time_key! + +set :rails_env, 'production' + +set :bundle_without, %w(test development).join(' ') + +set :log_level, :info diff --git a/config/deploy/sul-pub-dev.rb b/config/deploy/sul-pub-dev.rb deleted file mode 100644 index 8e34f7258..000000000 --- a/config/deploy/sul-pub-dev.rb +++ /dev/null @@ -1,17 +0,0 @@ -# capistrano reads this file AFTER config/deploy.rb - -HOST = 'sul-pub-dev.stanford.edu' -set :user, 'pub' -set :home_directory, `ssh #{fetch(:user)}@#{HOST} 'echo $HOME'`.chomp - -# Override the default :deploy_to in config/deploy.rb -set :deploy_to, "#{fetch(:home_directory)}/#{fetch(:application)}" - -server HOST, user: fetch(:user), roles: %w(web db app) - -Capistrano::OneTimeKey.generate_one_time_key! - -set :rails_env, 'development' - -# This is a development box, do not exclude development gems. -set :bundle_without, 'test'