-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for maintenance mode. Bump version
- Loading branch information
1 parent
df342db
commit dc3da50
Showing
12 changed files
with
169 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
require File.expand_path('../lib/easy-deployment/version', __FILE__) | ||
|
||
Gem::Specification.new do |gem| | ||
gem.authors = ["Jeremy Olliver", "Nigel Ramsay", "Shevaun Coker", "Cameron Fowler"] | ||
gem.email = ["[email protected]", "[email protected]", "[email protected]", "[email protected]"] | ||
gem.authors = ["Jeremy Olliver", "Nigel Ramsay", "Shevaun Coker", "Cameron Fowler", "Joseph Leniston"] | ||
gem.email = ["[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]"] | ||
gem.description = %q{Easy deployment: includes a generator, and capistrano configuration} | ||
gem.summary = %q{Gem for encapsulating Abletech's deployment practices} | ||
gem.homepage = "https://github.com/AbleTech/easy-deployment" | ||
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem| | |
gem.license = "GPLv3" | ||
|
||
gem.add_runtime_dependency 'rails', '>= 3.0.0' | ||
gem.add_runtime_dependency 'capistrano', '~> 2.13.5' | ||
gem.add_runtime_dependency 'capistrano', '>= 2.15' | ||
|
||
gem.add_development_dependency 'bundler' | ||
gem.add_development_dependency 'rspec', '~> 2.0' | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
require "easy-deployment/version" | ||
require "easy/generators/generator_helpers" | ||
require 'easy/generators/backup_generator' | ||
require 'easy/generators/deployment_generator' | ||
require "easy/generators/generator_helpers" | ||
require 'easy/generators/maintenance_generator' | ||
require 'easy/generators/stage_generator' | ||
require 'easy/generators/backup_generator' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module Easy | ||
module Deployment | ||
VERSION = "0.6.1" | ||
VERSION = "0.6.2" | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Define a capistrano task for putting the site into maintenance mode using | ||
# turnout rack middleware. | ||
# To load this capistrano configuration, require 'easy/deployment/maintenance' from deploy.rb | ||
# | ||
Capistrano::Configuration.instance(:must_exist).load do | ||
|
||
namespace :maintenance do | ||
desc "Put the application into maintenance mode" | ||
task :start, :roles => :app do | ||
run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec rake maintenance:start" | ||
end | ||
|
||
desc "Take the application out of maintenance mode" | ||
task :end, :roles => :app do | ||
run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec rake maintenance:end" | ||
end | ||
end | ||
|
||
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'rails/generators' | ||
|
||
module Easy | ||
class MaintenanceGenerator < Rails::Generators::Base | ||
source_root File.join(File.dirname(__FILE__), "templates") # Where templates are copied from | ||
|
||
desc %{Generates a maintenance config to allow you to put your application into maintenance mode} | ||
|
||
def create_maintenance_files | ||
gem_group(:development) do | ||
gem 'turnout', '~> 2.2' | ||
end | ||
|
||
template("maintenance.rb.tt", "config/initializers/maintenance.rb") | ||
template("maintenance.html.tt", "public/maintenance.html") | ||
template("maintenance.json.tt", "public/maintenance.json") | ||
|
||
run("bundle install") | ||
|
||
say("Maintenance configuration generated", :green) | ||
say(" - TODO: edit config/maintenance.rb setting default_maintenance_page, default_reason and other configuration options", :green) | ||
say(" - TODO: edit public/maintenance.html to match site styles", :green) | ||
|
||
true | ||
end | ||
|
||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Down for Maintenance</title> | ||
|
||
<style type="text/css"> | ||
|
||
*{ | ||
font-family: Arial, Helvetica, sans-serif; | ||
} | ||
|
||
body{ | ||
margin: 0; | ||
background-color: #fff; | ||
} | ||
|
||
#page{ | ||
position: relative; | ||
width: 550px; | ||
margin: 200px auto; | ||
padding: 75px 0; | ||
text-align: center; | ||
background-color: #eaeaea; | ||
border: solid 1px #ccc; | ||
border-top: solid 10px #666; | ||
-moz-box-shadow: inset 0 2px 10px #ccc; | ||
-webkit-box-shadow: inset 0 2px 10px #ccc; | ||
box-shadow: inset 0 2px 10px #ccc; | ||
} | ||
|
||
header, #body{ | ||
width: 400px; | ||
margin: 0 auto; | ||
} | ||
|
||
h1{ | ||
margin: 0; | ||
color: #CC3601; | ||
font-size: 26pt; | ||
border-bottom: solid 4px #666; | ||
} | ||
|
||
#reason{ | ||
margin: 10px 0; | ||
color: #333; | ||
} | ||
|
||
</style> | ||
|
||
</head> | ||
<body> | ||
|
||
<section id="page"> | ||
|
||
<header> | ||
<h1>Down for Maintenance</h1> | ||
</header> | ||
|
||
<section id="body"> | ||
<div> | ||
{{ reason }} | ||
</div> | ||
</section> | ||
|
||
</section> | ||
|
||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"error":"Service Unavailable","message":{{ reason }}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Use this file to easily configure your app in maintenance mode. e.g. Override | ||
# the default maintenance.html file with your own. | ||
# | ||
# See: https://github.com/biola/turnout#configuration for details on customization | ||
|
||
# This is the rails root location, given this file is located at in Rails.root/config/maintenance.rb | ||
rails_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) | ||
|
||
|
||
Turnout.configure do |config| | ||
config.app_root = rails_root | ||
config.named_maintenance_file_paths = {default: config.app_root.join('tmp', 'maintenance.yml').to_s} | ||
config.default_maintenance_page = Turnout::MaintenancePage::HTML | ||
config.default_reason = "The site is temporarily down for maintenance.\nPlease check back soon." | ||
config.default_allowed_paths = ['/admin','/assets'] | ||
config.default_response_code = 503 | ||
config.default_retry_after = 3600 | ||
end |