From 9d963e7f54d3556782f39cb9ec3cf77cca6ca08d Mon Sep 17 00:00:00 2001 From: pedro Date: Tue, 21 Jan 2025 14:13:23 +0100 Subject: [PATCH] docker: facilitate multiple instances in same host start using namespace because more things are going to come in same docker compose --- .env.example | 5 +++-- docker-compose.yml | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index 6fb20c9..a5a677d 100644 --- a/.env.example +++ b/.env.example @@ -1,8 +1,8 @@ -DOMAIN=localhost +DH_DOMAIN=localhost +DH_PORT=8000 DEMO=true # note that with DEBUG=true, logs are more verbose (include tracebacks) DEBUG=true -ALLOWED_HOSTS=${DOMAIN},${DOMAIN}:8000,127.0.0.1,127.0.0.1:8000 DPP=false STATIC_ROOT=/tmp/static/ @@ -16,6 +16,7 @@ EMAIL_BACKEND="django.core.mail.backends.smtp.EmailBackend" EMAIL_FILE_PATH="/tmp/app-messages" ENABLE_EMAIL=false PREDEFINED_TOKEN='5018dd65-9abd-4a62-8896-80f34ac66150' +DH_ALLOWED_HOSTS=${DH_DOMAIN},${DH_DOMAIN}:${DH_PORT},127.0.0.1,127.0.0.1:${DH_PORT} # TODO review these vars #SNAPSHOTS_DIR=/path/to/TODO #EVIDENCES_DIR=/path/to/TODO diff --git a/docker-compose.yml b/docker-compose.yml index 9a156c7..2ca9162 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,13 +5,14 @@ services: dockerfile: docker/devicehub-django.Dockerfile environment: - DEBUG=${DEBUG:-false} - - DOMAIN=${DOMAIN:-localhost} - - ALLOWED_HOSTS=${ALLOWED_HOSTS:-$DOMAIN} + - DOMAIN=${DH_DOMAIN:-localhost} + - PORT=${DH_PORT:-8000} + - ALLOWED_HOSTS=${DH_ALLOWED_HOSTS:-$DH_DOMAIN} - DEMO=${DEMO:-false} - PREDEFINED_TOKEN=${PREDEFINED_TOKEN:-} - DPP=${DPP:-false} volumes: - .:/opt/devicehub-django ports: - - 8000:8000 + - ${DH_PORT}:${DH_PORT}