fix(traefik): resolve Dynu quota deadlock with wildcard certificate and automated purge script
This commit is contained in:
1 parent
c87b734c3e
commit
d95cdcb3bb
3 files changed
+50
-3
No files matched your search
@@ -17,8 +17,7 @@ services:
|
|||||||
- "traefik.http.routers.homepage.entrypoints=websecure"
|
- "traefik.http.routers.homepage.entrypoints=websecure"
|
||||||
- "traefik.http.routers.homepage.tls=true"
|
- "traefik.http.routers.homepage.tls=true"
|
||||||
|
|
||||||
# Public (Redirect)
|
# Public (Redirect) - "traefik.http.routers.homepage-red.rule=Host(`arch-services.mywire.org`)"
|
||||||
- "traefik.http.routers.homepage-red.rule=Host(`arch-services.mywire.org`)"
|
|
||||||
- "traefik.http.routers.homepage-red.entrypoints=web"
|
- "traefik.http.routers.homepage-red.entrypoints=web"
|
||||||
- "traefik.http.routers.homepage-red.middlewares=https-redirect@docker"
|
- "traefik.http.routers.homepage-red.middlewares=https-redirect@docker"
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ services:
|
|||||||
- "traefik.http.routers.traefik-dash.rule=Host(`traefik.arch-services.mywire.org`)"
|
- "traefik.http.routers.traefik-dash.rule=Host(`traefik.arch-services.mywire.org`)"
|
||||||
- "traefik.http.routers.traefik-dash.entrypoints=websecure"
|
- "traefik.http.routers.traefik-dash.entrypoints=websecure"
|
||||||
- "traefik.http.routers.traefik-dash.tls=true"
|
- "traefik.http.routers.traefik-dash.tls=true"
|
||||||
- "traefik.http.routers.traefik-dash.tls.certresolver=myresolver"
|
|
||||||
- "traefik.http.routers.traefik-dash.service=api@internal"
|
- "traefik.http.routers.traefik-dash.service=api@internal"
|
||||||
- "traefik.http.routers.traefik-dash.middlewares=authelia-auth@docker"
|
- "traefik.http.routers.traefik-dash.middlewares=authelia-auth@docker"
|
||||||
|
|
||||||
|
|||||||
Executable
+49
@@ -0,0 +1,49 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Path to your configuration
|
||||||
|
# Changed to project relative path
|
||||||
|
ENV_FILE="infra/core/.env"
|
||||||
|
|
||||||
|
# 1. Load Environment Variables
|
||||||
|
if [ -f "$ENV_FILE" ]; then
|
||||||
|
export $(grep -v '^#' "$ENV_FILE" | xargs)
|
||||||
|
else
|
||||||
|
echo "Error: .env file not found at $ENV_FILE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 2. Fetch Domain ID dynamically using the DOMAIN variable
|
||||||
|
echo "Fetching Domain ID for $DOMAIN..."
|
||||||
|
DOMAIN_ID=$(curl -s -X GET "https://api.dynu.com/v2/dns" \
|
||||||
|
-H "API-Key: $DYNU_API_KEY" | \
|
||||||
|
jq -r --arg DOMAIN "$DOMAIN" '.domains[] | select(.name==$DOMAIN) | .id')
|
||||||
|
|
||||||
|
if [ -z "$DOMAIN_ID" ] || [ "$DOMAIN_ID" == "null" ]; then
|
||||||
|
echo "Error: Could not find Domain ID for $DOMAIN. Check your API key and domain name."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Targeting Domain ID: $DOMAIN_ID"
|
||||||
|
|
||||||
|
# 3. Identify and Delete all TXT records
|
||||||
|
echo "Searching for stale TXT records..."
|
||||||
|
TXT_RECORD_IDS=$(curl -s -X GET "https://api.dynu.com/v2/dns/$DOMAIN_ID/record" \
|
||||||
|
-H "API-Key: $DYNU_API_KEY" | \
|
||||||
|
jq -r '.dnsRecords[] | select(.recordType=="TXT") | .id')
|
||||||
|
|
||||||
|
if [ -z "$TXT_RECORD_IDS" ] || [ "$TXT_RECORD_IDS" == "null" ]; then
|
||||||
|
echo "No TXT records found. Quota should be clear."
|
||||||
|
else
|
||||||
|
for ID in $TXT_RECORD_IDS; do
|
||||||
|
echo "Deleting TXT Record ID: $ID"
|
||||||
|
curl -s -X DELETE "https://api.dynu.com/v2/dns/$DOMAIN_ID/record/$ID" \
|
||||||
|
-H "API-Key: $DYNU_API_KEY" > /dev/null
|
||||||
|
done
|
||||||
|
echo "Purge complete."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 4. Restart Traefik to trigger new challenge
|
||||||
|
echo "Restarting Traefik..."
|
||||||
|
cd infra/core/ && docker compose restart traefik
|
||||||
|
|
||||||
|
echo "Process complete. Monitor logs with: docker logs traefik 2>&1 | grep -iE 'acme|dynu'"
|
||||||
Reference in new issue
Block a user