Skip to content

Commit

Permalink
Added maintenance page that displays during upgrades. Fixes #271
Browse files Browse the repository at this point in the history
  • Loading branch information
andypike committed Aug 4, 2013
1 parent 9a5ebfe commit c0eb4ba
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
12 changes: 12 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@
run "cd #{current_path} && bundle exec rake lagtv:populate_profile_urls RAILS_ENV=production"
end

desc "enable the maintenance message"
task :enable_maintenance do
run "cd #{current_path}/public && mv _maintenance.html maintenance.html"
end

desc "disable the maintenance message"
task :disable_maintenance do
run "cd #{current_path}/public && mv maintenance.html _maintenance.html"
end

desc "Backup the remote postgreSQL database"
task :backup do
# First lets get the remote database config file so that we can read in the database settings
Expand Down Expand Up @@ -117,12 +127,14 @@

desc "Deploys all parts of the systems and restarts workers"
task :all do
deploy.enable_maintenance
deploy.stop
deploy.backup
deploy.migrate
resque.restart
deploy.whenever
deploy.start
deploy.disable_maintenance
end
before "deploy:all", "deploy"
end
Expand Down
20 changes: 20 additions & 0 deletions config/nginx_live.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ server {
add_header Cache-Control public;
}

if (-f $document_root/maintenance.html) {
return 503;
}

error_page 503 @maintenance;
location @maintenance {
rewrite ^(.*)$ /maintenance.html last;
break;
}

try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down Expand Up @@ -47,6 +57,16 @@ server {
add_header Cache-Control public;
}

if (-f $document_root/maintenance.html) {
return 503;
}

error_page 503 @maintenance;
location @maintenance {
rewrite ^(.*)$ /maintenance.html last;
break;
}

try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down
20 changes: 20 additions & 0 deletions config/nginx_uat.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ server {
add_header Cache-Control public;
}

if (-f $document_root/maintenance.html) {
return 503;
}

error_page 503 @maintenance;
location @maintenance {
rewrite ^(.*)$ /maintenance.html last;
break;
}

try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down Expand Up @@ -41,6 +51,16 @@ server {
add_header Cache-Control public;
}

if (-f $document_root/maintenance.html) {
return 503;
}

error_page 503 @maintenance;
location @maintenance {
rewrite ^(.*)$ /maintenance.html last;
break;
}

try_files $uri/index.html $uri @unicorn;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down
30 changes: 30 additions & 0 deletions public/_maintenance.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>We are currently upgrading the site, please check back shortly.</title>
<style type="text/css">
body { background-color: #eee; color: #666; text-align: center; font-family: arial, sans-serif; }
div.dialog {
width: 45em;
padding: 0 4em 4em 4em;
margin: 4em auto 0 auto;
border: 1px solid #ccc;
border-right-color: #999;
border-bottom-color: #999;
background: #fff;
}
h1 { font-size: 100%; color: #000099; line-height: 1.5em; }
</style>
</head>

<body>
<!-- This file lives in public/system/maintenance.html -->
<div class="dialog">
<h1>The LAGTV website is currently being upgraded.</h1>
<p>Please try again in a few minutes.</p>
<p>While you're waiting, checkout some When Cheese Fails:</p>

<iframe src="http://www.youtube.com/embed/videoseries?list=SPujTwbNDCv6TdP13rcxubWd8rtgfVe6ln" width="100%" height="500" frameborder="0"></iframe>
</div>
</body>
</html>

0 comments on commit c0eb4ba

Please sign in to comment.