Skip to content

Commit

Permalink
Merge pull request #112 from hubmapconsortium/test-release
Browse files Browse the repository at this point in the history
v2.0.13 release
  • Loading branch information
yuanzhou authored Aug 2, 2021
2 parents 4ab77bd + 1fc8155 commit 5d48bf8
Show file tree
Hide file tree
Showing 4 changed files with 218 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.12
2.0.13
108 changes: 108 additions & 0 deletions nginx/conf.d-dev/antibody-api.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Define the upstream antibody-api-server to be used by other containers on the same docker network
upstream antibody-api-server {
server localhost:8888;
}

# 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 antibody-api.dev.hubmapconsortium.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 antibody-api.dev.hubmapconsortium.org;
root /usr/share/nginx/html;

ssl_certificate /etc/letsencrypt/live/gateway.dev.hubmapconsortium.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/gateway.dev.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_antibody-api.log;
error_log /usr/src/app/log/nginx_error_antibody-api.log warn;

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

location / {
# Always enable CORS
# Response to preflight requests
if ($request_method = 'OPTIONS') {
# The directive `add_header` doesn't work when response status code is 401, 403 or 500
# The `always` parameter is specified so the header field will be added regardless of the response code
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, OPTIONS' always;

# Custom headers and headers various browsers should be OK with but aren't
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,Authorization, MAuthorization,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;

# Cache the response to this preflight request in browser for 24 hours (86400 seconds)
# without sending another preflight request
add_header 'Access-Control-Max-Age' 86400 always;

add_header 'Content-Type' 'text/plain; charset=utf-8' always;
add_header 'Content-Length' 0 always;
return 204;
}

# Response to the original requests (HTTP methods are case-sensitive) with CORS enabled
if ($request_method ~ (POST|GET|PUT)) {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,Authorization, MAuthorization,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
}

# Pass reqeusts to the uWSGI server using the "uwsgi" protocol on port 5000
include uwsgi_params;
# Here "antibody-api" is the hostname defined in `docker-compose.yml`
# We have to use this hostname because the entity API is running on a different container
uwsgi_pass uwsgi://antibody-api:5000;
}

}



# antibody-api-server
# `http://hubmap-auth:8888` can be used by gateway
# to make calls to antibody-api directly bypassing gateway
server {
# Only root can listen on ports below 1024, we use higher-numbered ports
# since nginx is running under non-root user hubmap
listen 8888;

server_name localhost;
root /usr/share/nginx/html;

# We need this logging for inspecting auth requests from other internal services
# Logging to the mounted volume for outside container access
access_log /usr/src/app/log/nginx_access_antibody-api-server.log;
error_log /usr/src/app/log/nginx_error_antibody-api-server.log warn;

location = /favicon.ico {
alias /usr/share/nginx/html/favicon.ico;
}

# Pass reqeusts to the uWSGI server using the "uwsgi" protocol on port 5000
location / {
include uwsgi_params;
# Here "antibody-api" is the hostname defined in `docker-compose.yml`
# We have to use this hostname because the entity API is running on a different container
uwsgi_pass uwsgi://antibody-api:5000;
}

}
108 changes: 108 additions & 0 deletions nginx/conf.d-stage/antibody-api.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Define the upstream antibody-api-server to be used by other containers on the same docker network
upstream antibody-api-server {
server localhost:8888;
}

# 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 antibody-api.stage.hubmapconsortium.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 antibody-api.stage.hubmapconsortium.org;
root /usr/share/nginx/html;

ssl_certificate /etc/letsencrypt/live/gateway.stage.hubmapconsortium.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/gateway.stage.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_antibody-api.log;
error_log /usr/src/app/log/nginx_error_antibody-api.log warn;

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

location / {
# Always enable CORS
# Response to preflight requests
if ($request_method = 'OPTIONS') {
# The directive `add_header` doesn't work when response status code is 401, 403 or 500
# The `always` parameter is specified so the header field will be added regardless of the response code
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, OPTIONS' always;

# Custom headers and headers various browsers should be OK with but aren't
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,Authorization, MAuthorization,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;

# Cache the response to this preflight request in browser for 24 hours (86400 seconds)
# without sending another preflight request
add_header 'Access-Control-Max-Age' 86400 always;

add_header 'Content-Type' 'text/plain; charset=utf-8' always;
add_header 'Content-Length' 0 always;
return 204;
}

# Response to the original requests (HTTP methods are case-sensitive) with CORS enabled
if ($request_method ~ (POST|GET|PUT)) {
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,Authorization, MAuthorization,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
}

# Pass reqeusts to the uWSGI server using the "uwsgi" protocol on port 5000
include uwsgi_params;
# Here "antibody-api" is the hostname defined in `docker-compose.yml`
# We have to use this hostname because the entity API is running on a different container
uwsgi_pass uwsgi://antibody-api:5000;
}

}



# antibody-api-server
# `http://hubmap-auth:8888` can be used by gateway
# to make calls to antibody-api directly bypassing gateway
server {
# Only root can listen on ports below 1024, we use higher-numbered ports
# since nginx is running under non-root user hubmap
listen 8888;

server_name localhost;
root /usr/share/nginx/html;

# We need this logging for inspecting auth requests from other internal services
# Logging to the mounted volume for outside container access
access_log /usr/src/app/log/nginx_access_antibody-api-server.log;
error_log /usr/src/app/log/nginx_error_antibody-api-server.log warn;

location = /favicon.ico {
alias /usr/share/nginx/html/favicon.ico;
}

# Pass reqeusts to the uWSGI server using the "uwsgi" protocol on port 5000
location / {
include uwsgi_params;
# Here "antibody-api" is the hostname defined in `docker-compose.yml`
# We have to use this hostname because the entity API is running on a different container
uwsgi_pass uwsgi://antibody-api:5000;
}

}
2 changes: 1 addition & 1 deletion nginx/conf.d-test/antibody-api.conf
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ server {
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
}

# Once authenticated/authorized, pass reqeusts to the uWSGI server using the "uwsgi" protocol on port 5000
# Pass reqeusts to the uWSGI server using the "uwsgi" protocol on port 5000
include uwsgi_params;
# Here "antibody-api" is the hostname defined in `docker-compose.yml`
# We have to use this hostname because the entity API is running on a different container
Expand Down

0 comments on commit 5d48bf8

Please sign in to comment.