Skip to content

soulteary/traefik-v3-example

Repository files navigation

Traefik v3.x Quick Start Example

English | 中文

Traefik v3.x Quick Start Example

This project demonstrates how to quickly get started with Traefik v3.x, including dynamic service integration and certificate configuration.

If you find this example helpful, please give it a star ✨. If you want to receive updates about this project, you can click watch 👀 and choose your preferred notification mode.

Features

  • Dynamic Service Integration: Automatic service discovery and configuration based on Docker labels
  • Multiple Certificate Configurations: Support for both ACME automatic certificate issuance and local certificates
  • HTTP/3 Support: Enable HTTP/3 (QUIC) protocol support
  • Dashboard Interface: Built-in Traefik Dashboard visualization interface
  • HTTPS Redirect: Automatically redirect HTTP requests to HTTPS
  • GZIP Compression: Automatically enable response content compression
  • Health Checks: Built-in health check mechanism
  • Production Ready: Anonymous data collection and version checking disabled, suitable for production environments

Project Structure

traefik-v3-example/
├── scripts/                   # Utility scripts directory
│   └── prepare-network.sh    # Docker network creation script
├── traefik/                   # Traefik service configurations
│   ├── base/                 # Base configuration (requires environment variables)
│   ├── acme/                 # ACME automatic certificate configuration
│   └── local-certs/          # Local certificate configuration
├── traefik-make-local-certs/  # Certificate generation tool
├── traefik-app-examples/     # Application integration examples
│   ├── flare/                # Flare service integration example
│   ├── stargate/             # Stargate Forward Auth service example
│   └── owlmail/              # OwlMail email testing service example
├── README.md                  # This document (English)
└── README.zh.md               # This document (Chinese)

Quick Start

Prerequisites

  • Docker 20.10+
  • Docker Compose 2.0+
  • Basic Linux/Unix command line knowledge

Step 1: Prepare Docker Network

Traefik requires a dedicated Docker network:

./scripts/prepare-network.sh

Or create it manually:

docker network create traefik

Step 2: Choose Startup Method

Choose different configuration methods based on your needs:

Method 1: Use Local Certificates (Suitable for Testing)

  1. Generate Self-Signed Certificates:

  2. Start Traefik:

Method 2: Use ACME Automatic Certificate (Suitable for Production)

  1. Configure ACME:

  2. Start Traefik:

Method 3: Use Base Configuration (Requires Complete Environment Variables)

Step 3: Access Dashboard

After successful startup, access the Traefik Dashboard:

  • HTTPS: https://traefik.example.com/dashboard/
  • API: https://traefik.example.com/api/

Note: Please replace traefik.example.com with your actual configured domain name and ensure DNS resolution is correct.

Detailed Documentation

Traefik Configuration

Tools and Examples

Related Resources

Complete Usage Guide

Related Projects

  • Traefik - Cloud-native reverse proxy and load balancer
  • certs-maker - Certificate generation tool
  • docker-flare - Flare service Docker image
  • Stargate - Lightweight Forward Auth authentication service
  • OwlMail - Email development and testing tool, compatible with MailDev

Official Documentation

License

See the LICENSE file for details.