Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Has been cancelled
test / unit (pull_request) Has been cancelled
test / integration (pull_request) Has been cancelled
113 lines
3.3 KiB
YAML
113 lines
3.3 KiB
YAML
services:
|
|
database:
|
|
image: postgres:16-alpine
|
|
container_name: thoughts-db
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- internal
|
|
|
|
api:
|
|
container_name: thoughts-api
|
|
image: registry.gabrielkaszewski.dev/thoughts:latest
|
|
restart: unless-stopped
|
|
environment:
|
|
RUST_LOG: info
|
|
RUST_ENV: production
|
|
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database/${POSTGRES_DB}
|
|
HOST: 0.0.0.0
|
|
PORT: 8000
|
|
JWT_SECRET: ${JWT_SECRET}
|
|
BASE_URL: ${BASE_URL}
|
|
NATS_URL: nats://k_nats:4222
|
|
CORS_ORIGINS: ${CORS_ORIGINS:-*}
|
|
ALLOW_REGISTRATION: ${ALLOW_REGISTRATION:-false}
|
|
depends_on:
|
|
database:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8000/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- internal
|
|
- shared-services
|
|
- traefik
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.docker.network=traefik"
|
|
- "traefik.http.routers.thoughts-api.rule=Host(`api.thoughts.gabrielkaszewski.dev`)"
|
|
- "traefik.http.routers.thoughts-api.entrypoints=web,websecure"
|
|
- "traefik.http.routers.thoughts-api.tls.certresolver=letsencrypt"
|
|
- "traefik.http.routers.thoughts-api.service=thoughts-api"
|
|
- "traefik.http.services.thoughts-api.loadbalancer.server.port=8000"
|
|
|
|
worker:
|
|
container_name: thoughts-worker
|
|
image: registry.gabrielkaszewski.dev/thoughts:latest
|
|
entrypoint: ["./thoughts-worker"]
|
|
restart: unless-stopped
|
|
environment:
|
|
RUST_LOG: info
|
|
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database/${POSTGRES_DB}
|
|
BASE_URL: ${BASE_URL}
|
|
NATS_URL: nats://k_nats:4222
|
|
depends_on:
|
|
database:
|
|
condition: service_healthy
|
|
networks:
|
|
- internal
|
|
- shared-services
|
|
|
|
frontend:
|
|
container_name: thoughts-frontend
|
|
image: registry.gabrielkaszewski.dev/thoughts-frontend:latest
|
|
restart: unless-stopped
|
|
environment:
|
|
NEXT_PUBLIC_SERVER_SIDE_API_URL: http://api:8000
|
|
NEXT_PUBLIC_API_URL: https://api.thoughts.gabrielkaszewski.dev
|
|
PORT: 3000
|
|
HOSTNAME: 0.0.0.0
|
|
depends_on:
|
|
api:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:3000"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- internal
|
|
- traefik
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.docker.network=traefik"
|
|
- "traefik.http.routers.thoughts.rule=Host(`thoughts.gabrielkaszewski.dev`)"
|
|
- "traefik.http.routers.thoughts.entrypoints=web,websecure"
|
|
- "traefik.http.routers.thoughts.tls.certresolver=letsencrypt"
|
|
- "traefik.http.routers.thoughts.service=thoughts"
|
|
- "traefik.http.services.thoughts.loadbalancer.server.port=3000"
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
|
|
networks:
|
|
shared-services:
|
|
external: true
|
|
traefik:
|
|
external: true
|
|
internal:
|
|
driver: bridge
|