From e77254eabf0ea92753de4f1fe83370c2af66e866 Mon Sep 17 00:00:00 2001 From: Ryan Kegel Date: Fri, 1 May 2026 18:49:48 -0400 Subject: [PATCH] feat: add dynamic dialog max width to ModalDialog component --- docker-compose.test.yml | 3 ++- docker-compose.yml | 3 ++- frontend/Dockerfile | 14 +++++------ frontend/docker/start-nginx.sh | 18 ++++++++++++++ frontend/e2e/.auth/user-cc.json | 14 +++++------ frontend/e2e/.auth/user-delete.json | 14 +++++------ frontend/e2e/.auth/user.json | 14 +++++------ frontend/nginx.http.conf.template | 37 +++++++++++++++++++++++++++++ 8 files changed, 86 insertions(+), 31 deletions(-) create mode 100644 frontend/docker/start-nginx.sh create mode 100644 frontend/nginx.http.conf.template diff --git a/docker-compose.test.yml b/docker-compose.test.yml index e7a19b2..1731bd7 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -29,9 +29,10 @@ services: chores-test-app-frontend: # Test frontend service name image: git.ryankegel.com:3000/kegel/chores/frontend:next # Use latest next tag ports: - - "446:443" # Host 446 -> Container 443 (HTTPS) + - "446:80" # Host 446 -> Container 80 (HTTP behind external TLS proxy) environment: - BACKEND_HOST=chores-test-app-backend # Points to internal backend service + - FRONTEND_SSL_ENABLED=false depends_on: - chores-test-app-backend # Add volumes, networks, etc., as needed diff --git a/docker-compose.yml b/docker-compose.yml index a6130bc..7b11423 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,9 +25,10 @@ services: image: git.ryankegel.com:3000/kegel/chores/frontend:latest # Or specific version tag container_name: chores-app-frontend-prod # Added for easy identification ports: - - "${FRONTEND_HOST_PORT:-4601}:443" # Host port -> Container 443 (HTTPS) + - "${FRONTEND_HOST_PORT:-4601}:${FRONTEND_CONTAINER_PORT:-443}" # Host port -> Container 443 (HTTPS) or 80 (HTTP) environment: - BACKEND_HOST=chores-app-backend # Points to internal backend service + - FRONTEND_SSL_ENABLED=${FRONTEND_SSL_ENABLED:-true} depends_on: - chores-app-backend networks: diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 0c1108f..61e42d6 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,17 +10,15 @@ RUN npm run build FROM nginx:alpine COPY --from=build /app/dist /usr/share/nginx/html COPY nginx.conf.template /etc/nginx/nginx.conf.template -# Copy SSL certificate and key -#COPY 192.168.1.102+1.pem /etc/nginx/ssl/server.crt -#COPY 192.168.1.102+1-key.pem /etc/nginx/ssl/server.key +COPY nginx.http.conf.template /etc/nginx/nginx.http.conf.template +COPY docker/start-nginx.sh /docker/start-nginx.sh +RUN chmod +x /docker/start-nginx.sh EXPOSE 80 EXPOSE 443 -# Copy nginx.conf -COPY nginx.conf.template /etc/nginx/nginx.conf.template -# Set default BACKEND_HOST (can be overridden at runtime) +# Set default runtime values (can be overridden at runtime) ENV BACKEND_HOST=chore-app-backend +ENV FRONTEND_SSL_ENABLED=true -# Use sed to replace $BACKEND_HOST with the env value, then start Nginx -CMD ["/bin/sh", "-c", "sed 's/\\$BACKEND_HOST/'\"$BACKEND_HOST\"'/g' /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && nginx -g 'daemon off;'"] +CMD ["/docker/start-nginx.sh"] diff --git a/frontend/docker/start-nginx.sh b/frontend/docker/start-nginx.sh new file mode 100644 index 0000000..1ba2e65 --- /dev/null +++ b/frontend/docker/start-nginx.sh @@ -0,0 +1,18 @@ +#!/bin/sh +set -eu + +backend_host="${BACKEND_HOST:-chore-app-backend}" +ssl_enabled="$(printf '%s' "${FRONTEND_SSL_ENABLED:-true}" | tr '[:upper:]' '[:lower:]')" + +template_file="/etc/nginx/nginx.http.conf.template" + +case "$ssl_enabled" in + 1|true|yes|on) + template_file="/etc/nginx/nginx.conf.template" + ;; +esac + +sed "s|\$BACKEND_HOST|${backend_host}|g" "$template_file" > /etc/nginx/nginx.conf + +nginx -t +exec nginx -g 'daemon off;' diff --git a/frontend/e2e/.auth/user-cc.json b/frontend/e2e/.auth/user-cc.json index 4befb73..d6847c5 100644 --- a/frontend/e2e/.auth/user-cc.json +++ b/frontend/e2e/.auth/user-cc.json @@ -2,20 +2,20 @@ "cookies": [ { "name": "refresh_token", - "value": "dBbCt9vi-FCh7U6UBtBxlLj6LzrHM07A-Tt9g7lc5vI", + "value": "FZULMCV2SqB1TurS_72i4vCGjYXmL4rQzTvtKFODS-c", "domain": "localhost", "path": "/api/auth", - "expires": 1785439751.941889, + "expires": 1784993494.828813, "httpOnly": true, "secure": true, "sameSite": "Strict" }, { "name": "access_token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImUyZS1jY0B0ZXN0LmNvbSIsInVzZXJfaWQiOiJhZjY4NTM2Ny1hZGI1LTRiN2ItYWI2OC0zM2QzMGY4OWU1NDkiLCJ0b2tlbl92ZXJzaW9uIjowLCJleHAiOjE3Nzc2NzQ1NTF9.gvhv1GLxMgANWlVK9gIn1q7bJ3Krbw2qtXf7jTjV-Ig", + "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImUyZS1jY0B0ZXN0LmNvbSIsInVzZXJfaWQiOiJiMTkyZDgzZS1mMTQyLTRhZjQtYjAyNC02YzdiNzFmNzFlYjYiLCJ0b2tlbl92ZXJzaW9uIjowLCJleHAiOjE3NzcyMTgzOTR9.7JsdzTZDZd8qErp-GiAaYfU92jCb1L5ROGZXpEaz-dc", "domain": "localhost", "path": "/", - "expires": 1777674551.941821, + "expires": 1777218394.827404, "httpOnly": true, "secure": true, "sameSite": "Lax" @@ -27,13 +27,13 @@ "localStorage": [ { "name": "authSyncEvent", - "value": "{\"type\":\"logout\",\"at\":1777663751805}" + "value": "{\"type\":\"logout\",\"at\":1777217494503}" }, { "name": "parentAuth", - "value": "{\"expiresAt\":1777836552105}" + "value": "{\"expiresAt\":1777390295394}" } ] } ] -} \ No newline at end of file +} diff --git a/frontend/e2e/.auth/user-delete.json b/frontend/e2e/.auth/user-delete.json index 8cb5fc7..7165b20 100644 --- a/frontend/e2e/.auth/user-delete.json +++ b/frontend/e2e/.auth/user-delete.json @@ -2,20 +2,20 @@ "cookies": [ { "name": "refresh_token", - "value": "RgOQUW4r8HHf0oRC7CkS7N_ai16ldte8wZ4vqEnbykA", + "value": "tTh7qrpLh9RjQNVxmjhfQi0VOQwbLa4PJ8xfjlMC9P8", "domain": "localhost", "path": "/api/auth", - "expires": 1785439751.938223, + "expires": 1784993494.703215, "httpOnly": true, "secure": true, "sameSite": "Strict" }, { "name": "access_token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImUyZS1kZWxldGVAdGVzdC5jb20iLCJ1c2VyX2lkIjoiOTEwNzc3MGMtOGI5MC00MmM0LWE5MmUtNGRhN2UzMmM3MTdiIiwidG9rZW5fdmVyc2lvbiI6MCwiZXhwIjoxNzc3Njc0NTUxfQ.ywvqlx64QlwBSC9JmoWhGZv6_JFMVgyZ0VV5CHlgUEo", + "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImUyZS1kZWxldGVAdGVzdC5jb20iLCJ1c2VyX2lkIjoiMGY4YzE2YzUtN2ZlNy00ZGZiLWE4ZmMtMTc3NjQ5MDkxOWI4IiwidG9rZW5fdmVyc2lvbiI6MCwiZXhwIjoxNzc3MjE4Mzk0fQ.zSLSZsWZb9N1En9mWCqXxM9d__U7JldwT8pCKaoxzUc", "domain": "localhost", "path": "/", - "expires": 1777674551.938155, + "expires": 1777218394.702339, "httpOnly": true, "secure": true, "sameSite": "Lax" @@ -27,13 +27,13 @@ "localStorage": [ { "name": "authSyncEvent", - "value": "{\"type\":\"logout\",\"at\":1777663751795}" + "value": "{\"type\":\"logout\",\"at\":1777217494445}" }, { "name": "parentAuth", - "value": "{\"expiresAt\":1777836552105}" + "value": "{\"expiresAt\":1777390295182}" } ] } ] -} \ No newline at end of file +} diff --git a/frontend/e2e/.auth/user.json b/frontend/e2e/.auth/user.json index 0d5bbba..2f430d9 100644 --- a/frontend/e2e/.auth/user.json +++ b/frontend/e2e/.auth/user.json @@ -2,20 +2,20 @@ "cookies": [ { "name": "refresh_token", - "value": "4Wf4BWiljd-T-9TdZStP2DmwF1-8Gj9YTWriMyUzrVU", + "value": "iBgMbKeAn8p8X9iS6eumIZHEqKN0yqMKZ09V6nk7s-U", "domain": "localhost", "path": "/api/auth", - "expires": 1785439750.178407, + "expires": 1784993490.715252, "httpOnly": true, "secure": true, "sameSite": "Strict" }, { "name": "access_token", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImUyZUB0ZXN0LmNvbSIsInVzZXJfaWQiOiIzMTdhMDQyZS0yNGNhLTQ1MzUtODZmNC1lY2FiZWYwODIyM2MiLCJ0b2tlbl92ZXJzaW9uIjowLCJleHAiOjE3Nzc2NzQ1NTB9.XQxqXaYlr21DEuuKes0AFHvuWeJvlOTwFpruuhsxacs", + "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImUyZUB0ZXN0LmNvbSIsInVzZXJfaWQiOiJhM2ZlZjRmNS01MTc4LTRlYWEtOWU0NC1jZjk2MGJiMGQ3ZTkiLCJ0b2tlbl92ZXJzaW9uIjowLCJleHAiOjE3NzcyMTgzOTB9.PtdzVvtN6rMWPOTS6OfGc8tVSrihktnT2GhVIwKollc", "domain": "localhost", "path": "/", - "expires": 1777674550.178361, + "expires": 1777218390.714722, "httpOnly": true, "secure": true, "sameSite": "Lax" @@ -27,13 +27,13 @@ "localStorage": [ { "name": "authSyncEvent", - "value": "{\"type\":\"logout\",\"at\":1777663750032}" + "value": "{\"type\":\"logout\",\"at\":1777217490520}" }, { "name": "parentAuth", - "value": "{\"expiresAt\":1777836550307}" + "value": "{\"expiresAt\":1777390290893}" } ] } ] -} \ No newline at end of file +} diff --git a/frontend/nginx.http.conf.template b/frontend/nginx.http.conf.template new file mode 100644 index 0000000..c48932f --- /dev/null +++ b/frontend/nginx.http.conf.template @@ -0,0 +1,37 @@ +events {} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + server { + client_max_body_size 2M; + listen 80; + server_name _; + root /usr/share/nginx/html; + + location /api/ { + proxy_pass http://$BACKEND_HOST:5000/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location /events { + proxy_pass http://$BACKEND_HOST:5000/events; + proxy_set_header Host $host; + proxy_set_header Connection ''; + proxy_http_version 1.1; + chunked_transfer_encoding off; + proxy_buffering off; + proxy_cache off; + proxy_read_timeout 36000s; + proxy_send_timeout 36000s; + } + + location / { + try_files $uri $uri/ /index.html; + } + } +}