From f0130e9ca8cc1a0c8c762534620fb5ac7b81eb7e Mon Sep 17 00:00:00 2001 From: Pierre Gauthier Date: Tue, 10 Sep 2024 15:08:56 +0200 Subject: [PATCH] Replace PWA_SERVER_NAME by SERVER_NAME --- compose.int.yml | 2 +- compose.override.yaml | 4 ++-- compose.yml | 16 +++++++++------- docker/front/Dockerfile | 4 ++-- docker/proxy/generate-certs.sh | 6 +++--- docker/proxy/templates/default.conf.template | 10 +++++++--- docker/router/nginx.conf | 2 ++ docker/router/templates/default.conf.template | 5 +++++ docker/search/Dockerfile | 1 - 9 files changed, 31 insertions(+), 19 deletions(-) diff --git a/compose.int.yml b/compose.int.yml index 7d80cf8c6..e984093e4 100644 --- a/compose.int.yml +++ b/compose.int.yml @@ -15,4 +15,4 @@ services: build: target: gally_pwa_int args: - - public_url=https://${SERVER_NAME:-${PWA_SERVER_NAME:-gally.localhost}}/example + - public_url=https://${SERVER_NAME}/example diff --git a/compose.override.yaml b/compose.override.yaml index 6ee6952cc..9fe91f523 100644 --- a/compose.override.yaml +++ b/compose.override.yaml @@ -29,7 +29,7 @@ services: build: target: gally_pwa_dev args: - - NEXT_PUBLIC_ENTRYPOINT=${SERVER_NAME:-${PWA_SERVER_NAME:-gally.localhost}} + - NEXT_PUBLIC_ENTRYPOINT=${SERVER_NAME:-gally.localhost} - NEXT_PUBLIC_API_URL=https://${SERVER_NAME:-${API_SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} volumes: - ./front:/usr/src/front:rw,cached,z @@ -49,7 +49,7 @@ services: volumes: - ./front:/usr/src/front:rw,cached,z environment: - - PUBLIC_URL=https://${PWA_SERVER_NAME:-gally.localhost}/example + - PUBLIC_URL=https://${SERVER_NAME:-gally.localhost}/example - REACT_APP_API_URL=https://${SERVER_NAME:-${API_SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} ###> doctrine/doctrine-bundle ### diff --git a/compose.yml b/compose.yml index 03984687a..b1e4fa0e5 100644 --- a/compose.yml +++ b/compose.yml @@ -9,7 +9,7 @@ services: depends_on: - varnish environment: - - PWA_SERVER_NAME=${PWA_SERVER_NAME:-${SERVER_NAME:-gally.localhost}} + - SERVER_NAME=${SERVER_NAME:-gally.localhost} - API_SERVER_NAME=${API_SERVER_NAME:-api.gally.localhost} - BACKEND_UPSTREAM=varnish:80 @@ -33,7 +33,7 @@ services: - php - pwa environment: - - PWA_SERVER_NAME=${SERVER_NAME:-${PWA_SERVER_NAME:-gally.localhost}} + - SERVER_NAME=${SERVER_NAME:-gally.localhost} - API_SERVER_NAME=${API_SERVER_NAME:-api.gally.localhost} - API_ROUTE_PREFIX=${API_ROUTE_PREFIX:-api} - PWA_UPSTREAM=${PWA_UPSTREAM:-pwa:3000} @@ -60,9 +60,9 @@ services: - SERVER_NAME=${SERVER_NAME:-${API_SERVER_NAME:-api.gally.localhost}}, php:80 - API_ROUTE_PREFIX=${API_ROUTE_PREFIX:-} - TRUSTED_PROXIES=${TRUSTED_PROXIES:-127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16} - - TRUSTED_HOSTS=${TRUSTED_HOSTS:-^${SERVER_NAME:-${PWA_SERVER_NAME:-example\.com|api.gally.localhost}}|localhost|php$$} - - CORS_ALLOW_ORIGIN=^https?://${SERVER_NAME:-${PWA_SERVER_NAME:-gally.localhost}}$ - - GALLY_CATALOG_MEDIA_URL=${GALLY_CATALOG_MEDIA_URL:-https://${SERVER_NAME:-${PWA_SERVER_NAME:-gally.localhost}}/media/catalog/product/} + - TRUSTED_HOSTS=${TRUSTED_HOSTS:-^${SERVER_NAME:-example\.com|api.gally.localhost}|localhost|php$$} + - CORS_ALLOW_ORIGIN=^https?://${SERVER_NAME:-gally.localhost}$ + - GALLY_CATALOG_MEDIA_URL=${GALLY_CATALOG_MEDIA_URL:-https://${SERVER_NAME:-gally.localhost}/media/catalog/product/} - DATABASE_URL=postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-16}&charset=${POSTGRES_CHARSET:-utf8} pwa: @@ -72,11 +72,13 @@ services: additional_contexts: front_src: ./front args: - - NEXT_PUBLIC_ENTRYPOINT=${SERVER_NAME:-${PWA_SERVER_NAME:-gally.localhost}} + - NEXT_PUBLIC_ENTRYPOINT=${SERVER_NAME:-gally.localhost} - NEXT_PUBLIC_API_URL=https://${SERVER_NAME:-${API_SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} + - REACT_APP_API_URL=https://${SERVER_NAME:-${API_SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} environment: - - NEXT_PUBLIC_ENTRYPOINT=${SERVER_NAME:-${PWA_SERVER_NAME:-gally.localhost}} + - NEXT_PUBLIC_ENTRYPOINT=${SERVER_NAME:-gally.localhost} - NEXT_PUBLIC_API_URL=https://${SERVER_NAME:-${API_SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} + - REACT_APP_API_URL=https://${SERVER_NAME:-${API_SERVER_NAME:-api.gally.localhost}}/${API_ROUTE_PREFIX:-} healthcheck: test: test $$(curl --connect-timeout 2 -s -o /dev/null -w ''%{http_code}'' http://localhost:3000) -eq 200 interval: 10s diff --git a/docker/front/Dockerfile b/docker/front/Dockerfile index 1dd9364ab..b4c9c1efb 100644 --- a/docker/front/Dockerfile +++ b/docker/front/Dockerfile @@ -15,7 +15,9 @@ EXPOSE 3001 WORKDIR /usr/src/front ARG NEXT_PUBLIC_API_URL +ARG REACT_APP_API_URL ENV NEXT_PUBLIC_API_URL $NEXT_PUBLIC_API_URL +ENV REACT_APP_API_URL $REACT_APP_API_URL ENV NEXT_TELEMETRY_DISABLED 1 COPY --from=front_src . ./ @@ -45,8 +47,6 @@ CMD ["yarn", "dev"] FROM gally_pwa_common AS gally_example_ci -ARG REACT_APP_API_URL - CMD ["yarn", "start:example"] diff --git a/docker/proxy/generate-certs.sh b/docker/proxy/generate-certs.sh index 46c93d50c..a5d2650e4 100755 --- a/docker/proxy/generate-certs.sh +++ b/docker/proxy/generate-certs.sh @@ -1,7 +1,7 @@ #!/bin/bash -CERT_PATH="/etc/nginx/certs/$PWA_SERVER_NAME/fullchain.pem" -KEY_PATH="/etc/nginx/certs/$PWA_SERVER_NAME/privkey.pem" +CERT_PATH="/etc/nginx/certs/${SERVER_NAME}/fullchain.pem" +KEY_PATH="/etc/nginx/certs/${SERVER_NAME}/privkey.pem" # Generate self sign certificates if they note exists if [[ ! -f "$CERT_PATH" ]]; then @@ -9,5 +9,5 @@ if [[ ! -f "$CERT_PATH" ]]; then openssl req -x509 -nodes -days 365 -newkey rsa:2048 \ -keyout $KEY_PATH \ -out $CERT_PATH \ - -subj "/CN=${PWA_SERVER_NAME:-localhost}" + -subj "/CN=${SERVER_NAME:-localhost}" fi diff --git a/docker/proxy/templates/default.conf.template b/docker/proxy/templates/default.conf.template index 8a4684353..2b9547462 100644 --- a/docker/proxy/templates/default.conf.template +++ b/docker/proxy/templates/default.conf.template @@ -1,9 +1,13 @@ server { listen 443 ssl; - server_name ${API_SERVER_NAME} ${PWA_SERVER_NAME}; + server_name ${SERVER_NAME} ${API_SERVER_NAME}; - ssl_certificate /etc/nginx/certs/$PWA_SERVER_NAME/fullchain.pem; - ssl_certificate_key /etc/nginx/certs/$PWA_SERVER_NAME/privkey.pem; + ssl_certificate /etc/nginx/certs/${SERVER_NAME}/fullchain.pem; + ssl_certificate_key /etc/nginx/certs/${SERVER_NAME}/privkey.pem; + + proxy_buffer_size 64k; + proxy_buffers 64 16k; + proxy_busy_buffers_size 64k; location / { # WebSocket support diff --git a/docker/router/nginx.conf b/docker/router/nginx.conf index fdc09d618..ebd3158ff 100644 --- a/docker/router/nginx.conf +++ b/docker/router/nginx.conf @@ -44,6 +44,8 @@ http { text/plain text/xml; + server_names_hash_bucket_size 128; + include /etc/nginx/conf.d/*.conf; } diff --git a/docker/router/templates/default.conf.template b/docker/router/templates/default.conf.template index fb67794b8..3a97c7ee6 100644 --- a/docker/router/templates/default.conf.template +++ b/docker/router/templates/default.conf.template @@ -8,6 +8,11 @@ server { root /app/public; listen 80; + client_body_buffer_size 4m; + client_max_body_size 256m; + fastcgi_buffers 64 16k; + fastcgi_buffer_size 64k; + location / { proxy_pass http://$PWA_UPSTREAM; } diff --git a/docker/search/Dockerfile b/docker/search/Dockerfile index 99c3e7287..b88bf0bcc 100644 --- a/docker/search/Dockerfile +++ b/docker/search/Dockerfile @@ -1,6 +1,5 @@ # Todo upgrade : update opensearch ARG OPENSEARCH2_VERSION=2.14.0 -# TODO upgrade: should be keep elasticsearch ? ARG ELASTIC7_VERSION=7.16.3 ARG ELASTIC8_VERSION=8.10.4