9lnzfw
Last Updated: February 25, 2016
·
2.18K
· mnbbrown

Deploy Static Website using Capistrano

My config/deploy.rb

set :domain, 'your.vps.com'
set :application, 'your.website.com'
set :github_user, 'mnbbrown'
set :user, 'www-deploy'

# the rest should be good
set :repository,  "git@github.com:#{github_user}/#{application}.git"
set :deploy_to, "/srv/www/#{application}/public"  # or whatever path you want to copy it to
set :deploy_via, :remote_cache
set :port, 22
set :scm, 'git'
set :branch, 'master'
set :scm_verbose, true
set :use_sudo, false
set :copy_exclude, [".git", ".DS_Store", ".gitignore", ".gitmodules","*.esproj"]

server domain, :app, :web
after "deploy", "deploy:minify_js" 

namespace :deploy do
    task :minify_js, :roles => :app do
        run "find #{release_path}/js/ -name '*.js' -print0 | xargs -0 -I file uglifyjs --overwrite --no-mangle file"
    end
end