-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
102 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
load 'deploy' | ||
# Uncomment if you are using Rails' asset pipeline | ||
# load 'deploy/assets' | ||
load 'config/deploy' # remove this line to skip loading any of the default tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
set :application, 'bulletin_board' | ||
set :repository, 'git://github.com/LasVegasRubyGroup/vegastech_app.git' | ||
|
||
set :scm, 'git' | ||
set :scm_verbose, true | ||
set :branch, 'master' | ||
set :user, 'lvrug' | ||
set :group, 'lvrug' | ||
set :deploy_via, 'remote_cache' | ||
set :deploy_to, "/home/#{user}/applications/#{application}" | ||
set :use_sudo, false | ||
set :init_script, "/etc/init.d/#{application}" | ||
|
||
role :web, '66.209.73.11' | ||
role :app, '66.209.73.11' | ||
role :db, '66.209.73.11', primary: true | ||
|
||
require 'capistrano-unicorn' | ||
|
||
after 'deploy:restart', 'deploy:cleanup' | ||
after 'deploy:restart', 'unicorn:restart' | ||
|
||
# if you're still using the script/reaper helper you will need | ||
# these http://github.com/rails/irs_process_scripts | ||
|
||
# If you are using Passenger mod_rails uncomment this: | ||
# namespace :deploy do | ||
# task :start do ; end | ||
# task :stop do ; end | ||
# task :restart, :roles => :app, :except => { :no_release => true } do | ||
# run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" | ||
# end | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require 'capistrano-unicorn' | ||
|
||
rails_env = ENV['RAILS_ENV'] || 'production' | ||
root_path = File.expand_path(File.dirname(__FILE__) + '/../') | ||
|
||
worker_processes 1 | ||
timeout 30 | ||
preload_app true | ||
|
||
pid "#{root_path}/tmp/pids/unicorn.pid" | ||
|
||
listen "#{root_path}/tmp/sockets/unicorn.sock", backlog: 2048 | ||
|
||
stderr_path "#{root_path}/log/unicorn.stderr.log" | ||
stdout_path "#{root_path}/log/unicorn.stdout.log" | ||
|
||
before_fork do |server, worker| | ||
if defined?(ActiveRecord::Base) | ||
ActiveRecord::Base.connection.disconnect! | ||
Rails.logger.info('Disconnected from ActiveRecord') | ||
end | ||
|
||
old_pid = "#{root_path}/tmp/pids/unicorn.pid.oldbin" | ||
if File.exists?(old_pid) && server.pid != old_pid | ||
begin | ||
Process.kill('QUIT', File.read(old_pid).to_i) | ||
rescue Errno::ENOENT, Errno::ESRCH | ||
# someone else did our job for us | ||
end | ||
end | ||
end | ||
|
||
after_fork do |server, worker| | ||
if defined?(ActiveRecord::Base) | ||
ActiveRecord::Base.establish_connection | ||
Rails.logger.info('Connected to ActiveRecord') | ||
end | ||
end |