Skip to content

Commit 9b6a52f

Browse files
committed
Draft files
1 parent f431fa2 commit 9b6a52f

File tree

5 files changed

+179
-0
lines changed

5 files changed

+179
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"errors": ["Oops! Something went wrong. Please try again."]
3+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
server {
2+
listen 80;
3+
listen [::]:80;
4+
server_name localhost;
5+
6+
error_page 503 /503.json;
7+
8+
location / {
9+
return 503;
10+
}
11+
12+
location = /503.json {
13+
default_type application/json;
14+
15+
add_header Retry-After "10" always; # https://serverfault.com/a/647552
16+
17+
root /usr/share/nginx/api;
18+
}
19+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<html style="overflow: hidden; margin: 0px; padding: 0px; height: 100%; width: 100%;"><head>
2+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
3+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
4+
5+
<!-- Setup the viewport for mobile and desktop environments -->
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
7+
8+
<!-- Configure linking of this application to the home screen of mobile devices -->
9+
<meta name="apple-mobile-web-app-title" content="${name}">
10+
<meta name="mobile-web-app-capable" content="yes">
11+
<meta name="apple-mobile-web-app-capable" content="yes">
12+
<meta name="apple-mobile-web-app-status-bar-style" content="default">
13+
<meta name="msapplication-tap-highlight" content="no">
14+
15+
<!-- Disable chrome translation requests and automatic phone number linking -->
16+
<meta name="google" value="notranslate">
17+
18+
<style>
19+
body {
20+
padding: 0px;
21+
margin: 0px;
22+
width: 100%;
23+
height: 100%;
24+
position: fixed;
25+
-webkit-touch-callout: none !important;
26+
overflow: hidden;
27+
background-color: #202020;
28+
}
29+
30+
.container {
31+
position: relative;
32+
text-align: center;
33+
color: white;
34+
}
35+
.box {
36+
/* 50% darker than the main color bg */
37+
opacity: .7;
38+
padding-bottom: 20px;
39+
padding-top: 1px;
40+
padding-right: 40px;
41+
padding-left: 40px;
42+
}
43+
.centered {
44+
position: absolute;
45+
top: 40%;
46+
left: 50%;
47+
transform: translate(-50%, -50%);
48+
}
49+
h2 {
50+
font-family: "Helvetica";
51+
font-size: 2.4em;
52+
color: white;
53+
text-align: center;
54+
}
55+
</style>
56+
57+
<title>Oops</title>
58+
59+
<noscript>
60+
<meta http-equiv="refresh" content="0; url=nojs.html"/>
61+
</noscript>
62+
<body>
63+
<div class="container"></div>
64+
<div class="centered">
65+
<div class="box">
66+
<h2>
67+
Oops! Something went wrong.<br>Please try again.
68+
</h2>
69+
</div>
70+
</div>
71+
</section>
72+
</body>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
server {
2+
listen 80;
3+
listen [::]:80;
4+
server_name localhost;
5+
6+
error_page 503 /503.html;
7+
8+
location / {
9+
return 503;
10+
}
11+
12+
location = /503.html {
13+
default_type text/html;
14+
15+
add_header Retry-After "10" always; # https://serverfault.com/a/647552
16+
17+
root /usr/share/nginx/html;
18+
}
19+
}

services/traefik/docker-compose.yml.j2

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,72 @@ services:
204204
networks:
205205
- public
206206
207+
fallback-service-web:
208+
image: nginx:1.25.1
209+
configs:
210+
- source: web_html
211+
target: /usr/share/nginx/html/503.html
212+
- source: web_nginx_config
213+
target: /etc/nginx/conf.d/default.conf
214+
networks:
215+
- public
216+
- monitored
217+
deploy:
218+
placement:
219+
constraints:
220+
- node.labels.simcore==true
221+
update_config:
222+
order: start-first
223+
labels:
224+
- traefik.enable=true
225+
- traefik.docker.network=${PUBLIC_NETWORK}
226+
- traefik.http.routers.fallback_html.priority=3
227+
- traefik.http.routers.fallback_html.tls=true
228+
- traefik.http.routers.fallback_html.rule=Host(`fallback.osparc.local`)
229+
- traefik.http.services.fallback_html.loadbalancer.server.port=80
230+
- traefik.http.routers.fallback_html.entrypoints=https
231+
232+
fallback-service-api:
233+
image: nginx:1.25.1
234+
configs:
235+
- source: api_json
236+
target: /usr/share/nginx/api/503.json
237+
- source: api_nginx_config
238+
target: /etc/nginx/conf.d/default.conf
239+
networks:
240+
- public
241+
- monitored
242+
deploy:
243+
placement:
244+
constraints:
245+
- node.labels.simcore==true
246+
update_config:
247+
order: start-first
248+
labels:
249+
- traefik.enable=true
250+
- traefik.docker.network=${PUBLIC_NETWORK}
251+
- traefik.http.routers.fallback_api.priority=3
252+
- traefik.http.routers.fallback_api.tls=true
253+
- traefik.http.routers.fallback_api.rule=Host(`fallback-api.osparc.local`)
254+
- traefik.http.services.fallback_api.loadbalancer.server.port=80
255+
- traefik.http.routers.fallback_api.entrypoints=https
256+
257+
{%- raw %}
258+
configs:
259+
web_html:
260+
file: ./config/web/503.html
261+
name: web_html_${DOCKER_IMAGE_TAG?error} # exit with error if not defined
262+
api_json:
263+
file: ./config/api/503.json
264+
name: api_json_${DOCKER_IMAGE_TAG?error}
265+
web_nginx_config:
266+
file: ./config/web/default.conf
267+
name: web_nginx_config_${DOCKER_IMAGE_TAG?error}
268+
api_nginx_config:
269+
file: ./config/api/default.conf
270+
name: api_nginx_config_${DOCKER_IMAGE_TAG?error}
271+
{% endraw %}
272+
207273
networks:
208274
public:
209275
external: true

0 commit comments

Comments
 (0)