From 753eb22da801383f07459aeefbb0ce02a72e2ce1 Mon Sep 17 00:00:00 2001 From: Andrew Min Date: Wed, 8 May 2024 19:40:18 -0400 Subject: [PATCH 1/2] split confs --- nginx.preprod.conf | 72 ++++++++++++++++++++++++++++++++++++++++++++++ nginx.prod.conf | 68 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 nginx.preprod.conf create mode 100644 nginx.prod.conf diff --git a/nginx.preprod.conf b/nginx.preprod.conf new file mode 100644 index 0000000..4192a5a --- /dev/null +++ b/nginx.preprod.conf @@ -0,0 +1,72 @@ +# Taken from the default nginx config in our base image +# See "Customize configuration" on https://hub.docker.com/_/nginx +pid /tmp/nginx.pid; +worker_processes auto; +events { + worker_connections 1024; +} + +# Send anything from info to errors to stdout for logging +error_log /dev/stdout info; + +# Run in the foreground +daemon off; + +http { + # Taken from the default nginx config in our base image + # See "Customize configuration" on https://hub.docker.com/_/nginx + proxy_temp_path /tmp/proxy_temp; + client_body_temp_path /tmp/client_temp; + fastcgi_temp_path /tmp/fastcgi_temp; + uwsgi_temp_path /tmp/uwsgi_temp; + scgi_temp_path /tmp/scgi_temp; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + sendfile on; + keepalive_timeout 65; + gzip on; + + # Send access logs to stdout for logging + access_log /dev/stdout main; + + # Custom server blocks to serve auth and export frames on separate ports. + # Maintain recovery and auth separately for now for backwards-compatibility. + + # Preprod + server { + listen 7070; + root /usr/share/nginx/auth; + index index.preprod.html; + + # Health endpoint for k8s + location = /health { + access_log off; + add_header 'Content-Type' 'application/json'; + return 200 '{"status":"UP"}'; + } + } + + server { + listen 7071; + root /usr/share/nginx/export; + index index.preprod.html; + } + + server { + listen 7072; + root /usr/share/nginx/recovery; + index index.preprod.html; + } + + server { + listen 7073; + root /usr/share/nginx/import; + index index.preprod.html; + } +} diff --git a/nginx.prod.conf b/nginx.prod.conf new file mode 100644 index 0000000..534f454 --- /dev/null +++ b/nginx.prod.conf @@ -0,0 +1,68 @@ +# Taken from the default nginx config in our base image +# See "Customize configuration" on https://hub.docker.com/_/nginx +pid /tmp/nginx.pid; +worker_processes auto; +events { + worker_connections 1024; +} + +# Send anything from info to errors to stdout for logging +error_log /dev/stdout info; + +# Run in the foreground +daemon off; + +http { + # Taken from the default nginx config in our base image + # See "Customize configuration" on https://hub.docker.com/_/nginx + proxy_temp_path /tmp/proxy_temp; + client_body_temp_path /tmp/client_temp; + fastcgi_temp_path /tmp/fastcgi_temp; + uwsgi_temp_path /tmp/uwsgi_temp; + scgi_temp_path /tmp/scgi_temp; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + sendfile on; + keepalive_timeout 65; + gzip on; + + # Send access logs to stdout for logging + access_log /dev/stdout main; + + # Custom server blocks to serve auth and export frames on separate ports. + # Maintain recovery and auth separately for now for backwards-compatibility. + + # Prod + server { + listen 8080; + root /usr/share/nginx/auth; + + # Health endpoint for k8s + location = /health { + access_log off; + add_header 'Content-Type' 'application/json'; + return 200 '{"status":"UP"}'; + } + } + + server { + listen 8081; + root /usr/share/nginx/export; + } + + server { + listen 8082; + root /usr/share/nginx/recovery; + } + + server { + listen 8083; + root /usr/share/nginx/import; + } +} From 1b447effd0acda1e1daf117d145773bce1bf3fa7 Mon Sep 17 00:00:00 2001 From: Andrew Min Date: Wed, 8 May 2024 19:41:24 -0400 Subject: [PATCH 2/2] update dockerfile --- Dockerfile | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6333f9b..eaf4e48 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,16 +13,4 @@ COPY auth /usr/share/nginx/recovery COPY export /usr/share/nginx/export COPY import /usr/share/nginx/import -# prod -EXPOSE 8080/tcp -EXPOSE 8081/tcp -EXPOSE 8082/tcp -EXPOSE 8083/tcp - -# preprod -EXPOSE 7070/tcp -EXPOSE 7071/tcp -EXPOSE 7072/tcp -EXPOSE 7073/tcp - -CMD ["nginx"] +# leave port exposure and commands up to gitops