Last active
December 11, 2015 22:08
-
-
Save danbt79/4667228 to your computer and use it in GitHub Desktop.
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
# =================================== | |
# Capistrano Multistage Configuration | |
# =================================== | |
# 1) Let your 'config/deploy.rb' know that you're using multistage | |
# =================================== | |
# config/deploy.rb | |
# =================================== | |
set :stages, %w(staging production) | |
set :default_stage, "staging" | |
require 'capistrano/ext/multistage' | |
# =================================== | |
# 2) Define each stage in 'config/deploy/[stage].rb' | |
# =================================== | |
# e.g. config/deploy/[production].rb | |
# =================================== | |
# Define : Environment | |
set :rails_env, 'production' | |
set :branch, 'production' | |
# Define : Targets & Roles | |
role :app, "192.168.1.1" | |
role :web, "192.168.1.1" | |
role :db, "192.168.1.1" | |
# Define : Endpoint | |
set :application, "myrailsapp.com" | |
set :deploy_to, "/home/user/sites/#{application}" | |
# Prompt our User! | |
# Make sure we really want to target this environment: | |
puts "\e[0;35m ============================\e[0m\n" | |
puts "\e[0;35m Really deploy to PRODUCTION?\e[0m\n" | |
puts "\e[0;35m ============================\e[0m\n" | |
# Fetch user response | |
response = Capistrano::CLI.ui.ask "\e[0;32m [y]es or [n]o?\e[0m\n" | |
# Abort if required | |
unless response.to_s == 'y' | |
puts "\e[0;31m Aborting......\e[0m\n" | |
exit | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment