Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure for deploy #42

Merged
merged 4 commits into from
Feb 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 6 additions & 19 deletions Capfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,14 @@ require 'capistrano/setup'
# Include default deployment tasks
require 'capistrano/deploy'

# Include tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
# https://github.com/capistrano/rvm
# https://github.com/capistrano/rbenv
# https://github.com/capistrano/chruby
# https://github.com/capistrano/bundler
# https://github.com/capistrano/rails
# https://github.com/capistrano/passenger
#
# require 'capistrano/rvm'
# require 'capistrano/rbenv'
# require 'capistrano/chruby'
# require 'capistrano/bundler'
# require 'capistrano/rails/assets'
# require 'capistrano/rails/migrations'
# require 'capistrano/passenger'
require 'capistrano/bundler'
require 'dlss/capistrano'
require 'capistrano/passenger'
require 'capistrano/rvm'
require 'capistrano/rails'
# require 'dlss/capistrano'
require 'capistrano/scm/git'

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

install_plugin Capistrano::SCM::Git
5 changes: 4 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ gem 'mods_display', '0.3.4'
gem 'coderay'
gem 'blacklight_range_limit'

gem 'mysql2'

group :deployment do
gem 'dlss-capistrano'
gem 'capistrano-passenger'
gem 'capistrano', '~> 3.0'
gem 'capistrano-rvm'
gem 'capistrano-bundler'
gem 'capistrano-rails'
gem 'lyberteam-capistrano-devel'
end
45 changes: 26 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ GEM
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.4.0)
airbrussh (1.1.2)
sshkit (>= 1.6.1, != 1.7.0)
arel (6.0.4)
autoprefixer-rails (6.7.3)
execjs
bcrypt (3.1.10)
bcrypt (3.1.11)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
blacklight (6.7.3)
Expand All @@ -64,18 +66,23 @@ GEM
bundler (~> 1.2)
thor (~> 0.18)
byebug (8.2.0)
capistrano (3.4.0)
capistrano (3.7.2)
airbrussh (>= 1.0.0)
capistrano-harrow
i18n
rake (>= 10.0.0)
sshkit (~> 1.3)
sshkit (>= 1.9.0)
capistrano-bundle_audit (0.0.5)
bundler-audit
capistrano (~> 3.0)
capistrano-bundler (1.1.4)
capistrano (~> 3.1)
sshkit (~> 1.2)
capistrano-harrow (0.5.3)
capistrano-one_time_key (0.0.1)
capistrano (~> 3.0)
capistrano-passenger (0.2.0)
capistrano (~> 3.0)
capistrano-rails (1.1.5)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
Expand All @@ -99,7 +106,6 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.10.0)
colorize (0.7.7)
concurrent-ruby (1.0.4)
config (1.0.0)
activesupport (>= 3.0)
Expand All @@ -117,16 +123,20 @@ GEM
deep_merge (1.0.1)
deprecation (1.0.0)
activesupport
devise (3.5.2)
devise (4.2.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
railties (>= 4.1.0, < 5.1)
responders
thread_safe (~> 0.1)
warden (~> 1.2.3)
devise-guests (0.3.3)
devise
diff-lcs (1.2.5)
dlss-capistrano (3.2.0)
capistrano (~> 3.0)
capistrano-bundle_audit (>= 0.0.3)
capistrano-one_time_key
capistrano-releaseboard
docile (1.1.5)
domain_name (0.5.25)
unf (>= 0.0.5, < 1.0.0)
Expand Down Expand Up @@ -164,11 +174,6 @@ GEM
libv8 (3.16.14.13)
loofah (2.0.3)
nokogiri (>= 1.5.9)
lyberteam-capistrano-devel (3.2.0)
capistrano (~> 3.0)
capistrano-bundle_audit (>= 0.0.3)
capistrano-one_time_key
capistrano-releaseboard
mail (2.6.4)
mime-types (>= 1.16, < 4)
mime-types (2.99.3)
Expand All @@ -183,9 +188,10 @@ GEM
stanford-mods
multi_json (1.11.2)
multipart-post (2.0.0)
mysql2 (0.4.5)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (3.0.1)
net-ssh (4.1.0)
netrc (0.11.0)
nokogiri (1.7.0.1)
mini_portile2 (~> 2.1.0)
Expand Down Expand Up @@ -229,8 +235,8 @@ GEM
rake (11.3.0)
rdoc (4.2.0)
ref (2.0.0)
responders (2.1.0)
railties (>= 4.2.0, < 5)
responders (2.3.0)
railties (>= 4.2.0, < 5.1)
rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
Expand Down Expand Up @@ -280,8 +286,7 @@ GEM
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.11)
sshkit (1.7.1)
colorize (>= 0.7.0)
sshkit (1.12.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
stanford-mods (1.1.5)
Expand All @@ -307,7 +312,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
warden (1.2.3)
warden (1.2.7)
rack (>= 1.0)
web-console (2.2.1)
activemodel (>= 4.0)
Expand All @@ -333,6 +338,7 @@ DEPENDENCIES
byebug
capistrano (~> 3.0)
capistrano-bundler
capistrano-passenger
capistrano-rails
capistrano-rvm
capybara
Expand All @@ -342,10 +348,11 @@ DEPENDENCIES
coveralls
devise
devise-guests
dlss-capistrano
jbuilder
jquery-rails
lyberteam-capistrano-devel
mods_display (= 0.3.4)
mysql2
poltergeist
rails (= 4.2.7.1)
rake (= 11.3.0)
Expand Down
50 changes: 8 additions & 42 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -1,58 +1,24 @@
# config valid only for current version of Capistrano
lock '3.4.0'

set :application, 'colligo'
set :repo_url, 'https://github.com/sul-dlss/colligo.git'
set :user, 'dms'

# Default branch is :master
ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp
ask :user, proc { `whoami`.chomp }.call
set :home_directory, "/home/#{fetch(:user)}"
set :deploy_to, "#{fetch(:home_directory)}/#{fetch(:application)}"

# Default value for :scm is :git
# set :scm, :git
ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call

# Default value for :format is :pretty
# set :format, :pretty

# Default value for :log_level is :debug
set :log_level, :info
set :home_directory, "/opt/app/#{fetch(:user)}"
set :deploy_to, "#{fetch(:home_directory)}/#{fetch(:application)}"

# Default value for :pty is false
# set :pty, true

# Default value for :linked_files is []
set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml', 'public/robots.txt')
set :linked_files, fetch(:linked_files, []).push('config/database.yml')

# Default value for linked_dirs is []
set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')

# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }

# Default value for keep_releases is 5
# set :keep_releases, 5

namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
execute :touch, release_path.join('tmp/restart.txt')
end
end

after :publishing, :restart

after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
end
set :keep_releases, 5

before 'deploy:publishing'
# all servers (even -dev) will be rails_env production
set :rails_env, 'production'
5 changes: 5 additions & 0 deletions config/deploy/prod.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# server uses standardized suffix
server 'sul-dms-discovery-prod.stanford.edu', user: fetch(:user), roles: %w{web db app}
set :bundle_without, %w(test deployment development).join(' ')

Capistrano::OneTimeKey.generate_one_time_key!
55 changes: 0 additions & 55 deletions config/deploy/production.rb

This file was deleted.

5 changes: 5 additions & 0 deletions config/deploy/stage.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# server uses standardized suffix
server 'sul-dms-discovery-stage.stanford.edu', user: fetch(:user), roles: %w{web db app}
set :bundle_without, %w(test deployment development).join(' ')

Capistrano::OneTimeKey.generate_one_time_key!
14 changes: 0 additions & 14 deletions config/deploy/staging.rb

This file was deleted.

11 changes: 0 additions & 11 deletions config/deploy/testing.rb

This file was deleted.