♻️ Require non-empty Compose configuration (#2418)

## AI Disclaimer

Using Codex with gpt-5.6-sol. Reviewed manually.
This commit is contained in:
Sebastián Ramírez
2026-08-10 18:33:51 +02:00
committed by GitHub
parent 1a30f30e51
commit 060795204b
5 changed files with 19 additions and 26 deletions
-7
View File
@@ -1,10 +1,3 @@
# Domain
# This would be set to the production domain with an env var on deployment
# used by Traefik to transmit traffic and acquire TLS certificates
DOMAIN=localhost
# To test the local Traefik config
# DOMAIN=localhost.tiangolo.com
# Environment: local, staging, production # Environment: local, staging, production
ENVIRONMENT=local ENVIRONMENT=local
+4 -4
View File
@@ -38,7 +38,7 @@ services:
restart: always restart: always
labels: labels:
# Route HTTPS traffic for the Adminer subdomain # Route HTTPS traffic for the Adminer subdomain
- traefik.http.routers.adminer-https.rule=Host(`adminer.${DOMAIN?Variable not set}`) - traefik.http.routers.adminer-https.rule=Host(`adminer.${DOMAIN:?Variable not set}`)
- traefik.http.routers.adminer-https.entrypoints=https - traefik.http.routers.adminer-https.entrypoints=https
- traefik.http.routers.adminer-https.tls=true - traefik.http.routers.adminer-https.tls=true
# Use the Let's Encrypt resolver # Use the Let's Encrypt resolver
@@ -46,15 +46,15 @@ services:
prestart: prestart:
environment: environment:
FRONTEND_HOST: https://${DOMAIN?Variable not set} FRONTEND_HOST: https://${DOMAIN:?Variable not set}
backend: backend:
restart: always restart: always
environment: environment:
FRONTEND_HOST: https://${DOMAIN?Variable not set} FRONTEND_HOST: https://${DOMAIN:?Variable not set}
labels: labels:
# Route HTTPS traffic for this domain # Route HTTPS traffic for this domain
- traefik.http.routers.backend-https.rule=Host(`${DOMAIN?Variable not set}`) - traefik.http.routers.backend-https.rule=Host(`${DOMAIN:?Variable not set}`)
- traefik.http.routers.backend-https.entrypoints=https - traefik.http.routers.backend-https.entrypoints=https
- traefik.http.routers.backend-https.tls=true - traefik.http.routers.backend-https.tls=true
# Use the Let's Encrypt resolver # Use the Let's Encrypt resolver
+2 -2
View File
@@ -94,8 +94,8 @@ services:
- backend - backend
- mailcatcher - mailcatcher
environment: environment:
- FIRST_SUPERUSER=${FIRST_SUPERUSER?Variable not set} - FIRST_SUPERUSER=${FIRST_SUPERUSER:?Variable not set}
- FIRST_SUPERUSER_PASSWORD=${FIRST_SUPERUSER_PASSWORD?Variable not set} - FIRST_SUPERUSER_PASSWORD=${FIRST_SUPERUSER_PASSWORD:?Variable not set}
- PLAYWRIGHT_BASE_URL=http://backend:8000 - PLAYWRIGHT_BASE_URL=http://backend:8000
- VITE_API_URL=http://backend:8000 - VITE_API_URL=http://backend:8000
- MAILCATCHER_HOST=http://mailcatcher:1080 - MAILCATCHER_HOST=http://mailcatcher:1080
+12 -12
View File
@@ -28,9 +28,9 @@ services:
volumes: volumes:
- app-db-data:/var/lib/postgresql - app-db-data:/var/lib/postgresql
environment: environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD?Variable not set} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?Variable not set}
- POSTGRES_USER=${POSTGRES_USER?Variable not set} - POSTGRES_USER=${POSTGRES_USER:?Variable not set}
- POSTGRES_DB=${POSTGRES_DB?Variable not set} - POSTGRES_DB=${POSTGRES_DB:?Variable not set}
adminer: adminer:
image: adminer image: adminer
@@ -42,7 +42,7 @@ services:
# Enable Traefik for this service # Enable Traefik for this service
- traefik.enable=true - traefik.enable=true
# Route HTTP traffic for the Adminer subdomain # Route HTTP traffic for the Adminer subdomain
- traefik.http.routers.adminer-http.rule=Host(`adminer.${DOMAIN?Variable not set}`) - traefik.http.routers.adminer-http.rule=Host(`adminer.${DOMAIN:-localhost}`)
- traefik.http.routers.adminer-http.entrypoints=http - traefik.http.routers.adminer-http.entrypoints=http
# Define the port inside of the Docker service to use # Define the port inside of the Docker service to use
- traefik.http.services.adminer.loadbalancer.server.port=8080 - traefik.http.services.adminer.loadbalancer.server.port=8080
@@ -57,19 +57,19 @@ services:
condition: service_completed_successfully condition: service_completed_successfully
# The YAML anchor lets the prestart service reuse this environment mapping. # The YAML anchor lets the prestart service reuse this environment mapping.
environment: &backend-environment environment: &backend-environment
PROJECT_NAME: ${PROJECT_NAME?Variable not set} PROJECT_NAME: ${PROJECT_NAME:?Variable not set}
BACKEND_CORS_ORIGINS: ${BACKEND_CORS_ORIGINS:-} BACKEND_CORS_ORIGINS: ${BACKEND_CORS_ORIGINS:-}
SECRET_KEY: ${SECRET_KEY?Variable not set} SECRET_KEY: ${SECRET_KEY:?Variable not set}
FIRST_SUPERUSER: ${FIRST_SUPERUSER?Variable not set} FIRST_SUPERUSER: ${FIRST_SUPERUSER:?Variable not set}
FIRST_SUPERUSER_PASSWORD: ${FIRST_SUPERUSER_PASSWORD?Variable not set} FIRST_SUPERUSER_PASSWORD: ${FIRST_SUPERUSER_PASSWORD:?Variable not set}
SMTP_HOST: ${SMTP_HOST} SMTP_HOST: ${SMTP_HOST}
SMTP_USER: ${SMTP_USER:-} SMTP_USER: ${SMTP_USER:-}
SMTP_PASSWORD: ${SMTP_PASSWORD:-} SMTP_PASSWORD: ${SMTP_PASSWORD:-}
EMAILS_FROM_EMAIL: ${EMAILS_FROM_EMAIL} EMAILS_FROM_EMAIL: ${EMAILS_FROM_EMAIL}
POSTGRES_SERVER: db POSTGRES_SERVER: db
POSTGRES_DB: ${POSTGRES_DB} POSTGRES_DB: ${POSTGRES_DB:?Variable not set}
POSTGRES_USER: ${POSTGRES_USER?Variable not set} POSTGRES_USER: ${POSTGRES_USER:?Variable not set}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD?Variable not set} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Variable not set}
SENTRY_DSN: ${SENTRY_DSN:-} SENTRY_DSN: ${SENTRY_DSN:-}
healthcheck: healthcheck:
@@ -89,7 +89,7 @@ services:
- traefik.http.services.backend.loadbalancer.server.port=8000 - traefik.http.services.backend.loadbalancer.server.port=8000
# Route HTTP traffic for this domain # Route HTTP traffic for this domain
- traefik.http.routers.backend-http.rule=Host(`${DOMAIN?Variable not set}`) - traefik.http.routers.backend-http.rule=Host(`${DOMAIN:-localhost}`)
- traefik.http.routers.backend-http.entrypoints=http - traefik.http.routers.backend-http.entrypoints=http
prestart: prestart:
+1 -1
View File
@@ -46,7 +46,7 @@ Copy the content and use that as password / secret key. And run that again to ge
### Required Environment Variables ### Required Environment Variables
Set the `DOMAIN`, by default `localhost` (for development), but when deploying you would use your own domain, for example: Set the `DOMAIN` to your own domain, for example:
```bash ```bash
export DOMAIN=fastapi-project.example.com export DOMAIN=fastapi-project.example.com