Created
August 12, 2014 12:28
-
-
Save PelagicDev/829f53723aa171dd3ddb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
## Capistrano v3 | |
# /config/deploy.rb | |
set :application, '<site_name>' #example.com | |
set :use_sudo, false | |
set :build_dir, "build" | |
set :ssh_login, "<login_details>" #[email protected] | |
set :deploy_dir, "/var/www/#{fetch(:application)}" | |
namespace :middleman do | |
desc "Build and deploy middleman project" | |
task :deploy do | |
invoke 'middleman:build' | |
invoke 'middleman:deploy' | |
end | |
desc "Run build utility" | |
task :build do | |
run_locally do | |
execute "middleman build" | |
end | |
end | |
desc "Deploy to VPS" | |
task :deploy do | |
run_locally do | |
execute "scp -r #{fetch(:build_dir)} #{fetch(:ssh_login)}:#{fetch(:deploy_dir)}" | |
end | |
end | |
end | |
namespace :nginx do | |
desc "Restart NGINX server" | |
task :restart do | |
run_locally do | |
execute "ssh #{fetch(:ssh_login)} 'service nginx reload'" | |
end | |
end | |
end | |
after 'middleman:deploy', 'nginx:restart' | |
__END__ | |
cap <stage> middleman:deploy | |
You'll likely need to setup SSH login with your VPS for this to work. | |
There are some additional Capistrano v3 setup details I left out, mainly | |
the setup of "stages" which Capistrano boilerplates for you when you run | |
`cap install`. | |
This is not an elegant approach to using capistrano, in fact | |
it does not leverage the power of the tool in the least. However, for | |
a deployment for something like Middleman, this worked well for me. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment