peertube-grayjay/deploy.sh

26 lines
1 KiB
Bash
Raw Normal View History

2023-08-10 05:36:29 -04:00
#!/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..."
2023-09-12 03:20:57 -04:00
mkdir -p $DOCUMENT_ROOT/PeerTube
cp peertube.png $DOCUMENT_ROOT/PeerTube
cp PeerTubeConfig.json $DOCUMENT_ROOT/PeerTube
cp PeerTubeScript.js $DOCUMENT_ROOT/PeerTube
2023-09-28 05:26:47 -04:00
sh sign.sh $DOCUMENT_ROOT/PeerTube/PeerTubeScript.js $DOCUMENT_ROOT/PeerTube/PeerTubeConfig.json
2023-08-10 05:36:29 -04:00
# Notify Cloudflare to wipe the CDN cache
2023-09-12 04:22:11 -04:00
echo "Purging Cloudflare cache for zone $CLOUDFLARE_ZONE_ID..."
2023-08-10 05:36:29 -04:00
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" \
2023-09-12 04:22:11 -04:00
--data '{"files":["https://plugins.grayjay.app/PeerTube/peertube.png", "https://plugins.grayjay.app/PeerTube/PeerTubeConfig.json", "https://plugins.grayjay.app/PeerTube/PeerTubeScript.js"]}'
2023-08-10 05:36:29 -04:00
# Take site back online
echo "Bringing site back online..."
2023-09-12 03:20:57 -04:00
rm $DOCUMENT_ROOT/maintenance.file