From d0da417cf72bd3d0ff7516bcb34a0ca20c263d75 Mon Sep 17 00:00:00 2001 From: Dan LaManna Date: Tue, 17 Feb 2026 07:24:57 -0500 Subject: [PATCH] Temporarily support multiple docker-compose setups --- .env.example | 16 ++++++++++++++++ dev/.env.docker-compose | 2 -- docker-compose.override.yml | 10 ++++++++-- docker-compose.yml | 14 +++++++------- 4 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..b1b63391 --- /dev/null +++ b/.env.example @@ -0,0 +1,16 @@ +# Copy to .env and uncomment what you need. +# Docker Compose reads .env automatically. + +# Set a unique name when running multiple instances. +# COMPOSE_PROJECT_NAME=isic + +# Host port mappings +# POSTGRES_PORT=5432 +# ELASTICSEARCH_PORT=9200 +# RABBITMQ_PORT=5672 +# RABBITMQ_MGMT_PORT=15672 +# MINIO_API_PORT=9000 +# MINIO_CONSOLE_PORT=9001 +# REDIS_PORT=6379 +# DJANGO_PORT=8000 +# ZIPSTREAMER_PORT=4008 diff --git a/dev/.env.docker-compose b/dev/.env.docker-compose index e220ca58..5ad77bf4 100644 --- a/dev/.env.docker-compose +++ b/dev/.env.docker-compose @@ -3,9 +3,7 @@ DJANGO_DATABASE_URL=postgres://postgres:postgres@postgres:5432/django DJANGO_ISIC_ELASTICSEARCH_URL=http://elastic:elastic@elasticsearch:9200 DJANGO_CELERY_BROKER_URL=amqp://rabbitmq:5672/ DJANGO_MINIO_STORAGE_URL=http://minioAccessKey:minioSecretKey@minio:9000/django-storage -DJANGO_MINIO_STORAGE_MEDIA_URL=http://localhost:9000/django-storage DJANGO_ISIC_SPONSORED_BUCKET_NAME=django-sponsored -DJANGO_ISIC_SPONSORED_MEDIA_URL=http://localhost:9000/django-sponsored DJANGO_CACHE_URL=redis://redis:6379/0 DJANGO_ISIC_ZIP_DOWNLOAD_SERVICE_URL=http://zipstreamer:4008 # When in Docker, the bridge network sends requests from the host machine exclusively via a diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 9814b184..100346a1 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -18,13 +18,15 @@ services: UV_PYTHON_INSTALL_DIR: /home/vscode/uv/bin UV_LINK_MODE: symlink TOX_WORK_DIR: /home/vscode/tox + DJANGO_MINIO_STORAGE_MEDIA_URL: "http://localhost:${MINIO_API_PORT:-9000}/django-storage" + DJANGO_ISIC_SPONSORED_MEDIA_URL: "http://localhost:${MINIO_API_PORT:-9000}/django-sponsored" working_dir: /home/vscode/isic env_file: ./dev/.env.docker-compose volumes: - .:/home/vscode/isic - uv_cache:/home/vscode/uv ports: - - 8000:8000 + - "${DJANGO_PORT:-8000}:8000" depends_on: postgres: condition: service_healthy @@ -60,6 +62,8 @@ services: UV_PYTHON_INSTALL_DIR: /home/vscode/uv/bin UV_LINK_MODE: symlink TOX_WORK_DIR: /home/vscode/tox + DJANGO_MINIO_STORAGE_MEDIA_URL: "http://localhost:${MINIO_API_PORT:-9000}/django-storage" + DJANGO_ISIC_SPONSORED_MEDIA_URL: "http://localhost:${MINIO_API_PORT:-9000}/django-sponsored" working_dir: /home/vscode/isic volumes: - .:/home/vscode/isic @@ -97,6 +101,8 @@ services: UV_PYTHON_INSTALL_DIR: /home/vscode/uv/bin UV_LINK_MODE: symlink TOX_WORK_DIR: /home/vscode/tox + DJANGO_MINIO_STORAGE_MEDIA_URL: "http://localhost:${MINIO_API_PORT:-9000}/django-storage" + DJANGO_ISIC_SPONSORED_MEDIA_URL: "http://localhost:${MINIO_API_PORT:-9000}/django-sponsored" working_dir: /home/vscode/isic volumes: - .:/home/vscode/isic @@ -120,7 +126,7 @@ services: environment: ZS_LISTFILE_URL_PREFIX: "http://django/api/v2/zip-download/file-listing/?token=" ports: - - 4008:4008 + - "${ZIPSTREAMER_PORT:-4008}:4008" volumes: uv_cache: diff --git a/docker-compose.yml b/docker-compose.yml index 0dfbb4ae..bf82e23f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,7 @@ services: test: ["CMD", "pg_isready", "--username", "postgres"] start_period: 30s ports: - - 5432:5432 + - "${POSTGRES_PORT:-5432}:5432" volumes: - postgres:/var/lib/postgresql @@ -25,7 +25,7 @@ services: test: ["CMD", "curl", "--fail", "--user", "elastic:elastic", "http://localhost:9200/"] start_period: 30s ports: - - 9200:9200 + - "${ELASTICSEARCH_PORT:-9200}:9200" volumes: - elasticsearch:/usr/share/elasticsearch/data @@ -35,8 +35,8 @@ services: test: ["CMD", "rabbitmq-diagnostics", "ping"] start_period: 30s ports: - - 5672:5672 - - 15672:15672 + - "${RABBITMQ_PORT:-5672}:5672" + - "${RABBITMQ_MGMT_PORT:-15672}:15672" volumes: - rabbitmq:/var/lib/rabbitmq @@ -54,8 +54,8 @@ services: timeout: 1s start_period: 30s ports: - - 9000:9000 - - 9001:9001 + - "${MINIO_API_PORT:-9000}:9000" + - "${MINIO_CONSOLE_PORT:-9001}:9001" volumes: - minio:/data @@ -65,7 +65,7 @@ services: test: ["CMD", "redis-cli", "ping"] start_period: 30s ports: - - 6379:6379 + - "${REDIS_PORT:-6379}:6379" volumes: - redis:/data