Skip to content

Commit

Permalink
Merge pull request #301 from hubmapconsortium/yuanzhou/maintenance
Browse files Browse the repository at this point in the history
Add maintenance mode for AVR and data-ingest-board
  • Loading branch information
yuanzhou authored Dec 18, 2023
2 parents a7d9a03 + 7f4822d commit fd2ded1
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ hubmap-auth/VERSION
hubmap-auth/src/BUILD
hubmap-auth/src/VERSION

**/.DS_Store

# log files in any path
**/*.log

Expand Down
33 changes: 32 additions & 1 deletion nginx/conf.d-prod/avr.conf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ server {
alias /usr/share/nginx/html/favicon.ico;
}

# No auth_request for maintenanc image
location = /logo.png {
alias /usr/share/nginx/html/avr-maintenance/logo.png;
}

# Exact request URI matching
location = /api_auth {
internal;
Expand Down Expand Up @@ -82,6 +87,13 @@ server {
# Send all requests to the '/api_auth' endpoint for authentication and authorization
auth_request /api_auth;

# If the file named `maintenance.on` exitis under the target directory
# proxy all the requests to that port of this same container that serves the maintenance page
if (-f /usr/share/nginx/html/avr-maintenance/maintenance.on) {
# Use IP v4 "127.0.0.1" instead of "localhost" to avoid 502 error caused by DNS failure
proxy_pass http://127.0.0.1:5033;
}

# Once authenticated/authorized, pass reqeusts to the uWSGI server using the "uwsgi" protocol on port 5000
include uwsgi_params;
uwsgi_pass uwsgi://antibody-api:5000;
Expand All @@ -91,4 +103,23 @@ server {
uwsgi_send_timeout 300s;
}

}
}

# Port 5033 runs the avr-maintenance static page index.html
# No need to public this port from the container to host
server {
# Only root can listen on ports below 1024, we use higher-numbered ports
# since nginx is running under non-root user hubmap
listen 5033;

server_name localhost;

root /usr/share/nginx/html/avr-maintenance;

# Direct all requests to maintenance index.html
# Except the static resources calls from within the maintenance index.html
location / {
# Must use /index.html rather than index.html
try_files $uri /index.html =404;
}
}
27 changes: 27 additions & 0 deletions nginx/conf.d-prod/data-ingest-board.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,34 @@ server {
}

location / {
# If the file named `maintenance.on` exitis under the target directory
# proxy all the requests to that port of this same container that serves the maintenance page
if (-f /usr/share/nginx/html/ingest-board-maintenance/maintenance.on) {
# Use IP v4 "127.0.0.1" instead of "localhost" to avoid 502 error caused by DNS failure
proxy_pass http://127.0.0.1:5034;
}

proxy_pass http://data-ingest-board:3000;
}

}

# Port 5034 runs the ingest-board-maintenance static page index.html
# No need to public this port from the container to host
server {
# Only root can listen on ports below 1024, we use higher-numbered ports
# since nginx is running under non-root user hubmap
listen 5034;

server_name localhost;

root /usr/share/nginx/html/ingest-board-maintenance;

# Direct all requests to maintenance index.html
# Except the static resources calls from within the maintenance index.html
location / {
# Must use /index.html rather than index.html
try_files $uri /index.html =404;
}
}

Binary file added nginx/html/avr-maintenance/favicon.ico
Binary file not shown.
39 changes: 39 additions & 0 deletions nginx/html/avr-maintenance/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>HuBMAP Consortium - AVR Under Maintenance</title>
<style>
html {
font-family: Arial, Helvetica, sans-serif;
}

.title {
width: 100%;
text-align: center;
padding-top: 40px;
}
.content {
text-align: center;
width: 60%;
margin-left: auto;
margin-right: auto;
}
#logo {
margin: 40px auto 20px;
}
</style>
</head>
<body>
<header class="title">
<img id="logo" src="/logo.png" width="283" height="104" alt="">
<h1>HuBMAP Consortium - AVR Under Maintenance</h1>
</header>
<section class="content">
<p>The site is currently down for maintenance.</p>
<p>Sorry for the inconvenience.</p>
</section>
</body>
</html>

Binary file added nginx/html/avr-maintenance/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added nginx/html/ingest-board-maintenance/favicon.ico
Binary file not shown.
39 changes: 39 additions & 0 deletions nginx/html/ingest-board-maintenance/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>HuBMAP Consortium - Data Ingest Board Under Maintenance</title>
<style>
html {
font-family: Arial, Helvetica, sans-serif;
}

.title {
width: 100%;
text-align: center;
padding-top: 40px;
}
.content {
text-align: center;
width: 60%;
margin-left: auto;
margin-right: auto;
}
#logo {
margin: 40px auto 20px;
}
</style>
</head>
<body>
<header class="title">
<img id="logo" src="/logo.png" width="283" height="104" alt="">
<h1>HuBMAP Consortium - Data Ingest Board Under Maintenance</h1>
</header>
<section class="content">
<p>The site is currently down for maintenance.</p>
<p>Sorry for the inconvenience.</p>
</section>
</body>
</html>

Binary file added nginx/html/ingest-board-maintenance/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions nginx/html/ingest-ui-maintenance/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>HuBMAP Consortium - Data Ingest Under Maintenance</title>
<title>HuBMAP Consortium - Ingest Portal Under Maintenance</title>
<style>
html {
font-family: Arial, Helvetica, sans-serif;
Expand All @@ -28,7 +28,7 @@
<body>
<header class="title">
<img id="logo" src="/logo.png" width="283" height="104" alt="">
<h1>HuBMAP Consortium - Data Ingest Under Maintenance</h1>
<h1>HuBMAP Consortium - Ingest Portal Under Maintenance</h1>
</header>
<section class="content">
<p>The site is currently down for maintenance.</p>
Expand Down

0 comments on commit fd2ded1

Please sign in to comment.