Skip to content

Commit

Permalink
Merge pull request #314 from hubmapconsortium/yuanzhou/ubkg-download
Browse files Browse the repository at this point in the history
Add ubkg-download nginx
  • Loading branch information
yuanzhou authored Apr 23, 2024
2 parents f227c81 + 730e92b commit 141654e
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 1 deletion.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.31
2.1.32
66 changes: 66 additions & 0 deletions nginx/conf.d-prod/ubkg-download.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Port 80 on host maps to 8080 on container
server {
# Only root can listen on ports below 1024, we use higher-numbered ports
# since nginx is running under non-root user hubmap
listen 8080;
server_name ubkg-downloads.xconsortia.org;

location / {
return 301 https://$host$request_uri;
}
}

# Port 443 on host maps to 4430 on container
server {
# Only root can listen on ports below 1024, we use higher-numbered ports
# since nginx is running under non-root user hubmap
listen 4430 ssl; # managed by Certbot
server_name ubkg-downloads.xconsortia.org;
root /usr/share/nginx/html;

ssl_certificate /etc/letsencrypt/live/gateway.api.hubmapconsortium.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/gateway.api.hubmapconsortium.org/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

# Logging to the mounted volume for outside container access
access_log /usr/src/app/log/nginx_access_ubkg-download.log;
error_log /usr/src/app/log/nginx_error_ubkg-download.log warn;

# No auth_request for favicon
location = /favicon.ico {
alias /usr/share/nginx/html/favicon.ico;
}

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/ubkg-download-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:5035;
}

proxy_pass http://ubkg-download:3000;
}

}

# Port 5035 runs the ubkg-download-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 5035;

server_name localhost;

root /usr/share/nginx/html/ubkg-download-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/ubkg-download-maintenance/favicon.ico
Binary file not shown.
39 changes: 39 additions & 0 deletions nginx/html/ubkg-download-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 - UBKG Download 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 - UBKG Download 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/ubkg-download-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.

0 comments on commit 141654e

Please sign in to comment.