-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathdocker-compose.traefik.yml
More file actions
46 lines (44 loc) · 2.45 KB
/
Copy pathdocker-compose.traefik.yml
File metadata and controls
46 lines (44 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# MeshCore Hub - Traefik Docker Compose Override
#
# Adds Traefik auto-discovery labels to core services.
# Requires docker-compose.prod.yml (for the proxy-net network).
#
# Set TRAEFIK_DOMAIN in your .env file to the hostname for this instance.
# The web service matches the apex domain and all subdomains (e.g. www.meshcore.example.com).
#
# For multi-instance deployments (e.g. production + staging on the same host),
# set TRAEFIK_PRIORITY to control which router wins when domains overlap.
# Higher priority = matched first. Recommended values:
# Production: 10 (default)
# Staging: 20
# MQTT broker: 30 (in separate repo, same proxy-net)
#
# Prerequisites:
# - Traefik configured with Docker provider and attached to proxy-net
# - TRAEFIK_DOMAIN set in .env (e.g., TRAEFIK_DOMAIN=meshcore.example.com)
#
# Usage:
# docker compose -f docker-compose.yml -f docker-compose.prod.yml -f docker-compose.traefik.yml up -d
services:
api:
labels:
- "traefik.enable=true"
- "traefik.http.services.${COMPOSE_PROJECT_NAME:-hub}-api.loadbalancer.server.port=8000"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME:-hub}-api.rule=Host(`${TRAEFIK_DOMAIN}`) && (PathPrefix(`/metrics`) || PathPrefix(`/health`))"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME:-hub}-api.priority=${TRAEFIK_PRIORITY:-10}"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME:-hub}-api.entrypoints=websecure"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME:-hub}-api.tls=true"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME:-hub}-api.tls.certresolver=default"
- "traefik.docker.network=proxy-net"
web:
labels:
- "traefik.enable=true"
- "traefik.http.services.${COMPOSE_PROJECT_NAME:-hub}-web.loadbalancer.server.port=8080"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME:-hub}-web.rule=Host(`${TRAEFIK_DOMAIN}`) || HostRegexp(`^.+\\.${TRAEFIK_DOMAIN}$`)"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME:-hub}-web.priority=${TRAEFIK_PRIORITY:-10}"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME:-hub}-web.entrypoints=websecure"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME:-hub}-web.tls=true"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME:-hub}-web.tls.certresolver=default"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME:-hub}-web.tls.domains[0].main=${TRAEFIK_DOMAIN}"
- "traefik.http.routers.${COMPOSE_PROJECT_NAME:-hub}-web.tls.domains[0].sans=*.${TRAEFIK_DOMAIN}"
- "traefik.docker.network=proxy-net"