Skip to content

karam-ajaj/TraefikLens

Repository files navigation

TraefikLens 🔍

A simple, fast, and elegant dashboard for visualizing Traefik routes in real-time.

TraefikLens Dashboard

Features ✨

  • Real-time Route Monitoring: Automatically fetches and displays Traefik routes.
  • Modern UI: A clean, responsive, and customizable user interface.
  • Glassmorphism Design: A beautiful, modern, and elegant "glassy" look.
  • Dynamic Icons: Automatically fetches icons for your services.
  • Customizable Refresh Interval: Configure how often routes are updated.
  • Theme Support: Light, Dark, and Dynamic (system preference) themes.
  • Icon Customization: Use regex patterns to assign custom icons to routes.
  • Clickable Route Cards: Jump straight to any route via the route tile shortcut.
  • Route Search: Filter routes instantly by name, service, or rule.
  • Docker-Based: Easy deployment with Docker and Docker Compose.
  • Lightweight & Fast: Minimal resource usage, fast loading times.
  • YAML Configuration: Simple YAML configuration for all customizations.

Quick Start 🚀

Prerequisites

  • Docker and Docker Compose installed.
  • Traefik running with the API enabled.

Setup

  1. Clone the repository:

    git clone https://github.com/karam-ajaj/TraefikLens.git
    cd TraefikLens
  2. Configure the dashboard:

    Create a configuration.yml file by copying the configuration.example.yml:

    cp configuration.example.yml configuration.yml

    Edit configuration.yml to match your Traefik setup:

    traefik:
      api_url: "http://traefik:8080/api"
      refresh_interval: 5
  3. Run with Docker Compose:

    docker-compose up -d
  4. Access the dashboard:

Open your browser and navigate to http://localhost:8000 (or the port you configured).

Configuration ⚙️

All configuration is managed through the configuration.yml file. Here is a comprehensive example:

version: 2.0

traefik:
  api_url: "http://traefik:8080/api" # Your Traefik API URL
  refresh_interval: 3600 # In seconds
  timeout: 5

dashboard:
  title: "TraefikLens Dashboard"
  default_theme: "dynamic" # Can be "light", "dark", or "dynamic"

icons:
  default_icon: "mdi:web"
  dynamic:
    enabled: true
    base_url: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/"
    extension: ".svg"
    slug_strategy: "service"
  rules:
    - pattern: ".*api.*"
      icon: "mdi:api"
    - pattern: ".*dashboard.*"
      icon: "mdi:monitor-dashboard"
    - pattern: ".*admin.*"
      icon: "mdi:shield-account"

categories:
  label_key: "traefiklens.category"
  additional_keys:
    - "traefiklens_category"
  rules:
    - pattern: "media"
      category: "Media"
    - pattern: "^auth-.*"
      category: "Security"

services:
  exclude:
    - "-https@" # Exclude routes with names ending in "-https@"
  overrides:
    - service: "my-service@docker"
      display_name: "My Awesome Service"
      icon: "mdi:rocket"
  manual:
    - name: "My Manual Service"
      url: "https://example.com"
      icon: "mdi:web"
      category: "External"
  labels:
    - "traefiklens.category=media" # Only show services with this label
  display:
    strip_provider_suffix: true
    strip_suffixes:
      - "-http"
      - "-https"
      - "-tcp"

See configuration.example.yml for all available options.

Services

You can exclude services, override their display names and icons, and even add manual services that are not in Traefik.

services:
  exclude:
    - ".*-https" # Exclude routes ending with -https
  overrides:
    - service: "my-service@docker"
      display_name: "My Awesome Service"
      icon: "mdi:rocket"
  manual:
    - name: "My Manual Service"
      url: "https://example.com"
      icon: "mdi:web"
      category: "External"

Categories

Group services into categories by defining rules in your configuration.yml. The first rule that matches a service's name will be used.

categories:
  rules:
    - pattern: "media"
      category: "Media"
    - pattern: "^auth-.*"
      category: "Security"

You can also still use Traefik labels or overrides to categorize services.

# In your docker-compose.yml for a service
labels:
  - "traefiklens.category=My Category"

Icons

Customize icons for your services using regex patterns.

icons:
  rules:
    - pattern: ".*-api"
      icon: "mdi:api"

Development 🛠️

To run the application in development mode:

  1. Install the Python dependencies:

    pip install -r requirements.txt
  2. Run the Flask application:

    python app.py

The application will be available at http://localhost:8000.

Contributing 🤝

Contributions are welcome! Please feel free to submit a pull request or open an issue.

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages