mirror of
https://github.com/fastapi/full-stack-fastapi-template.git
synced 2026-11-03 12:29:42 +00:00
♻️ Require non-empty Compose configuration (#2418)
## AI Disclaimer Using Codex with gpt-5.6-sol. Reviewed manually.
This commit is contained in:
committed by
GitHub
parent
1a30f30e51
commit
060795204b
@@ -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
|
||||
|
||||
|
||||
+4
-4
@@ -38,7 +38,7 @@ services:
|
||||
restart: always
|
||||
labels:
|
||||
# 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.tls=true
|
||||
# Use the Let's Encrypt resolver
|
||||
@@ -46,15 +46,15 @@ services:
|
||||
|
||||
prestart:
|
||||
environment:
|
||||
FRONTEND_HOST: https://${DOMAIN?Variable not set}
|
||||
FRONTEND_HOST: https://${DOMAIN:?Variable not set}
|
||||
|
||||
backend:
|
||||
restart: always
|
||||
environment:
|
||||
FRONTEND_HOST: https://${DOMAIN?Variable not set}
|
||||
FRONTEND_HOST: https://${DOMAIN:?Variable not set}
|
||||
labels:
|
||||
# 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.tls=true
|
||||
# Use the Let's Encrypt resolver
|
||||
|
||||
@@ -94,8 +94,8 @@ services:
|
||||
- backend
|
||||
- mailcatcher
|
||||
environment:
|
||||
- FIRST_SUPERUSER=${FIRST_SUPERUSER?Variable not set}
|
||||
- FIRST_SUPERUSER_PASSWORD=${FIRST_SUPERUSER_PASSWORD?Variable not set}
|
||||
- FIRST_SUPERUSER=${FIRST_SUPERUSER:?Variable not set}
|
||||
- FIRST_SUPERUSER_PASSWORD=${FIRST_SUPERUSER_PASSWORD:?Variable not set}
|
||||
- PLAYWRIGHT_BASE_URL=http://backend:8000
|
||||
- VITE_API_URL=http://backend:8000
|
||||
- MAILCATCHER_HOST=http://mailcatcher:1080
|
||||
|
||||
+12
-12
@@ -28,9 +28,9 @@ services:
|
||||
volumes:
|
||||
- app-db-data:/var/lib/postgresql
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD?Variable not set}
|
||||
- POSTGRES_USER=${POSTGRES_USER?Variable not set}
|
||||
- POSTGRES_DB=${POSTGRES_DB?Variable not set}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?Variable not set}
|
||||
- POSTGRES_USER=${POSTGRES_USER:?Variable not set}
|
||||
- POSTGRES_DB=${POSTGRES_DB:?Variable not set}
|
||||
|
||||
adminer:
|
||||
image: adminer
|
||||
@@ -42,7 +42,7 @@ services:
|
||||
# Enable Traefik for this service
|
||||
- traefik.enable=true
|
||||
# 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
|
||||
# Define the port inside of the Docker service to use
|
||||
- traefik.http.services.adminer.loadbalancer.server.port=8080
|
||||
@@ -57,19 +57,19 @@ services:
|
||||
condition: service_completed_successfully
|
||||
# The YAML anchor lets the prestart service reuse this environment mapping.
|
||||
environment: &backend-environment
|
||||
PROJECT_NAME: ${PROJECT_NAME?Variable not set}
|
||||
PROJECT_NAME: ${PROJECT_NAME:?Variable not set}
|
||||
BACKEND_CORS_ORIGINS: ${BACKEND_CORS_ORIGINS:-}
|
||||
SECRET_KEY: ${SECRET_KEY?Variable not set}
|
||||
FIRST_SUPERUSER: ${FIRST_SUPERUSER?Variable not set}
|
||||
FIRST_SUPERUSER_PASSWORD: ${FIRST_SUPERUSER_PASSWORD?Variable not set}
|
||||
SECRET_KEY: ${SECRET_KEY:?Variable not set}
|
||||
FIRST_SUPERUSER: ${FIRST_SUPERUSER:?Variable not set}
|
||||
FIRST_SUPERUSER_PASSWORD: ${FIRST_SUPERUSER_PASSWORD:?Variable not set}
|
||||
SMTP_HOST: ${SMTP_HOST}
|
||||
SMTP_USER: ${SMTP_USER:-}
|
||||
SMTP_PASSWORD: ${SMTP_PASSWORD:-}
|
||||
EMAILS_FROM_EMAIL: ${EMAILS_FROM_EMAIL}
|
||||
POSTGRES_SERVER: db
|
||||
POSTGRES_DB: ${POSTGRES_DB}
|
||||
POSTGRES_USER: ${POSTGRES_USER?Variable not set}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD?Variable not set}
|
||||
POSTGRES_DB: ${POSTGRES_DB:?Variable not set}
|
||||
POSTGRES_USER: ${POSTGRES_USER:?Variable not set}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Variable not set}
|
||||
SENTRY_DSN: ${SENTRY_DSN:-}
|
||||
|
||||
healthcheck:
|
||||
@@ -89,7 +89,7 @@ services:
|
||||
- traefik.http.services.backend.loadbalancer.server.port=8000
|
||||
|
||||
# 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
|
||||
|
||||
prestart:
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ Copy the content and use that as password / secret key. And run that again to ge
|
||||
|
||||
### 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
|
||||
export DOMAIN=fastapi-project.example.com
|
||||
|
||||
Reference in New Issue
Block a user