Last active
August 29, 2015 13:57
-
-
Save mikecmpbll/9729386 to your computer and use it in GitHub Desktop.
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
require "bundler/capistrano" | |
load 'deploy/assets' | |
require "rvm/capistrano" | |
# SCM Settings | |
set :use_sudo, false | |
# Server addresses | |
role :web, "manage.theapp.net" # Your HTTP server, Apache/etc | |
role :app, "manage.theapp.net" # This may be the same as your `Web` server | |
role :db, "manage.theapp.net", :primary => true # This is where Rails migrations will run | |
ssh_options[:forward_agent] = true | |
default_run_options[:pty] = true | |
set :application, "manage.theapp.net" | |
set :deploy_to, "/home/company/manage.theapp.net" | |
set :branch, "manage_2" | |
set :deploy_via, :remote_cache | |
set :copy_cache, true | |
set :git_enable_submodules, 0 | |
set :repository, "git@staging.companyhostedservices.co.uk:manage.git" | |
set :scm, :git | |
set :user, :company | |
set :keep_releases, 2 | |
namespace :deploy do | |
desc "Restarting mod_rails with restart.txt" | |
task :restart, :roles => :app, :except => { :no_release => true } do | |
run "touch #{current_path}/tmp/restart.txt" | |
end | |
[:start, :stop].each do |t| | |
desc "#{t} task is a no-op with mod_rails" | |
task t, :roles => :app do ; end | |
end | |
# Make sure shared files are still shared when we deploy over the top of them | |
# Create any directories we need on first deploy | |
desc "Make sure assets persist, new directories are created." | |
after "deploy:update_code" do | |
run "ln -sf #{deploy_to}/#{shared_dir}/config/database.yml #{current_release}/config/database.yml" | |
run "rm -rf #{current_release}/public/system" | |
run "ln -sf #{deploy_to}/#{shared_dir}/public/disabled.html #{current_release}/public/disabled.html" | |
run "ln -sf #{deploy_to}/#{shared_dir}/public/system #{current_release}/public/system" | |
run "mkdir -p #{deploy_to}/#{shared_dir}/config" | |
run "mkdir -p #{deploy_to}/#{shared_dir}/config" | |
run "mkdir -p #{deploy_to}/#{shared_dir}/public/system" | |
run "touch #{deploy_to}/#{shared_dir}/config/database.yml" | |
end | |
desc "Automatically cleanup after deploy." | |
after "deploy", "deploy:cleanup" | |
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
mbp4:manage mike.campbell$ cap deploy:cold | |
triggering load callbacks | |
* executing `deploy:cold' | |
* executing `deploy:update' | |
** transaction: start | |
* executing `deploy:update_code' | |
updating the cached checkout on all servers | |
executing locally: "git ls-remote git@staging.companyhostedservices.co.uk:manage.git manage_2" | |
command finished in 851ms | |
* executing "if [ -d /home/company/manage.theapp.net/shared/cached-copy ]; then cd /home/company/manage.theapp.net/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard fc676c215ad580408c412fcb9d2a056f27309ec3 && git submodule -q init && for mod in `git submodule status | awk '{ print $2 }'`; do git config -f .git/config submodule.${mod}.url `git config -f .gitmodules --get submodule.${mod}.url` && echo Synced $mod; done && git submodule -q sync && export GIT_RECURSIVE=$([ ! \"`git --version`\" \\< \"git version 1.6.5\" ] && echo --recursive) && git submodule -q update --init $GIT_RECURSIVE && git clean -q -d -x -f; else git clone -q git@staging.companyhostedservices.co.uk:manage.git /home/company/manage.theapp.net/shared/cached-copy && cd /home/company/manage.theapp.net/shared/cached-copy && git checkout -q -b deploy fc676c215ad580408c412fcb9d2a056f27309ec3 && git submodule -q init && git submodule -q sync && export GIT_RECURSIVE=$([ ! \"`git --version`\" \\< \"git version 1.6.5\" ] && echo --recursive) && git submodule -q update --init $GIT_RECURSIVE; fi" | |
servers: ["manage.theapp.net"] | |
[manage.theapp.net] executing command | |
** [manage.theapp.net :: out] default: line 1: server: command not found | |
** [manage.theapp.net :: out] default: line 2: listen: command not found | |
** [manage.theapp.net :: out] default: line 3: server_name: command not found | |
** [manage.theapp.net :: out] default: line 5: access_log: command not found | |
** [manage.theapp.net :: out] default: line 7: server_name_in_redirect: command not found | |
** [manage.theapp.net :: out] default: line 9: location: command not found | |
** [manage.theapp.net :: out] default: line 10: root: command not found | |
** [manage.theapp.net :: out] default: line 11: index: command not found | |
** [manage.theapp.net :: out] default: line 12: syntax error near unexpected token `}' | |
** default: line 12: ` }' | |
command finished in 436ms | |
*** [deploy:update_code] rolling back | |
* executing "rm -rf /home/company/manage.theapp.net/releases/20140323202753; true" | |
servers: ["manage.theapp.net"] | |
[manage.theapp.net] executing command | |
** [out :: manage.theapp.net] default: line 1: server: command not found | |
** [out :: manage.theapp.net] default: line 2: listen: command not found | |
** [out :: manage.theapp.net] default: line 3: server_name: command not found | |
** [out :: manage.theapp.net] default: line 5: access_log: command not found | |
** [out :: manage.theapp.net] default: line 7: server_name_in_redirect: command not found | |
** [out :: manage.theapp.net] default: line 9: location: command not found | |
** [out :: manage.theapp.net] default: line 10: root: command not found | |
** [out :: manage.theapp.net] default: line 11: index: command not found | |
** [out :: manage.theapp.net] default: line 12: syntax error near unexpected token `}' | |
** [out :: manage.theapp.net] default: line 12: ` }' | |
command finished in 487ms | |
** [deploy:update_code] exception while rolling back: Capistrano::CommandError, failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'default' -c 'rm -rf /home/company/manage.theapp.net/releases/20140323202753; true'" on manage.theapp.net | |
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'default' -c 'if [ -d /home/company/manage.theapp.net/shared/cached-copy ]; then cd /home/company/manage.theapp.net/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard fc676c215ad580408c412fcb9d2a056f27309ec3 && git submodule -q init && for mod in `git submodule status | awk '\\''{ print $2 }'\\''`; do git config -f .git/config submodule.${mod}.url `git config -f .gitmodules --get submodule.${mod}.url` && echo Synced $mod; done && git submodule -q sync && export GIT_RECURSIVE=$([ ! \"`git --version`\" \\< \"git version 1.6.5\" ] && echo --recursive) && git submodule -q update --init $GIT_RECURSIVE && git clean -q -d -x -f; else git clone -q git@staging.companyhostedservices.co.uk:manage.git /home/company/manage.theapp.net/shared/cached-copy && cd /home/company/manage.theapp.net/shared/cached-copy && git checkout -q -b deploy fc676c215ad580408c412fcb9d2a056f27309ec3 && git submodule -q init && git submodule -q sync && export GIT_RECURSIVE=$([ ! \"`git --version`\" \\< \"git version 1.6.5\" ] && echo --recursive) && git submodule -q update --init $GIT_RECURSIVE; fi'" on manage.theapp.net |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment