Last active
August 29, 2015 14:17
-
-
Save jose8a/7f5668708f4c5c5f84a7 to your computer and use it in GitHub Desktop.
Capfile, deploy.rb and production.rb -- modified from original outlines according to the Deploying Rails Applications book instructions (Quickstarts Ch4 and 16)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load DSL and Setup Up Stages | |
require 'capistrano/setup' | |
# Includes default deployment tasks | |
require 'capistrano/deploy' | |
# Includes tasks from other gems included in your Gemfile | |
# | |
# For documentation on these, see for example: | |
# | |
# https://github.com/capistrano/rvm | |
# https://github.com/capistrano/rbenv | |
# https://github.com/capistrano/chruby | |
# https://github.com/capistrano/bundler | |
# https://github.com/capistrano/rails | |
# | |
# require 'capistrano/rvm' | |
require 'capistrano/rbenv' | |
# require 'capistrano/chruby' | |
require 'capistrano/bundler' | |
require 'capistrano/rails/assets' | |
require 'capistrano/rails/migrations' | |
require 'capistrano/cookbook' | |
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined. | |
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lock '3.4.0' | |
set :log_level, :debug | |
set :application, 'yojobs' | |
set :deploy_user, 'deploy' | |
set :ssh_options, { :forward_agent => true} | |
set :ssh_options, { verbose: :debug } | |
#setup repo details | |
set :scm, :git | |
set :repo_url, '[email protected]/jose8a/yojobs.git' | |
# setup rvm | |
set :rbenv_type, :system | |
set :rbenv_ruby, '2.1.2' | |
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec" | |
set :rbenv_map_bins, %w{rake gem bundle ruby rails} | |
# how many old releases do we want to keep, not much | |
set :keep_releases, 5 | |
# files we want symlinking to specific entries in shared | |
set :linked_files, %w{config/database.yml config/secrets.yml} | |
# dirs we want symlinking to shared | |
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system} | |
# this: | |
# http://www.capistranorb.com/documentation/getting-started/flow/ | |
# is worth reading for a quick overview of what tasks are called | |
# and when for `cap stage deploy` | |
namespace :deploy do | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set :stage, :production | |
set :branch, "master" | |
# This is used in the Nginx VirtualHost to specify which domains | |
# the app should appear on. If you don't yet have DNS setup, you'll | |
# need to create entries in your local Hosts file for testing. | |
set :server_name, 'MY.IP.ADDR.ESS' # note the actual IP is being masked just for this gist | |
# used in case we're deploying multiple versions of the same app | |
# side by side. Also provides quick sanity checks when looking at | |
# filepaths | |
set :full_path_name, "#{fetch(:application)}_#{fetch(:stage)}" | |
# note the actual IP is being masked just for this gist: | |
server 'MY.IP.ADDR.ESS', user: 'deploy', roles: %w{web app db}, primary: true | |
set :deploy_to, "/home/#{fetch(:deploy_user)}/apps/#{fetch(:full_app_name)}" | |
# don't try to infer something as important as environment from stage name | |
set :rails_env, :production | |
# number of unicorn workers, this will be reflected in | |
# the unicorn.rb and the monit configs | |
set :unicorn_worker_count, 5 | |
# wether we're using ssl or not, used for building nginx | |
# config file | |
set :enable_ssl, false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment