Files
homelab_docs/deployments/docker.md
T

14 lines
1.4 KiB
Markdown

# Deploy a Docker service
Status: draft process; adjust to actual Compose layout on `freighter`.
1. Create or update the service's Compose project in its source repository. Use pinned image versions where practical. Put secrets in the host's secret mechanism, outside Git.
2. Define persistent volumes, UID/GID, restart policy, resource needs, and health check. Existing workloads have used UID/GID `1005:1005`; confirm this for the new image and its mounts.
3. Attach the appropriate existing Docker network (`homestack` or `homenet`); verify which network Traefik actually shares. Expose only necessary ports.
4. Add Traefik labels for host, entrypoint, TLS resolver, middleware, and **correct internal service port**. Verify the container and Traefik share a network; specify `traefik.docker.network` when ambiguous.
5. Validate Compose (`docker compose config`), then deploy (`docker compose up -d`) from the intended project directory. Check `docker compose ps`, health, and logs.
6. Test direct container access, then local FQDN through Traefik, then external access only if intended. A Traefik 404 suggests route discovery/rule mismatch; a gateway error suggests backend/network/port issues.
7. Add monitoring, backups, and an entry in the service inventory. Record rollback image tag and volume restore method before a major upgrade.
Do not copy a real credential, API token, or Cloudflare DNS credential into Compose tracked by Git.