peertube-grayjay/deploy.sh
2023-08-10 11:36:29 +02:00

23 lines
No EOL
695 B
Bash

#!/bin/sh
DOCUMENT_ROOT=/var/www/sources
# Take site offline
echo "Taking site offline..."
touch $DOCUMENT_ROOT/maintenance.file
# Swap over the content
echo "Deploying content..."
cp peertube.png $DOCUMENT_ROOT/
cp PeerTubeConfig.json $DOCUMENT_ROOT/
cp PeerTubeScript.js $DOCUMENT_ROOT/
# Notify Cloudflare to wipe the CDN cache
echo "Purging Cloudflare cache..."
curl -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/purge_cache" \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'
# Take site back online
echo "Bringing site back online..."
rm $DOCUMENT_ROOT/maintenance.file