Skip to content

Instantly share code, notes, and snippets.

@neurodynamic
Last active August 29, 2015 14:24
Show Gist options
  • Save neurodynamic/bb0498675512608ccfd4 to your computer and use it in GitHub Desktop.
Save neurodynamic/bb0498675512608ccfd4 to your computer and use it in GitHub Desktop.
Files for deploying a Volt application to Digital Ocean via Intercity (files not included here need no alteration from standard Intercity setup)
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
require "capistrano/bundler" # NOTICE: capistrano/bundler, not capistrano/rails
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
# config/deploy.rb
lock '>= 3.1.0'
set :application, 'APP_NAME'
set :repo_url, '[email protected]:GITHUB_USERNAME/GITHUB_REPO_NAME.git'
# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
# Default deploy_to directory is /var/www/my_app
set :deploy_to, '/u/apps/APP_FOLDER_NAME'
# Use agent forwarding for SSH so you can deploy with the SSH key on your workstation.
set :ssh_options, {
forward_agent: true
}
# Default value for :pty is false
set :pty, true
# Default value for :linked_files is []
set :linked_files, fetch(:linked_files, []).push('.rbenv-vars', '.ruby-version')
# Default value for linked_dirs is []
# set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
# Default value for default_env is {}
set :default_env, { path: "/opt/rbenv/shims:$PATH" }
# Default value for keep_releases is 5
# set :keep_releases, 5
namespace :deploy do
# UNCOMMENTING THIS RESTART-ON-PUBLISH STUFF THROWS AN ENCODING ERROR AT PRESENT. HAVEN'T FIGURED OUT WHY YET.
# desc 'Restart application'
# task :restart do
# on roles(:app), in: :sequence, wait: 5 do
# execute :touch, release_path.join('tmp/restart.txt')
# end
# end
# after :publishing, :restart
end
# Should include the following lines in addition to Volt-related included gems:
# Reference: http://stackoverflow.com/questions/31036672/invalidbytesequenceerror-deploying-volt-via-intercity/31279290
Encoding.default_external = Encoding::UTF_8
Encoding.default_internal = Encoding::UTF_8
gem 'capistrano'
gem "capistrano-bundler"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment