Skip to content

Instantly share code, notes, and snippets.

@matt-morris
Forked from bdeterling/Static site capfile
Created June 2, 2016 16:00
Show Gist options
  • Save matt-morris/f8f7d35202d088a8d4990fd18963dde3 to your computer and use it in GitHub Desktop.
Save matt-morris/f8f7d35202d088a8d4990fd18963dde3 to your computer and use it in GitHub Desktop.
Example of using Capistrano for a static website
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
default_run_options[:pty] = true
# be sure to change these
set :github_user, '<github_user_name>'
set :github_application, "<repository_name>"
set :user, '<user_on_server>'
set :domain, '<server_name>'
set :application, '<domain_name_of_static_site>'
# the rest should be good
set :repository, "[email protected]:#{github_user}/#{github_application}.git"
set :deploy_to, "/var/apps/#{application}" # or whatever path you want to copy it to
set :deploy_via, :remote_cache
set :scm, 'git'
set :branch, 'master'
set :git_shallow_clone, 1
set :scm_verbose, true
set :use_sudo, false
server domain, :app, :web
# xbit is a script that runs chmod +x on all html files
# because the site uses server side includes
namespace :deploy do
task :xbit do
run "cd /var/apps/#{application}/current; ../xbit"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment