mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 13:11:02 +00:00
216 lines
5.3 KiB
YAML
216 lines
5.3 KiB
YAML
version: "3.9"
|
|
|
|
# Required for promtail scraping
|
|
x-logging: &default-logging
|
|
driver: "journald"
|
|
options:
|
|
tag: "{{.Name}}"
|
|
|
|
services:
|
|
#####
|
|
## Required services for listory
|
|
#####
|
|
|
|
db:
|
|
image: postgres:16.2
|
|
environment:
|
|
POSTGRES_PASSWORD: listory
|
|
POSTGRES_USER: listory
|
|
POSTGRES_DB: listory
|
|
networks:
|
|
- db
|
|
|
|
api:
|
|
build:
|
|
context: .
|
|
target: build-api
|
|
command: ["npm", "run", "start:dev"]
|
|
environment:
|
|
DB_HOST: db
|
|
DB_USERNAME: listory
|
|
DB_PASSWORD: listory
|
|
DB_DATABASE: listory
|
|
JWT_SECRET: listory
|
|
APP_URL: "http://localhost:3000"
|
|
NODE_ENV: local # pretty logs
|
|
|
|
OTEL_EXPORTER_OTLP_ENDPOINT: http://tempo:4318
|
|
env_file: .env
|
|
volumes:
|
|
- ./src:/app/src:ro
|
|
- ./dist:/app/dist # build cache
|
|
ports:
|
|
- 3000 # API
|
|
- "9464:9464" # Metrics
|
|
labels:
|
|
- "traefik.enable=true" # Enable reverse-proxy for this service
|
|
- "traefik.http.routers.api.rule=PathPrefix(`/api`)"
|
|
- "traefik.http.routers.api.entrypoints=web"
|
|
networks:
|
|
- web
|
|
- db
|
|
logging: *default-logging
|
|
|
|
frontend:
|
|
build:
|
|
context: .
|
|
target: build-frontend
|
|
command: ["npm", "run", "start", "--", "--host"]
|
|
volumes:
|
|
- ./frontend/vite.config.js:/app/frontend/vite.config.js:ro
|
|
- ./frontend/postcss.config.js:/app/frontend/postcss.config.js:ro
|
|
- ./frontend/tailwind.config.js:/app/frontend/tailwind.config.js:ro
|
|
- ./frontend/index.html:/app/frontend/index.html:ro
|
|
- ./frontend/src:/app/frontend/src:ro
|
|
- ./frontend/public:/app/frontend/public:ro
|
|
ports:
|
|
- 5173
|
|
labels:
|
|
- "traefik.enable=true" # Enable reverse-proxy for this service
|
|
- "traefik.http.routers.frontend.rule=PathPrefix(`/`)"
|
|
- "traefik.http.routers.frontend.entrypoints=web"
|
|
networks:
|
|
- web
|
|
|
|
proxy:
|
|
image: traefik:2.11.0
|
|
command:
|
|
#- --log.level=debug
|
|
#- --accesslog=true
|
|
- --api # Enables the web UI
|
|
- --api.insecure=true
|
|
- --providers.docker=true
|
|
- --providers.docker.exposedbydefault=false
|
|
- --providers.docker.network=listory_web
|
|
- --entrypoints.web.address=:3000
|
|
ports:
|
|
- "3000:3000" # The HTTP port
|
|
- "8080:8080" # The web UI
|
|
networks:
|
|
- web
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
|
|
|
|
#####
|
|
## console REPL
|
|
#####
|
|
|
|
console:
|
|
profiles:
|
|
- console
|
|
build:
|
|
context: .
|
|
target: build-api
|
|
command: ["npm", "run", "start:console"]
|
|
stdin_open: true
|
|
tty: true
|
|
environment:
|
|
DB_HOST: db
|
|
DB_USERNAME: listory
|
|
DB_PASSWORD: listory
|
|
DB_DATABASE: listory
|
|
JWT_SECRET: listory
|
|
APP_URL: "http://localhost:3000"
|
|
NODE_ENV: local # pretty logs
|
|
|
|
OTEL_EXPORTER_OTLP_ENDPOINT: http://tempo:4318
|
|
env_file: .env
|
|
volumes:
|
|
- ./src:/app/src:ro
|
|
- ./dist:/app/dist # build cache
|
|
ports:
|
|
- "9464:9464" # Metrics
|
|
networks:
|
|
- db
|
|
logging: *default-logging
|
|
|
|
#####
|
|
## Observability
|
|
## Adopted from https://github.com/stefanprodan/dockprom/blob/master/docker-compose.yml
|
|
#####
|
|
|
|
prometheus:
|
|
profiles: ["observability"]
|
|
image: prom/prometheus:v2.50.1
|
|
volumes:
|
|
- ./observability/prometheus:/etc/prometheus
|
|
- prometheus_data:/prometheus
|
|
command:
|
|
- "--config.file=/etc/prometheus/prometheus.yml"
|
|
- "--storage.tsdb.path=/prometheus"
|
|
- "--storage.tsdb.retention.time=200h"
|
|
- "--web.enable-lifecycle"
|
|
ports:
|
|
- "9090:9090"
|
|
networks:
|
|
- observability
|
|
- web
|
|
|
|
loki:
|
|
profiles: ["observability"]
|
|
image: grafana/loki:2.9.5
|
|
command: ["-config.file=/etc/loki/loki.yaml"]
|
|
ports:
|
|
- "3100" # loki needs to be exposed so it receives logs
|
|
volumes:
|
|
- ./observability/loki/loki.yaml:/etc/loki/loki.yaml
|
|
networks:
|
|
- observability
|
|
|
|
promtail:
|
|
profiles: ["observability"]
|
|
image: grafana/promtail:2.9.5
|
|
command: ["-config.file=/etc/promtail.yaml"]
|
|
volumes:
|
|
- ./observability/promtail/promtail.yaml:/etc/promtail.yaml
|
|
- /var/lib/docker/containers:/var/lib/docker/containers:ro
|
|
|
|
- /var/log/journal/:/var/log/journal/
|
|
- /run/log/journal/:/run/log/journal/
|
|
- /etc/machine-id:/etc/machine-id
|
|
ports:
|
|
- "3102"
|
|
networks:
|
|
- observability
|
|
depends_on:
|
|
- loki
|
|
|
|
tempo:
|
|
profiles: ["observability"]
|
|
image: grafana/tempo:2.4.0
|
|
command: ["-config.file=/etc/tempo.yaml"]
|
|
volumes:
|
|
- ./observability/tempo/tempo.yaml:/etc/tempo.yaml
|
|
- tempo_data:/tmp/tempo
|
|
ports:
|
|
- "3101" # tempo
|
|
- "4318" # OpenTelemetry HTTP
|
|
networks:
|
|
- observability
|
|
- web
|
|
|
|
grafana:
|
|
profiles: ["observability"]
|
|
image: grafana/grafana-oss:10.4.0
|
|
volumes:
|
|
- ./observability/grafana/provisioning:/etc/grafana/provisioning
|
|
environment:
|
|
- GF_SECURITY_ADMIN_USER=listory
|
|
- GF_SECURITY_ADMIN_PASSWORD=listory
|
|
- GF_AUTH_ANONYMOUS_ENABLED=true
|
|
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
|
|
- GF_USERS_ALLOW_SIGN_UP=false
|
|
- GF_SERVER_HTTP_PORT=2345
|
|
ports:
|
|
- "2345:2345"
|
|
networks:
|
|
- observability
|
|
|
|
volumes:
|
|
prometheus_data: {}
|
|
tempo_data: {}
|
|
|
|
networks:
|
|
db: {}
|
|
web: {}
|
|
observability: {}
|