Adds docker/traefik-dynamic.example.yml (web -> 301 https, websecure with letsencrypt resolver, loadBalancer to container:30004 with /healthz check) and a deploy-dokploy.md section covering the Dokploy Traefik File System steps, the DNS/dokploy-network prerequisites, and post-save verification.
49 lines
2.2 KiB
YAML
49 lines
2.2 KiB
YAML
# ตัวอย่าง Traefik dynamic config (File Provider) สำหรับ alterflixhub.hobbypj.com
|
|
# วางไฟล์นี้ใน /etc/dokploy/traefik/dynamic/ ผ่าน Dokploy → Web Server → Traefik File System
|
|
# เช่นตั้งชื่อไฟล์: alterflixhub-hobbypj-com.yml
|
|
# Traefik watch โฟลเดอร์นี้อยู่แล้ว → save แล้วมีผลทันที ไม่ต้อง restart
|
|
#
|
|
# ก่อนใช้ต้องมั่นใจ 2 อย่าง
|
|
# 1) DNS alterflixhub.hobbypj.com ชี้มาที่ IP ของเครื่องที่รัน Dokploy (สำหรับ Let's Encrypt HTTP-01 ต้องเปิดพอร์ต 80)
|
|
# 2) container ของเว็บอยู่ใน network เดียวกับ Traefik (dokploy-network) และ Traefik ต่อถึงได้ที่ "ชื่อ container:30004"
|
|
# หาชื่อจริงด้วย: docker ps --format '{{.Names}}\t{{.Ports}}' | grep alterflix
|
|
# ถ้ายังไม่อยู่ใน network: docker network connect dokploy-network <container-name>
|
|
|
|
http:
|
|
routers:
|
|
# 1) http (พอร์ต 80) → 301 ไป https
|
|
alterflixhub-web:
|
|
rule: "Host(`alterflixhub.hobbypj.com`)"
|
|
entryPoints:
|
|
- web
|
|
middlewares:
|
|
- alterflixhub-redirect-https
|
|
service: alterflixhub-service
|
|
|
|
# 2) https (พอร์ต 443) → เสิร์ฟเว็บจริง + ขอ cert จาก letsencrypt
|
|
alterflixhub-websecure:
|
|
rule: "Host(`alterflixhub.hobbypj.com`)"
|
|
entryPoints:
|
|
- websecure
|
|
service: alterflixhub-service
|
|
tls:
|
|
certResolver: letsencrypt
|
|
|
|
middlewares:
|
|
alterflixhub-redirect-https:
|
|
redirectScheme:
|
|
scheme: https
|
|
permanent: true
|
|
|
|
services:
|
|
alterflixhub-service:
|
|
loadBalancer:
|
|
# ชื่อ container:พอร์ต *ใน* คอนเทนเนอร์ (ไม่ใช่พอร์ตที่ map ออก host)
|
|
servers:
|
|
- url: "http://web-alterflixhub-web-1:30004"
|
|
passHostHeader: true
|
|
healthCheck:
|
|
path: /healthz
|
|
interval: 30s
|
|
timeout: 3s
|