返回顶部
i

initial-traefik

Initialize and configure Traefik reverse proxy with Docker. Install Traefik, configure Docker Compose, set up service routing via path prefix or host-based routing, enable features like dashboard metrics logging tracing, configure Dashboard access via nip.io or path prefix

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
294
下载量
0
收藏
概述
安装方式
版本历史

initial-traefik

# Initial Traefik Initialize and configure Traefik v3 reverse proxy with Docker Compose for service routing and load balancing. ## Quick Start ### 1. Create Configuration ```bash mkdir -p ~/.docker/compose cd ~/.docker/compose ``` ### 2. Create docker-compose.yml Use `assets/docker-compose.yml` as template. Key configuration: ```yaml services: traefik: image: traefik:v3.0 container_name: traefik ports: - "80:80" - "443:443" volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - ./traefik-dynamic.yml:/etc/traefik/dynamic.yml:ro command: - --api=true - --api.dashboard=true - --providers.docker=true - --providers.docker.exposedbydefault=false - --providers.file.directory=/etc/traefik - --providers.file.watch=true - --entrypoints.web.address=:80 - --accesslog=true - --metrics.prometheus=true ``` ### 3. Create Dynamic Configuration Use `assets/traefik-dynamic.yml` as template for service routing. ### 4. Start Traefik ```bash docker compose up -d ``` ### 5. Connect Services to Network ```bash for container in <service-names>; do docker network connect compose_default $container done ``` ## Routing Options ### Option A: Path Prefix Routing (IP + Path) Access services via `http://<IP>/<service>`: ```yaml http: routers: n8n: rule: "PathPrefix(`/n8n`)" service: n8n entryPoints: - web middlewares: - n8n-stripprefix middlewares: n8n-stripprefix: stripPrefix: prefixes: - /n8n services: n8n: loadBalancer: servers: - url: "http://n8n:5678" ``` Access: `http://192.168.9.192/n8n` ### Option B: Host-Based Routing (.nip.io) Access services via `http://<service>.<IP>.nip.io`: ```yaml http: routers: n8n: rule: "Host(`n8n.192.168.9.192.nip.io`)" service: n8n entryPoints: - web services: n8n: loadBalancer: servers: - url: "http://n8n:5678" ``` Access: `http://n8n.192.168.9.192.nip.io` ### Option C: Docker Labels Configure routing directly in docker-compose.yml labels: ```yaml services: traefik: labels: - "traefik.enable=true" - "traefik.http.routers.dashboard.rule=Host(`traefik.192.168.9.192.nip.io`)" - "traefik.http.routers.dashboard.service=api@internal" - "traefik.http.routers.dashboard.entrypoints=web" ``` ## Enable Features See `references/features.md` for complete feature list and configuration. ## Common Tasks ### Add New Service 1. Connect container to network: ```bash docker network connect compose_default <container-name> ``` 2. Add router to `traefik-dynamic.yml`: ```yaml routers: myservice: rule: "PathPrefix(`/myservice`)" service: myservice entryPoints: - web middlewares: - myservice-stripprefix services: myservice: loadBalancer: servers: - url: "http://<container-name>:<port>" ``` Traefik auto-reloads configuration. ### Check Status ```bash docker logs traefik | grep -E "router|error" docker exec traefik wget -q -O - http://localhost:8080/api/http/routers ``` ### Restart Traefik ```bash docker restart traefik ``` ## References - **Features**: See `references/features.md` for all available features - **Examples**: See `references/examples.md` for common configurations - **Templates**: See `assets/` for configuration templates ## Troubleshooting - **404 errors**: Check container is connected to `compose_default` network - **Configuration not loading**: Check `traefik-dynamic.yml` YAML syntax - **Service not accessible**: Verify container name and port in service configuration - **Dashboard not working**: Ensure `--api.dashboard=true` is in command

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 initial-traefik-1776273002 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 initial-traefik-1776273002 技能

通过命令行安装

skillhub install initial-traefik-1776273002

下载 Zip 包

⬇ 下载 initial-traefik v1.0.0

文件大小: 7.83 KB | 发布时间: 2026-4-16 16:02

v1.0.0 最新 2026-4-16 16:02
initial-traefik 1.0.0 – Initial release

- Provides setup instructions for Traefik v3 reverse proxy with Docker Compose.
- Includes example Docker Compose and dynamic configuration templates.
- Covers multiple routing methods: path prefix, host-based (.nip.io), and Docker labels.
- Details enabling features like dashboard, metrics, logging, and tracing.
- Offers troubleshooting steps and references for further configuration.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部