Skip to content

Instantly share code, notes, and snippets.

@chriskottom
Created September 10, 2013 09:23
Show Gist options
  • Save chriskottom/6507003 to your computer and use it in GitHub Desktop.
Save chriskottom/6507003 to your computer and use it in GitHub Desktop.
A simplified Capistrano recipe for deployment of static websites from a local directory
set :application, 'Example' # the name of your app
set :location, 'example.com' # server address
set :user, 'deploy' # remote user (unprivileged deployment user)
set :group, 'www-data' # remote group (should be the group your web server runs as)
set :use_sudo, false
set :scm, 'none'
set :deploy_via, :copy
set :repository, '.'
set :deploy_to, '/var/www/example'
set :group_writable, true
# Any files or directories that shouldn't be copied. Modify as needed.
set :copy_exclude, %w( *~ .bundle Capfile config/ Gemfile Gemfile.lock bin/ deploy.rb vendor/ .git/ .gitignore )
# Single server deployment
server location, :web, :app, :db
namespace :deploy do
task :default do
update
end
task :finalize_update do
escaped_release = latest_release.to_s.shellescape
commands = []
commands << "chgrp -R #{group} #{escaped_release}"
commands << "chmod -R -- g+w #{escaped_release}" if fetch(:group_writable, true)
run commands.join(' && ') if commands.any?
end
task :migrate do
puts 'deploy:migrate not implemented'
end
task :start do
puts 'deploy:start not implemented'
end
task :stop do
puts 'deploy:stop not implemented'
end
task :restart do
puts 'deploy:restart not implemented'
end
end
after "deploy", "deploy:cleanup"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment