Skip to content

Instantly share code, notes, and snippets.

@vparihar01
Last active December 10, 2015 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vparihar01/4452253 to your computer and use it in GitHub Desktop.
Save vparihar01/4452253 to your computer and use it in GitHub Desktop.
load 'deploy'
# ================================================================
# ROLES
# ================================================================
role :app, "173.203.86.155:22", {:primary=>true}
role :db, "173.203.86.155:22", {:primary=>true}
# ================================================================
# VARIABLES
# ================================================================
# Webistrano defaults
set :webistrano_project, "demo"
set :webistrano_stage, "demo"
set :application, "demo_staging"
set :branch, "demo"
set :deploy_to, "/var/www/m2m/demo"
set :deploy_via, :checkout
set :keep_releases, "5"
set :password, "***************"
set :repository, "git@github.com:webonise/demo.git"
set :runner, "root"
set :scm, "git"
set :use_sudo, true
set :user, "root"
# ================================================================
# TEMPLATE TASKS
# ================================================================
# allocate a pty by default as some systems have problems without
default_run_options[:pty] = true
# set Net::SSH ssh options through normal variables
# at the moment only one SSH key is supported as arrays are not
# parsed correctly by Webistrano::Deployer.type_cast (they end up as strings)
# [:ssh_port, :ssh_keys].each do |ssh_opt|
namespace :deploy do
task :restart, :roles => :app, :except => { :no_release => true } do
# do nothing
end
task :start, :roles => :app, :except => { :no_release => true } do
# do nothing
end
task :stop, :roles => :app, :except => { :no_release => true } do
# do nothing
end
end
# ================================================================
# CUSTOM RECIPES
# ================================================================
task :custommigration do
desc "custommigration"
run "cd #{current_release}/app && Console/cake Migrations.migration run all"
run "cd #{current_release}/app && Console/cake Migrations.migration run all --plugin Codes"
end
after 'customsymlink', 'custommigration'
task :customsymlink do
desc "custom symlink"
run "ln -s #{shared_path}/tmp #{current_release}/app/tmp"
run "ln -s #{shared_path}/img/uploaded #{current_release}/app/webroot/img/uploaded"
run "ln -s #{shared_path}/img/reportImages #{current_release}/app/webroot/img/reportImages"
run "ln -s #{shared_path}/files/reports #{current_release}/app/webroot/files/reports"
run "ln -s #{shared_path}/files/csv #{current_release}/app/webroot/files/csv"
run "ln -sf #{shared_path}/config/core.php #{current_release}/app/Config/core.php"
run "ln -sf #{shared_path}/config/database.php #{current_release}/app/Config/database.php"
run "ln -sf #{shared_path}/config/facebook.php #{current_release}/app/Config/facebook.php"
run "ln -sf #{shared_path}/config/twitter.php #{current_release}/app/Config/twitter.php"
run "ln -sf #{shared_path}/config/recurly.php #{current_release}/app/Config/recurly.php"
run "ln -sf #{shared_path}/tcpdf/cache #{current_release}/app/Vendor/tcpdf/cache"
run "rm -rf #{shared_path}/tmp/cache/models/myapp*"
run "rm -rf #{shared_path}/tmp/cache/persistent/myapp*"
#run "rm -rf #{current_release}/app/tmp/cache/persistent/myapp*"
#run "rm -rf #{current_release}/app/tmp/cache/models/myapp*"
run "chmod -R 777 #{current_release}/app/webroot/img"
run "chmod -R 777 #{current_release}/app/webroot/files"
end
after 'deploy:update_code', 'customsymlink'
task :clear_cache do
desc "clear_cache"
run "rm -rf #{current_release}/app/tmp/cache/persistent/myapp*"
run "rm -rf #{current_release}/app/tmp/cache/models/myapp*"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment