Skip to content

Commit 88df4cb

Browse files
committed
docs: fix error on deployment documentation
1 parent 5e41760 commit 88df4cb

File tree

1 file changed

+62
-33
lines changed

1 file changed

+62
-33
lines changed

docs/DEPLOYMENT.md

Lines changed: 62 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -184,19 +184,26 @@ services:
184184
PORT: "8080"
185185
labels:
186186
- "traefik.enable=true"
187-
# Public routes (telemetry collection) - no auth
188-
- "traefik.http.routers.shm-public.rule=Host(`shm.example.com`) && PathPrefix(`/v1/`)"
189-
- "traefik.http.routers.shm-public.entrypoints=websecure"
190-
- "traefik.http.routers.shm-public.tls.certresolver=letsencrypt"
191-
- "traefik.http.routers.shm-public.service=shm"
192-
# Protected routes (dashboard + admin API) - with ForwardAuth
193-
- "traefik.http.routers.shm-protected.rule=Host(`shm.example.com`) && (PathPrefix(`/api/`) || PathPrefix(`/`))"
194-
- "traefik.http.routers.shm-protected.entrypoints=websecure"
195-
- "traefik.http.routers.shm-protected.tls.certresolver=letsencrypt"
196-
- "traefik.http.routers.shm-protected.middlewares=authelia@docker"
197-
- "traefik.http.routers.shm-protected.service=shm"
198-
- "traefik.http.routers.shm-protected.priority=1"
199-
- "traefik.http.routers.shm-public.priority=2"
187+
# Public API routes (telemetry collection + healthcheck) - no auth
188+
- "traefik.http.routers.shm-api.rule=Host(`shm.example.com`) && PathPrefix(`/api/v1/`) && !PathPrefix(`/api/v1/admin/`)"
189+
- "traefik.http.routers.shm-api.entrypoints=websecure"
190+
- "traefik.http.routers.shm-api.tls.certresolver=letsencrypt"
191+
- "traefik.http.routers.shm-api.service=shm"
192+
- "traefik.http.routers.shm-api.priority=3"
193+
# Protected admin API - with ForwardAuth
194+
- "traefik.http.routers.shm-admin.rule=Host(`shm.example.com`) && PathPrefix(`/api/v1/admin/`)"
195+
- "traefik.http.routers.shm-admin.entrypoints=websecure"
196+
- "traefik.http.routers.shm-admin.tls.certresolver=letsencrypt"
197+
- "traefik.http.routers.shm-admin.middlewares=authelia@docker"
198+
- "traefik.http.routers.shm-admin.service=shm"
199+
- "traefik.http.routers.shm-admin.priority=2"
200+
# Protected dashboard (frontend) - with ForwardAuth
201+
- "traefik.http.routers.shm-dashboard.rule=Host(`shm.example.com`)"
202+
- "traefik.http.routers.shm-dashboard.entrypoints=websecure"
203+
- "traefik.http.routers.shm-dashboard.tls.certresolver=letsencrypt"
204+
- "traefik.http.routers.shm-dashboard.middlewares=authelia@docker"
205+
- "traefik.http.routers.shm-dashboard.service=shm"
206+
- "traefik.http.routers.shm-dashboard.priority=1"
200207
# Service
201208
- "traefik.http.services.shm.loadbalancer.server.port=8080"
202209
# ForwardAuth middleware
@@ -263,19 +270,26 @@ services:
263270
PORT: "8080"
264271
labels:
265272
- "traefik.enable=true"
266-
# Public routes (telemetry collection) - no auth required
267-
- "traefik.http.routers.shm-public.rule=Host(`shm.example.com`) && PathPrefix(`/v1/`)"
268-
- "traefik.http.routers.shm-public.entrypoints=websecure"
269-
- "traefik.http.routers.shm-public.tls.certresolver=letsencrypt"
270-
- "traefik.http.routers.shm-public.service=shm"
271-
- "traefik.http.routers.shm-public.priority=2"
272-
# Protected routes (dashboard + admin API) - with Basic Auth
273-
- "traefik.http.routers.shm-protected.rule=Host(`shm.example.com`)"
274-
- "traefik.http.routers.shm-protected.entrypoints=websecure"
275-
- "traefik.http.routers.shm-protected.tls.certresolver=letsencrypt"
276-
- "traefik.http.routers.shm-protected.middlewares=shm-auth"
277-
- "traefik.http.routers.shm-protected.service=shm"
278-
- "traefik.http.routers.shm-protected.priority=1"
273+
# Public API routes (telemetry collection + healthcheck) - no auth
274+
- "traefik.http.routers.shm-api.rule=Host(`shm.example.com`) && PathPrefix(`/api/v1/`) && !PathPrefix(`/api/v1/admin/`)"
275+
- "traefik.http.routers.shm-api.entrypoints=websecure"
276+
- "traefik.http.routers.shm-api.tls.certresolver=letsencrypt"
277+
- "traefik.http.routers.shm-api.service=shm"
278+
- "traefik.http.routers.shm-api.priority=3"
279+
# Protected admin API - with Basic Auth
280+
- "traefik.http.routers.shm-admin.rule=Host(`shm.example.com`) && PathPrefix(`/api/v1/admin/`)"
281+
- "traefik.http.routers.shm-admin.entrypoints=websecure"
282+
- "traefik.http.routers.shm-admin.tls.certresolver=letsencrypt"
283+
- "traefik.http.routers.shm-admin.middlewares=shm-auth"
284+
- "traefik.http.routers.shm-admin.service=shm"
285+
- "traefik.http.routers.shm-admin.priority=2"
286+
# Protected dashboard (frontend) - with Basic Auth
287+
- "traefik.http.routers.shm-dashboard.rule=Host(`shm.example.com`)"
288+
- "traefik.http.routers.shm-dashboard.entrypoints=websecure"
289+
- "traefik.http.routers.shm-dashboard.tls.certresolver=letsencrypt"
290+
- "traefik.http.routers.shm-dashboard.middlewares=shm-auth"
291+
- "traefik.http.routers.shm-dashboard.service=shm"
292+
- "traefik.http.routers.shm-dashboard.priority=1"
279293
# Service
280294
- "traefik.http.services.shm.loadbalancer.server.port=8080"
281295
# Basic Auth middleware (generate with: htpasswd -nb admin password)
@@ -311,16 +325,28 @@ server {
311325
ssl_certificate /etc/letsencrypt/live/shm.example.com/fullchain.pem;
312326
ssl_certificate_key /etc/letsencrypt/live/shm.example.com/privkey.pem;
313327
314-
# Public telemetry endpoints - no auth
315-
location /v1/ {
328+
# Public API (telemetry + healthcheck) - no auth
329+
location /api/v1/ {
330+
# Exclude admin endpoints
331+
location /api/v1/admin/ {
332+
auth_basic "SHM Admin";
333+
auth_basic_user_file /etc/nginx/.htpasswd;
334+
335+
proxy_pass http://shm;
336+
proxy_set_header Host $host;
337+
proxy_set_header X-Real-IP $remote_addr;
338+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
339+
proxy_set_header X-Forwarded-Proto $scheme;
340+
}
341+
316342
proxy_pass http://shm;
317343
proxy_set_header Host $host;
318344
proxy_set_header X-Real-IP $remote_addr;
319345
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
320346
proxy_set_header X-Forwarded-Proto $scheme;
321347
}
322348
323-
# Protected dashboard and admin API
349+
# Protected dashboard (frontend)
324350
location / {
325351
auth_basic "SHM Dashboard";
326352
auth_basic_user_file /etc/nginx/.htpasswd;
@@ -344,13 +370,16 @@ htpasswd -c /etc/nginx/.htpasswd admin
344370

345371
```caddyfile
346372
shm.example.com {
347-
# Public telemetry endpoints
348-
@public path /v1/*
349-
handle @public {
373+
# Public API (telemetry + healthcheck) - no auth
374+
@public_api {
375+
path /api/v1/*
376+
not path /api/v1/admin/*
377+
}
378+
handle @public_api {
350379
reverse_proxy localhost:8080
351380
}
352381
353-
# Protected dashboard
382+
# Protected admin API and dashboard
354383
handle {
355384
basicauth {
356385
admin $2a$14$... # bcrypt hash

0 commit comments

Comments
 (0)