Skip to content

Commit

Permalink
Replace PWA_SERVER_NAME by SERVER_NAME
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreGauthier committed Sep 10, 2024
1 parent 5a826b8 commit f0130e9
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 19 deletions.
2 changes: 1 addition & 1 deletion compose.int.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ###
Expand Down
16 changes: 9 additions & 7 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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}
Expand All @@ -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:
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docker/front/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 . ./
Expand Down Expand Up @@ -45,8 +47,6 @@ CMD ["yarn", "dev"]

FROM gally_pwa_common AS gally_example_ci

ARG REACT_APP_API_URL

CMD ["yarn", "start:example"]


Expand Down
6 changes: 3 additions & 3 deletions docker/proxy/generate-certs.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/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
mkdir -p $(dirname $CERT_PATH)
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
10 changes: 7 additions & 3 deletions docker/proxy/templates/default.conf.template
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions docker/router/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ http {
text/plain
text/xml;

server_names_hash_bucket_size 128;

include /etc/nginx/conf.d/*.conf;
}

5 changes: 5 additions & 0 deletions docker/router/templates/default.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion docker/search/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit f0130e9

Please sign in to comment.