Skip to content

Instantly share code, notes, and snippets.

@pixeltrix
Created November 24, 2010 16:23
Show Gist options
  • Save pixeltrix/713912 to your computer and use it in GitHub Desktop.
Save pixeltrix/713912 to your computer and use it in GitHub Desktop.
Single file deployment config for a Jekyll based website
load 'deploy'
set :stages, [:staging, :production]
set :default_stage, :staging
require 'capistrano/ext/multistage'
task :staging do
set :stage, :staging
set :user, '<ssh-user-staging>'
role :app, '<your-staging-server>', :primary => true
end
task :production do
set :stage, :production
set :user, '<ssh-user-production>'
role :app, '<your-production-server>', :primary => true
end
set :application, '<your-website-name>'
set :repository, '_site'
set :scm, :none
set :deploy_to, "/var/www/#{application}"
set :deploy_via, :copy
set :keep_releases, 3
set :shared_children, %w(log)
set :use_sudo, false
default_run_options[:pty] = true
set :group_writable, false
namespace :deploy do
%w[cold migrate migrations start stop upload web].each do |name|
tasks.delete(name.to_sym)
end
%w[pending web].each do |name|
namespaces.delete(name.to_sym)
end
%w[restart finalize_update].each do |name|
task(name.to_sym, :roles => :app){ }
end
end
before 'deploy:update_code' do
system('rm -rf _site && jekyll')
end
after 'deploy:setup' do
run "chmod -R g-w #{deploy_to}" if !fetch(:group_writable, true)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment