2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-11 15:51:03 +00:00

[fix] Added 502 Page to bench nginx config

This commit is contained in:
Shreyas Patil 2016-07-14 15:44:05 +05:30 committed by Anand Doshi
parent cd5206a11a
commit 3b1e23b1b2
3 changed files with 109 additions and 0 deletions

View File

@ -19,6 +19,7 @@ def make_nginx_conf(bench_path, yes=False):
"webserver_port": config.get('webserver_port'),
"socketio_port": config.get('socketio_port'),
"bench_name": get_bench_name(bench_path),
"error_pages": get_error_pages(),
# for nginx map variable
"random_string": "".join(random.choice(string.ascii_lowercase) for i in xrange(7))
@ -147,3 +148,11 @@ def use_wildcard_certificate(bench_path, ret):
site['ssl_certificate_key'] = ssl_certificate_key
site['wildcard'] = 1
def get_error_pages():
import bench
bench_app_path = os.path.abspath(bench.__path__[0])
templates = os.path.join(bench_app_path, 'config', 'templates')
return {
502: os.path.join(templates, '502.html')
}

View File

@ -0,0 +1,89 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sorry! We will be back soon.</title>
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, "Open Sans", sans-serif;
color: #36414C;
font-weight: 300;
}
.page-container {
max-width: 800px;
padding: 15px;
vertical-align: middle;
position: absolute;
top: 50%;
left: 0;
right: 0;
margin: 0 auto;
transform: translate(0%, -50%);
}
.svg-container {
float: left;
width: 150px;
padding-top: 24px;
}
.message-container {
float: left;
padding-left: 15px;
font-size: 16px;
line-height: 1.6;
}
.message-container h1 {
font-size: 48px;
line-height: 1.2;
font-weight: 200;
}
.message-container .message {
color: #8D99A6;
}
.clearfix {
clear: both;
}
a {
color: #5E64FF;
}
@media (max-width: 767px) {
.svg-container {
float: none;
padding-top: 0px;
}
.message-container {
float: none;
width: 100% !important;
}
}
</style>
</head>
<body>
<div class="page-container">
<div class="svg-container">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" viewBox="0 0 32 32" version="1.1" x="0px" y="0px"><title>sad-face-avatar-boy-man-11</title><desc>Created with Sketch.</desc><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage"><path d="M24.5728851,23.0941141 C26.0847779,16.969087 23.5542402,12.1548858 21.4280864,11.0822754 C19.598459,12.7549171 13.9938462,17 10.2890466,17 C12.2343263,15.4384766 12.8488535,12.9394531 12.8488535,12.9394531 C12.8488535,12.9394531 10.9859461,15.7346191 7.24611965,17 C6.45154466,18.5731485 6.67682658,20.3507184 6.78659707,21.5361582 C6.84777749,21.7403698 6.95210509,22.0855229 6.99214296,22.1994274 C7.09055416,22.4793995 7.21210961,22.7924224 7.35775135,23.1301118 C7.774276,24.0958785 8.2986796,25.0616511 8.9372701,25.9603932 C10.738893,28.4959687 13.0675623,30 16,30 C18.9311427,30 21.2399187,28.4973998 23.0104666,25.9636063 C23.6381381,25.065359 24.1509411,24.1000358 24.5559252,23.1346951 C24.5616169,23.1211281 24.5672702,23.1076009 24.5728851,23.0941141 L24.5728851,23.0941141 Z M5.94669386,22.2116429 C4.61458602,20.1217921 3.13011281,13.1987617 4.62664708,8.75830078 C6.40621687,3.47802734 12.6103081,1 15.7729333,1 C18.8013894,1.00000002 21.8450169,1.93994141 23.0552307,3.80615234 C23.0552307,3.80615234 25.0915798,2.75024414 26.9020692,3.80615234 C25.0915798,4.17895508 24.887945,5.19335938 24.887945,5.19335938 C27.9234944,6.90377632 29.4577737,17.0840684 26.1082885,21.6811732 C26.0708438,21.8119773 25.9120331,22.3649335 25.857287,22.526075 C25.7549564,22.8272785 25.6289716,23.1618434 25.4780638,23.5215549 C25.0472763,24.5484017 24.5017812,25.575266 23.8301706,26.5363937 C21.888484,29.3151002 19.2996007,31 16,31 C12.7016943,31 10.0952049,29.3165313 8.12209422,26.5396068 C7.43952798,25.5789739 6.88219633,24.552559 6.43951227,23.5261382 C6.28443097,23.166562 6.15455941,22.832124 6.04872776,22.5310413 C6.02660008,22.4680898 5.98792403,22.3454665 5.94669386,22.2116429 L5.94669386,22.2116429 Z M20.6103625,20.496219 L21.7234973,21.0527864 C21.9704865,21.176281 22.0705987,21.4766175 21.9471041,21.7236068 C21.8236094,21.970596 21.5232729,22.0707082 21.2762837,21.9472136 L19.2762837,20.9472136 C18.9077594,20.7629515 18.9077594,20.2370485 19.2762837,20.0527864 L21.2762837,19.0527864 C21.5232729,18.9292918 21.8236094,19.029404 21.9471041,19.2763932 C22.0705987,19.5233825 21.9704865,19.823719 21.7234973,19.9472136 L20.6103625,20.496219 Z M11.389528,20.496219 L10.2763932,21.0527864 C10.029404,21.176281 9.92929178,21.4766175 10.0527864,21.7236068 C10.176281,21.970596 10.4766175,22.0707082 10.7236068,21.9472136 L12.7236068,20.9472136 C13.0921311,20.7629515 13.0921311,20.2370485 12.7236068,20.0527864 L10.7236068,19.0527864 C10.4766175,18.9292918 10.176281,19.029404 10.0527864,19.2763932 C9.92929178,19.5233825 10.029404,19.823719 10.2763932,19.9472136 L11.389528,20.496219 Z M14.4246316,26.7639848 C14.4725953,26.6868331 14.5938453,26.5444206 14.7863941,26.3975309 C15.1127054,26.1485979 15.512309,26 16,26 C16.487691,26 16.8872946,26.1485979 17.2136059,26.3975309 C17.4061547,26.5444206 17.5274047,26.6868331 17.5753684,26.7639848 C17.7211632,26.9985024 18.0294673,27.0704264 18.2639848,26.9246316 C18.4985024,26.7788368 18.5704264,26.4705327 18.4246316,26.2360152 C18.3171754,26.0631669 18.1191505,25.8305794 17.8201344,25.6024691 C17.3271707,25.2264021 16.7183393,25 16,25 C15.2816607,25 14.6728293,25.2264021 14.1798656,25.6024691 C13.8808495,25.8305794 13.6828246,26.0631669 13.5753684,26.2360152 C13.4295736,26.4705327 13.5014976,26.7788368 13.7360152,26.9246316 C13.9705327,27.0704264 14.2788368,26.9985024 14.4246316,26.7639848 Z" fill="#000000" sketch:type="MSShapeGroup"></path></g></svg>
</div>
<div class="message-container" style="width: calc(100% - 170px);">
<h1>
Sorry! <br>
We will be back soon.
</h1>
<p class="message">
<strong>Don't panic.</strong> It's not you, it's us.<br>
Most likely, our engineers are updating the code,
and it should take a minute for the new code to load into memory.<br><br>
Try refreshing after a minute or two.
</p>
</div>
<div class="clearfix"></div>
</div>
</body>
</html>

View File

@ -67,6 +67,17 @@ server {
proxy_pass http://{{ bench_name }}-frappe;
}
# error pages
{% for error_code, error_page in error_pages.items() -%}
error_page {{ error_code }} /{{ error_page.split('/')[-1] }};
location /{{ error_code }}.html {
root {{ '/'.join(error_page.split('/')[:-1]) }};
internal;
}
{% endfor -%}
# optimizations
sendfile on;
keepalive_timeout 15;