Skip to content

Commit

Permalink
Merge pull request #9 from anusharanganathan/feature_capistrano
Browse files Browse the repository at this point in the history
Feature capistrano
  • Loading branch information
Anusha Ranganathan committed Dec 16, 2015
2 parents d186f37 + 093118d commit 6456d64
Show file tree
Hide file tree
Showing 7 changed files with 292 additions and 1 deletion.
30 changes: 30 additions & 0 deletions Capfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Load DSL and set up stages
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 'capistrano/rails'
#require 'dlss/capistrano'

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
15 changes: 14 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
Expand All @@ -35,6 +35,9 @@ gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'rspec-rails', '< 2.99'
gem 'capybara'
gem 'poltergeist'
end

group :development do
Expand All @@ -53,3 +56,13 @@ gem 'devise'
gem 'devise-guests', '~> 0.3'
gem 'blacklight-marc', '~> 5.0'
gem 'config', '~> 1.0.0.beta3'
gem "mods_display", "0.3.4"
gem "coderay"

group :deployment do
gem 'capistrano', '~> 3.0'
gem 'capistrano-rvm'
gem 'capistrano-bundler'
gem 'capistrano-rails'
gem 'lyberteam-capistrano-devel'
end
101 changes: 101 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,48 @@ GEM
autoprefixer-rails (>= 5.0.0.1)
sass (>= 3.3.0)
builder (3.2.2)
bundler-audit (0.4.0)
bundler (~> 1.2)
thor (~> 0.18)
byebug (8.2.0)
capistrano (3.4.0)
i18n
rake (>= 10.0.0)
sshkit (~> 1.3)
capistrano-bundle_audit (0.0.5)
bundler-audit
capistrano (~> 3.0)
capistrano-bundler (1.1.4)
capistrano (~> 3.1)
sshkit (~> 1.2)
capistrano-one_time_key (0.0.1)
capistrano (~> 3.0)
capistrano-rails (1.1.5)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
capistrano-releaseboard (0.0.1)
faraday
capistrano-rvm (0.1.2)
capistrano (~> 3.0)
sshkit (~> 1.2)
capybara (2.5.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
childprocess (0.5.8)
ffi (~> 1.0, >= 1.0.11)
cliver (0.3.2)
coderay (1.1.0)
coffee-rails (4.1.0)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.10.0)
colorize (0.7.7)
config (1.0.0)
activesupport (>= 3.0)
deep_merge (~> 1.0.0)
Expand All @@ -84,12 +116,16 @@ GEM
warden (~> 1.2.3)
devise-guests (0.3.3)
devise
diff-lcs (1.2.5)
erubis (2.7.0)
execjs (2.6.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
ffi (1.9.10)
globalid (0.3.6)
activesupport (>= 4.1.0)
i18n (0.7.0)
iso-639 (0.2.5)
jbuilder (2.3.2)
activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2)
Expand All @@ -107,9 +143,15 @@ GEM
kaminari (0.16.3)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
libv8 (3.16.14.13)
logger (1.2.8)
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.3)
mime-types (>= 1.16, < 3)
marc (1.0.0)
Expand All @@ -118,10 +160,30 @@ GEM
mime-types (2.6.2)
mini_portile (0.6.2)
minitest (5.8.2)
mods (2.0.3)
iso-639
nokogiri
nom-xml (~> 0.5.2)
mods_display (0.3.4)
i18n
stanford-mods
multi_json (1.11.2)
multipart-post (2.0.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (3.0.1)
nokogiri (1.6.6.3)
mini_portile (~> 0.6.0)
nom-xml (0.5.4)
activesupport (>= 3.2.18)
i18n
nokogiri
orm_adapter (0.5.0)
poltergeist (1.8.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
Expand Down Expand Up @@ -151,10 +213,23 @@ GEM
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
rdoc (4.2.0)
ref (2.0.0)
responders (2.1.0)
railties (>= 4.2.0, < 5)
rsolr (1.0.13)
builder (>= 2.1.2)
rspec-core (2.14.8)
rspec-expectations (2.14.5)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.6)
rspec-rails (2.14.2)
actionpack (>= 3.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rubyzip (1.1.7)
sass (3.4.19)
sass-rails (5.0.4)
Expand All @@ -175,6 +250,15 @@ GEM
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sqlite3 (1.3.11)
sshkit (1.7.1)
colorize (>= 0.7.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
stanford-mods (1.1.5)
mods (~> 2.0.2)
therubyracer (0.12.2)
libv8 (~> 3.16.14.0)
ref
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.1)
Expand All @@ -195,6 +279,11 @@ GEM
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
websocket-driver (0.6.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
xpath (2.0.0)
nokogiri (~> 1.3)

PLATFORMS
ruby
Expand All @@ -203,23 +292,35 @@ DEPENDENCIES
blacklight (>= 5.3.0)
blacklight-marc (~> 5.0)
byebug
capistrano (~> 3.0)
capistrano-bundler
capistrano-rails
capistrano-rvm
capybara
coderay
coffee-rails (~> 4.1.0)
config (~> 1.0.0.beta3)
devise
devise-guests (~> 0.3)
jbuilder (~> 2.0)
jettywrapper (>= 2.0)
jquery-rails
lyberteam-capistrano-devel
mods_display (= 0.3.4)
poltergeist
rails (= 4.2.4)
rsolr (~> 1.0.6)
rspec-rails (< 2.99)
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
spring
sqlite3
therubyracer
turbolinks
tzinfo-data
uglifier (>= 1.3.0)
web-console (~> 2.0)

BUNDLED WITH
1.10.6

60 changes: 60 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# 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'

# 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

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

# Default value for :log_level is :debug
set :log_level, :info

# 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')

# 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

before 'deploy:publishing'
61 changes: 61 additions & 0 deletions config/deploy/production.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# server-based syntax
# ======================
# Defines a single server with a list of roles and multiple properties.
# You can define all roles on a single server, or split them:

# server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value
# server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value
# server 'db.example.com', user: 'deploy', roles: %w{db}



# role-based syntax
# ==================

# Defines a role with one or multiple servers. The primary server in each
# group is considered to be the first unless any hosts have the primary
# property set. Specify the username and a domain or IP for the server.
# Don't use `:all`, it's a meta role.

# role :app, %w{deploy@example.com}, my_property: :my_value
# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value
# role :db, %w{deploy@example.com}



# Configuration
# =============
# You can set any configuration variable like in config/deploy.rb
# These variables are then only loaded and set in this stage.
# For available Capistrano configuration variables see the documentation page.
# http://capistranorb.com/documentation/getting-started/configuration/
# Feel free to add new variables to customise your setup.



# Custom SSH Options
# ==================
# You may pass any option but keep in mind that net/ssh understands a
# limited set of options, consult the Net::SSH documentation.
# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start
#
# Global options
# --------------
# set :ssh_options, {
# keys: %w(/home/rlisowski/.ssh/id_rsa),
# forward_agent: false,
# auth_methods: %w(password)
# }
#
# The server-based syntax can be used to override options:
# ------------------------------------
# server 'example.com',
# user: 'user_name',
# roles: %w{web app},
# ssh_options: {
# user: 'user_name', # overrides user setting above
# keys: %w(/home/user_name/.ssh/id_rsa),
# forward_agent: false,
# auth_methods: %w(publickey password)
# # password: 'please use keys'
# }
Loading

0 comments on commit 6456d64

Please sign in to comment.