2 KiB
Migrate an existing Traefik v2 instance to v3
Use this guide if you already run Traefik v2 with frappe_docker and want to upgrade to v3. It focuses on the image upgrade and the v3 routing rule changes that affect existing setups.
Before you start
Before migrating anything, it is always recommended to create a backup. Better safe than sorry. In particular, compose and .env should be backed up.
Quick upgrade summary
- Pull the updated repo
- Update env variables especially the updated
SITEStoSITES_RULE - Regenerate the compose config and restart the stack
Multiple hostnames
v2 allowed comma-separated host lists inside Host(...). In v3 traefik uses logical OR
Before (v2):
Host(`a.example.com`,`b.example.com`)
After (v3):
Host(`a.example.com`) || Host(`b.example.com`)
Step 1: Replace SITES with SITES_RULE
All Traefik routing for HTTPS and multi-bench setups now uses SITES_RULE, which is a full v3 rule expression
Single site:
SITES_RULE=Host(`erp.example.com`)
Multiple sites:
SITES_RULE=Host(`a.example.com`) || Host(`b.example.com`)
Step 2: Regenerate and start your compose config
Example for HTTPS:
docker compose --env-file .env \
-f compose.yaml \
-f overrides/compose.mariadb.yaml \
-f overrides/compose.redis.yaml \
-f overrides/compose.https.yaml \
config > ~/gitops/docker-compose.yml
docker compose --project-name <project-name> -f ~/gitops/docker-compose.yml up -d
Step 3: Verify Traefik
After restarting, Traefik will be used in the new supported version 3.6 and the same URLs will be used for the instances when making adjustments. After that, the pages should be accessible as before via the proxy and, if using HTTPS, via HTTPS.
Rollback
If you need to rollback:
- Revert Traefik image to
v2.11 - Restore the old
SITESvariable format and v2 rules - Regenerate the compose config and restart