diff --git a/.gitignore b/.gitignore index dc0bd3d..1bc11bc 100644 --- a/.gitignore +++ b/.gitignore @@ -72,6 +72,9 @@ logs/ *.temp .cache/ +# Generated config files +web/config.js + # Coverage reports htmlcov/ .coverage diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 127a7b9..9d45d8d 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -7,7 +7,6 @@ services: # FastAPI Backend api: build: ./backend - container_name: ppr_prod_api restart: always environment: DB_HOST: ${DB_HOST} @@ -56,7 +55,6 @@ services: # Redis for caching (optional) redis: image: redis:7-alpine - container_name: ppr_prod_redis restart: always networks: - app_network @@ -69,15 +67,11 @@ services: # Nginx web server for public frontend web: image: nginx:alpine - container_name: ppr_prod_web restart: always environment: BASE_URL: ${BASE_URL} command: > - sh -c "cp /usr/share/nginx/html/ppr.html /tmp/ppr.html.orig && - sed 's|__BASE_URL__|'"\$BASE_URL"'|g' /tmp/ppr.html.orig > /usr/share/nginx/html/ppr.html && - cp /usr/share/nginx/html/index.html /tmp/index.html.orig && - sed 's|__BASE_URL__|'"\$BASE_URL"'|g' /tmp/index.html.orig > /usr/share/nginx/html/index.html && + sh -c "echo 'window.PPR_CONFIG = { apiBase: \"'\$BASE_URL'/api/v1\" };' > /usr/share/nginx/html/config.js && nginx -g 'daemon off;'" ports: - "${WEB_PORT_EXTERNAL}:80" diff --git a/docker-compose.yml b/docker-compose.yml index 6d628a8..a48f6c1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -49,6 +49,25 @@ services: - private_network - public_network + # Nginx web server for public frontend + web: + image: nginx:alpine + restart: unless-stopped + environment: + BASE_URL: ${BASE_URL} + command: > + sh -c "echo 'window.PPR_CONFIG = { apiBase: \"'\$BASE_URL'/api/v1\" };' > /usr/share/nginx/html/config.js && + nginx -g 'daemon off;'" + ports: + - "${WEB_PORT_EXTERNAL}:80" + volumes: + - ./web:/usr/share/nginx/html + - ./nginx.conf:/etc/nginx/nginx.conf:ro + depends_on: + - api + networks: + - public_network + # Redis for caching (optional for now) redis: image: redis:7-alpine @@ -57,29 +76,6 @@ services: networks: - private_network - # Nginx web server for public frontend - web: - image: nginx:alpine - container_name: ppr_nextgen_web - restart: unless-stopped - environment: - BASE_URL: ${BASE_URL} - command: > - sh -c "sed 's|__BASE_URL__|'"\$BASE_URL"'|g' /usr/share/nginx/html/ppr.html > /tmp/ppr.html && - mv /tmp/ppr.html /usr/share/nginx/html/ppr.html && - sed 's|__BASE_URL__|'"\$BASE_URL"'|g' /usr/share/nginx/html/index.html > /tmp/index.html && - mv /tmp/index.html /usr/share/nginx/html/index.html && - nginx -g 'daemon off;'" - ports: - - "${WEB_PORT_EXTERNAL}:80" # Public web interface - volumes: - - ./web:/usr/share/nginx/html - - ./nginx.conf:/etc/nginx/nginx.conf - depends_on: - - api - networks: - - public_network - # phpMyAdmin for database management phpmyadmin: image: phpmyadmin/phpmyadmin diff --git a/web/ppr.html b/web/ppr.html index 7cdf335..23d5789 100644 --- a/web/ppr.html +++ b/web/ppr.html @@ -441,9 +441,18 @@
+