Skip to content

Restart Services to Apply Traefik Middleware Fixes

Problem

After updating Traefik middleware references in compose files, services are still showing errors:

ERR error="middleware \"compression@docker\" does not exist"

Root Cause

The services were started with old labels. Docker Compose reads labels from the compose file when services are started/created, not when Traefik restarts.

Solution

Restart the qualification services to pick up the new labels from the updated compose file.

Steps on VPS

cd /opt/po-platform

# 1. Verify compose file has updated labels (should show compression@file)
grep "compression@file" infrastructure/compose/qualification.yml | head -3

# 2. If labels are correct, restart all qualification services
docker compose -f infrastructure/compose/qualification.yml --env-file .env.qual restart

# 3. Or force recreate to ensure fresh labels
docker compose -f infrastructure/compose/qualification.yml --env-file .env.qual up -d --force-recreate

# 4. Verify errors are gone
docker logs po-traefik 2>&1 | grep -i "compression.*does not exist" | wc -l
# Should output: 0

Alternative: Restart Individual Services

If you want to restart services one by one:

cd /opt/po-platform

# List all qualification services
docker compose -f infrastructure/compose/qualification.yml --env-file .env.qual ps --services

# Restart specific service
docker compose -f infrastructure/compose/qualification.yml --env-file .env.qual restart <service-name>

# Example: Restart all services with compression middleware
for service in public-fo-qual strapi-cms-qual api-gateway-qual keycloak-qual auth-service-qual payment-service-qual notification-service-qual file-service-qual; do
  docker compose -f infrastructure/compose/qualification.yml --env-file .env.qual restart $service
done

Verification

After restarting services:

# Check Traefik logs - should see no compression errors
docker logs po-traefik 2>&1 | grep -i "compression.*does not exist"

# Should output nothing (no errors)

# Check that services are using correct middleware
docker logs po-traefik 2>&1 | grep -i "compression@file" | head -5

# Should show services using compression@file middleware

Why Restart is Needed

Docker Compose labels are read when containers are created, not when Traefik restarts. The flow is:

  1. Compose file defines labels → Services read labels when started
  2. Traefik reads labels from running containers → Updates routing configuration
  3. When labels change → Services must restart to pick up new labels

Expected Timeline

  • Traefik restarted → Certificate resolver fixes applied
  • Services restarted → Middleware labels updated (needs to be done)
  • After services restart → All errors should be resolved