Skip to content

Instantly share code, notes, and snippets.

/deploy.rb Secret

Created October 27, 2015 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/59d94ffc5eb53dbaa0f9 to your computer and use it in GitHub Desktop.
Save anonymous/59d94ffc5eb53dbaa0f9 to your computer and use it in GitHub Desktop.
require 'mina/git'
set :domain, 'your.prod.server.ip'
set :user, 'your_user'
set :deploy_to, '/var/www/projectpath'
set :repository, 'git@bitbucket.org:user/repo.git'
set :branch, 'master'
set :shared_paths, ['.env', 'storage']
task :setup => :environment do
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/storage/app"]
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/storage/framework"]
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/storage/logs"]
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/storage/framework/cache"]
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/storage/framework/sessions"]
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/storage/framework/views"]
queue! %[chmod -R 0777 "#{deploy_to}/#{shared_path}/storage"]
queue! %[touch "#{deploy_to}/#{shared_path}/.env"]
queue %[echo "-----> Be sure to edit '#{shared_path}/.env'"]
end
task :deploy => :environment do
deploy do
invoke :'git:clone'
queue! "composer install"
invoke :'deploy:link_shared_paths'
queue! "php artisan migrate --force"
to :launch do
invoke :clear_caches
invoke :optimize
invoke :restart
invoke :'deploy:cleanup'
end
end
end
task :clear_caches do
in_directory "#{deploy_to}/current" do
queue! "php artisan cache:clear"
end
end
task :optimize do
in_directory "#{deploy_to}/current" do
queue! "php artisan config:cache"
queue! "php artisan route:cache"
queue! "php artisan optimize --force"
end
end
task :restart do
queue! "sudo service nginx reload"
queue! "sudo service php5-fpm reload"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment