Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .env
Original file line number Diff line number Diff line change
@@ -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

Expand Down
8 changes: 4 additions & 4 deletions compose.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ 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
- traefik.http.routers.adminer-https.tls.certresolver=le

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
Expand Down
4 changes: 2 additions & 2 deletions compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down