Upgrade and add deploy options

This commit is contained in:
2014-07-11 11:34:58 +02:00
parent cdb3596d04
commit af6fefc399
7 changed files with 183 additions and 45 deletions
+1
View File
@@ -34,3 +34,4 @@ custom_plan.rb
public/capybara.html public/capybara.html
chromedriver.log chromedriver.log
/coverage /coverage
/old_cap
+22 -5
View File
@@ -1,8 +1,25 @@
load 'deploy' if respond_to?(:namespace) # cap2 differentiator # Load DSL and Setup Up Stages
require 'capistrano/setup'
# Uncomment if you are using Rails' asset pipeline # Includes default deployment tasks
load 'deploy/assets' require 'capistrano/deploy'
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } # Includes 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
#
# require 'capistrano/rvm'
# require 'capistrano/rbenv'
# require 'capistrano/chruby'
# require 'capistrano/bundler'
# require 'capistrano/rails/assets'
# require 'capistrano/rails/migrations'
load 'config/deploy' # remove this line to skip loading any of the default tasks # Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
+1
View File
@@ -80,6 +80,7 @@ group :development do
gem 'thin' gem 'thin'
gem 'faye' gem 'faye'
gem 'pry-rails' gem 'pry-rails'
gem 'capistrano', '~> 3.0', require: false
#gem 'spring' #gem 'spring'
#gem 'spring-commands-rspec' #gem 'spring-commands-rspec'
end end
+22 -9
View File
@@ -92,6 +92,10 @@ GEM
sass (~> 3.2) sass (~> 3.2)
thor thor
builder (3.2.2) builder (3.2.2)
capistrano (3.2.1)
i18n
rake (>= 10.0.0)
sshkit (~> 1.3)
capybara (2.4.1) capybara (2.4.1)
mime-types (>= 1.16) mime-types (>= 1.16)
nokogiri (>= 1.3.3) nokogiri (>= 1.3.3)
@@ -109,10 +113,11 @@ GEM
coffee-rails (4.0.1) coffee-rails (4.0.1)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 5.0)
coffee-script (2.2.0) coffee-script (2.3.0)
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.7.0) coffee-script-source (1.7.1)
colorize (0.7.3)
connection_pool (2.0.0) connection_pool (2.0.0)
cookiejar (0.3.2) cookiejar (0.3.2)
couchbase (1.3.8) couchbase (1.3.8)
@@ -203,10 +208,10 @@ GEM
haml (>= 3.1, < 5.0) haml (>= 3.1, < 5.0)
railties (>= 4.0.1) railties (>= 4.0.1)
handlebars-source (1.3.0) handlebars-source (1.3.0)
hashie (2.1.2) hashie (3.2.0)
hike (1.2.3) hike (1.2.3)
http_parser.rb (0.6.0) http_parser.rb (0.6.0)
i18n (0.6.9) i18n (0.6.11)
jquery-rails (3.1.1) jquery-rails (3.1.1)
railties (>= 3.0, < 5.0) railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
@@ -237,23 +242,26 @@ GEM
multi_json (1.10.1) multi_json (1.10.1)
multi_xml (0.5.5) multi_xml (0.5.5)
multipart-post (2.0.0) multipart-post (2.0.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (2.9.1)
nokogiri (1.6.2.1) nokogiri (1.6.2.1)
mini_portile (= 0.6.0) mini_portile (= 0.6.0)
oauth2 (0.9.4) oauth2 (1.0.0)
faraday (>= 0.8, < 0.10) faraday (>= 0.8, < 0.10)
jwt (~> 1.0) jwt (~> 1.0)
multi_json (~> 1.3) multi_json (~> 1.3)
multi_xml (~> 0.5) multi_xml (~> 0.5)
rack (~> 1.2) rack (~> 1.2)
omniauth (1.2.1) omniauth (1.2.2)
hashie (>= 1.2, < 3) hashie (>= 1.2, < 4)
rack (~> 1.0) rack (~> 1.0)
omniauth-facebook (1.6.0) omniauth-facebook (1.6.0)
omniauth-oauth2 (~> 1.1) omniauth-oauth2 (~> 1.1)
omniauth-oauth2 (1.1.2) omniauth-oauth2 (1.2.0)
faraday (>= 0.8, < 0.10) faraday (>= 0.8, < 0.10)
multi_json (~> 1.3) multi_json (~> 1.3)
oauth2 (~> 0.9.3) oauth2 (~> 1.0)
omniauth (~> 1.2) omniauth (~> 1.2)
orm_adapter (0.5.0) orm_adapter (0.5.0)
paperclip (4.2.0) paperclip (4.2.0)
@@ -349,6 +357,10 @@ GEM
actionpack (>= 3.0) actionpack (>= 3.0)
activesupport (>= 3.0) activesupport (>= 3.0)
sprockets (~> 2.8) sprockets (~> 2.8)
sshkit (1.5.1)
colorize
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
subexec (0.2.3) subexec (0.2.3)
temple (0.6.8) temple (0.6.8)
thin (1.6.2) thin (1.6.2)
@@ -385,6 +397,7 @@ DEPENDENCIES
active_decorator active_decorator
bootstrap-sass (~> 2.3) bootstrap-sass (~> 2.3)
bourbon bourbon
capistrano (~> 3.0)
capybara capybara
capybara-webkit capybara-webkit
cmtool! cmtool!
+47 -31
View File
@@ -1,42 +1,58 @@
#$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # config valid only for Capistrano 3.1
require "bundler/capistrano" lock '3.2.1'
#load 'deploy/assets'
#
load 'config/recipes/monit'
# Load RVM's capistrano plugin. set :application, 'qwaiter'
#require "rvm/capistrano" set :repo_url, 'root@uflows.com:/var/git/qwaiter.git'
set :application, "qwaiter" # Default branch is :master
set :repository, "root@uflows.com:/var/git/qwaiter.git" # ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call
set :scm, :git # Default deploy_to directory is /var/www/my_app
#set :revision, '89700f36e9' # set :deploy_to, '/var/www/my_app'
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
# Do not touch public/images,stylesheets,javascripts # Default value for :scm is :git
set :normalize_asset_timestamps, false # set :scm, :git
role :web, "qwaiter.com" # Your HTTP server, Apache/etc # Default value for :format is :pretty
role :app, "qwaiter.com" # This may be the same as your `Web` server # set :format, :pretty
#role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run
#role :db, "your slave db-server here"
# if you're still using the script/reaper helper you will need # Default value for :log_level is :debug
# these http://github.com/rails/irs_process_scripts # set :log_level, :debug
set :deploy_via, :remote_cache # Default value for :pty is false
set :branch, :master # set :pty, true
set :user, 'root'
set :deploy_to, '/var/www/qwaiter' # Default value for :linked_files is []
#set :bundle_cmd, 'bundle install --deployment' # set :linked_files, %w{config/database.yml}
# Default value for linked_dirs is []
# set :linked_dirs, %w{bin 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
# If you are using Passenger mod_rails uncomment this:
namespace :deploy do namespace :deploy do
task :start do ; end
task :stop do ; end desc 'Restart application'
task :restart, :roles => :app, :except => { :no_release => true } do task :restart do
run "#{try_sudo} chown -R www-data:www-data #{release_path}" on roles(:app), in: :sequence, wait: 5 do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" # Your restart mechanism here, for example:
# execute :touch, release_path.join('tmp/restart.txt')
end
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 end
+45
View File
@@ -0,0 +1,45 @@
# Simple Role Syntax
# ==================
# Supports bulk-adding hosts to roles, the primary server in each group
# is considered to be the first unless any hosts have the primary
# property set. Don't declare `role :all`, it's a meta role.
role :app, %w{deploy@qwaiter.com}
role :web, %w{deploy@qwaiter.com}
role :db, %w{deploy@qwaiter.com}
# Extended Server Syntax
# ======================
# This can be used to drop a more detailed server definition into the
# server list. The second argument is a, or duck-types, Hash and is
# used to set extended properties on the server.
server 'qwaiter.com', user: 'root', roles: %w{web app}, my_property: :my_value
# Custom SSH Options
# ==================
# You may pass any option but keep in mind that net/ssh understands a
# limited set of options, consult[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)
# }
#
# And/or per server (overrides global)
# ------------------------------------
# server 'qwaiter.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'
# }
+45
View File
@@ -0,0 +1,45 @@
# Simple Role Syntax
# ==================
# Supports bulk-adding hosts to roles, the primary server in each group
# is considered to be the first unless any hosts have the primary
# property set. Don't declare `role :all`, it's a meta role.
role :app, %w{deploy@example.com}
role :web, %w{deploy@example.com}
role :db, %w{deploy@example.com}
# Extended Server Syntax
# ======================
# This can be used to drop a more detailed server definition into the
# server list. The second argument is a, or duck-types, Hash and is
# used to set extended properties on the server.
server 'example.com', user: 'deploy', roles: %w{web app}, my_property: :my_value
# Custom SSH Options
# ==================
# You may pass any option but keep in mind that net/ssh understands a
# limited set of options, consult[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)
# }
#
# And/or per server (overrides global)
# ------------------------------------
# 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'
# }