printhive/docker-compose.yml
dlawler489 5dfe809eb2
All checks were successful
build-and-push / docker (push) Successful in 26s
compose: Traefik label-based auto-discovery
Add Traefik labels so the Docker provider auto-discovers the app.
Includes traefik.docker.network (the app is on two networks) which is
the usual fix for routing not resolving. Host/entrypoint/certresolver
overridable via PRINTHIVE_HOST / TRAEFIK_ENTRYPOINT / TRAEFIK_CERTRESOLVER.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 20:47:06 +10:00

64 lines
2.2 KiB
YAML

services:
db:
image: postgres:16-alpine
environment:
POSTGRES_USER: printhive
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-printhive}
POSTGRES_DB: printhive
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U printhive -d printhive"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
app:
# Pulled from the Forgejo registry (built by CI). To build locally instead:
# docker build -t git.plexultra.com/dlawler489/printhive:latest .
image: git.plexultra.com/dlawler489/printhive:latest
pull_policy: always
container_name: printhive-app # stable name for the Traefik file-provider to target
depends_on:
db:
condition: service_healthy
environment:
DATABASE_URL: postgres://printhive:${POSTGRES_PASSWORD:-printhive}@db:5432/printhive
PORT: 3000
# Optional — these can also be set in the app's Settings menu (stored in the DB).
THINGIVERSE_TOKEN: ${THINGIVERSE_TOKEN:-}
FLARESOLVERR_URL: ${FLARESOLVERR_URL:-}
MAKERWORLD_TOKEN: ${MAKERWORLD_TOKEN:-}
PRINTABLES_TOKEN: ${PRINTABLES_TOKEN:-}
volumes:
- uploads:/app/uploads
- thumbnails:/app/thumbnails
- glb:/app/glb
# No host port published — Traefik auto-discovers the app on the shared network.
networks:
- default # talk to the db
- traefik # reachable by Traefik
restart: unless-stopped
labels:
- "traefik.enable=true"
# App is on two networks; tell Traefik which one to reach it on.
- "traefik.docker.network=${TRAEFIK_NETWORK:-traefik}"
- "traefik.http.routers.printhive.rule=Host(`${PRINTHIVE_HOST:-printhive.plexultra.com}`)"
- "traefik.http.routers.printhive.entrypoints=${TRAEFIK_ENTRYPOINT:-websecure}"
- "traefik.http.routers.printhive.tls.certresolver=${TRAEFIK_CERTRESOLVER:-letsencrypt}"
- "traefik.http.services.printhive.loadbalancer.server.port=3000"
volumes:
pgdata:
uploads:
thumbnails:
glb:
networks:
default:
# The existing Traefik network (same one your other services use).
# Set TRAEFIK_NETWORK in Dockhand to its exact name.
traefik:
external: true
name: ${TRAEFIK_NETWORK:-traefik}