From 095293b0a54b9b5580a520436e5dd26de0fa8180 Mon Sep 17 00:00:00 2001 From: maxlath Date: Thu, 27 Feb 2025 18:19:25 +0100 Subject: [PATCH] nginx: recover access to the inventaire files and API --- docker-compose.yml | 6 +++--- dotenv | 3 --- nginx/templates/default.conf.template | 7 ++++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a07f974..1057539 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,8 +10,8 @@ services: - couchdb - elasticsearch # Uncomment if you want to access the code: - # volumes: - # - ./inventaire/server:${PROJECT_ROOT} + volumes: + - ./inventaire/server:/opt/inventaire logging: options: max-size: "10m" @@ -56,7 +56,7 @@ services: volumes: - ./nginx/templates:/etc/nginx/templates/ - ./nginx/snippets:/etc/nginx/snippets - - ./inventaire:${PROJECT_ROOT} + - ./inventaire/server:/opt/inventaire - certbot-www:/var/www/certbot - ./certbot/conf:/etc/letsencrypt env_file: .env diff --git a/dotenv b/dotenv index 758d87d..9f59e75 100644 --- a/dotenv +++ b/dotenv @@ -26,9 +26,6 @@ MAILER_SMTP_PASSWORD=your_password_on_smtp.example.org # Modify if you know what you are doing ######## -# Root path within docker container -PROJECT_ROOT=/opt/inventaire - NODE_ENV=production NODE_APP_INSTANCE=federated diff --git a/nginx/templates/default.conf.template b/nginx/templates/default.conf.template index 7e247b7..5f33e43 100755 --- a/nginx/templates/default.conf.template +++ b/nginx/templates/default.conf.template @@ -1,8 +1,9 @@ -# PROJECT_ROOT and PUBLIC_HOSTNAME are set with nginx image function, which will extract environment variables before nginx starts +# The INVENTAIRE_PORT and PUBLIC_HOSTNAME variables are set with nginx image function, +# which will extract environment variables before nginx starts # See https://hub.docker.com/_/nginx upstream inventaire { - server 127.0.0.1:3006 fail_timeout=5s; + server inventaire:${INVENTAIRE_PORT} fail_timeout=5s; } # Using error_page as a way to have a named location that can @@ -89,7 +90,7 @@ server { # following aliases made in order to respect the url structure # the server alone would follow: especially, mounting /static on /public - root ${PROJECT_ROOT}/inventaire/client; + root /opt/inventaire/client; location /public/ { include /etc/nginx/snippets/security_headers.conf; limit_except GET {