chore: complete update
This commit is contained in:
37
ansible/nginx-cdn-germany/scripts/warm-cache.sh
Normal file
37
ansible/nginx-cdn-germany/scripts/warm-cache.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# Cache Warming Script
|
||||
|
||||
INVENTORY_FILE="inventories/production/hosts.yml"
|
||||
|
||||
# URLs zum Cache-Warming
|
||||
URLS=(
|
||||
"/"
|
||||
"/health"
|
||||
# Füge hier deine wichtigsten URLs hinzu:
|
||||
# "/css/main.css"
|
||||
# "/js/app.js"
|
||||
# "/images/logo.png"
|
||||
)
|
||||
|
||||
echo "🔥 Starting cache warming for all CDN nodes..."
|
||||
|
||||
# Hole alle CDN Node Hostnamen
|
||||
CDN_NODES=$(ansible-inventory -i $INVENTORY_FILE --list | jq -r '.cdn_nodes.hosts[]' 2>/dev/null || ansible cdn_nodes -i $INVENTORY_FILE --list-hosts | grep -v hosts)
|
||||
|
||||
for node in $CDN_NODES; do
|
||||
echo "Warming cache for: $node"
|
||||
|
||||
for url in "${URLS[@]}"; do
|
||||
echo " Warming: $url"
|
||||
response=$(curl -s -o /dev/null -w "%{http_code}" "https://${node}${url}" || echo "000")
|
||||
if [ "$response" = "200" ]; then
|
||||
echo " ✅ OK"
|
||||
else
|
||||
echo " ❌ Failed (HTTP $response)"
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
echo ""
|
||||
done
|
||||
|
||||
echo "🎉 Cache warming completed!"
|
||||
Reference in New Issue
Block a user