Files
asepharyana-hub/infra/traefik/TRAEFIK_ENV_CONFIG.md
T
asepharyana 092c0b363d Refactor Dockerfile for scraper, update Traefik configuration, and clean up scripts
- Simplified Dockerfile for scraper by removing unnecessary Node.js installation and optimizing build stages.
- Updated Traefik environment configuration to use shorter variable names for certificate paths.
- Removed commented-out middleware configurations in dynamic middlewares.yaml.
- Cleaned up legacy SSL configurations in ssl.yaml.
- Disabled insecure API access in Traefik configuration.
- Deleted unused renovate.json file.
- Modified update environment script to only process apps directory.
- Updated GHCR cleanup script to target specific package.
- Streamlined dependency update script to focus on app submodules.
- Removed setup script for Prometheus as it is no longer needed.
2026-07-21 13:27:13 +07:00

3.1 KiB

Traefik Environment Configuration

This document describes environment variables used to configure Traefik certificate and config paths in production deployments.

Certificate Path Environment Variables

All certificate paths support environment variable substitution with safe fallback defaults. This allows flexible certificate management across different deployment environments without modifying compose files.

Configuration Variables

Variable Description Default Path Purpose
TRAEFIK_CONFIG_PATH Directory containing dynamic Traefik configuration files (YAML) /root/asepharyana-hub/infra/traefik/dynamic Location of middleware, router, and service definitions
TRAEFIK_CERT_MY_ID_PEM Certificate file for asepharyana.my.id /root/asepharyana.my.id.pem SSL/TLS certificate for asepharyana.my.id domain
TRAEFIK_CERT_MY_ID_KEY Key file for asepharyana.my.id /root/asepharyana.my.id.key SSL/TLS private key for asepharyana.my.id domain
TRAEFIK_CERT_WEB_ID_PEM Certificate file for asepharyana.web.id /root/asepharyana.web.id.pem SSL/TLS certificate for asepharyana.web.id domain
TRAEFIK_CERT_WEB_ID_KEY Key file for asepharyana.web.id /root/asepharyana.web.id.key SSL/TLS private key for asepharyana.web.id domain

Usage

Default Behavior (Production)

If no environment variables are set, Traefik will use the default paths shown above. This is suitable for production deployments where certificates are installed at these standard locations.

docker compose -f infra/compose/traefik.yml up -d

Custom Paths (Custom Deployments)

To override paths for a custom deployment, set environment variables before starting services:

export TRAEFIK_CONFIG_PATH=/etc/traefik/custom-dynamic

docker compose -f infra/compose/traefik.yml up -d

Via .env File

Create or update your .env file in the deployment directory:

TRAEFIK_CONFIG_PATH=/root/asepharyana-hub/infra/traefik/dynamic
TRAEFIK_CERT_MY_ID_PEM=/root/asepharyana.my.id.pem
TRAEFIK_CERT_MY_ID_KEY=/root/asepharyana.my.id.key
TRAEFIK_CERT_WEB_ID_PEM=/root/asepharyana.web.id.pem
TRAEFIK_CERT_WEB_ID_KEY=/root/asepharyana.web.id.key

Then deploy:

docker compose --env-file .env -f infra/compose/traefik.yml up -d

Notes

  • All certificate paths use read-only mounts (:ro) for security
  • If a certificate file is missing at the specified path, Docker volume mounting will fail—ensure certificates exist before starting Traefik
  • The dynamic configuration directory must contain valid YAML files for Traefik to load properly