This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
status_code=$(curl --write-out %{http_code} --silent --output /dev/null https://server.tld) | |
logfile=bandaid-log-$(date -I).txt | |
if [[ "$status_code" -ne 200 ]] ; then | |
touch $logfile # This is only here for the sake of compatibility | |
echo "[$(date +%s)][Bandaid] Site status changed to $status_code" >> $logfile | |
echo "[$(date +%s)][Bandaid] Saving mastodon container logs for evaluation..." >> $logfile | |
tmp=$(date +%F_%T) | |
docker compose logs --since 5m > docker-bandaid-log-$(date +%F_%T).txt # This grabs *all* the container logs in docker-compose.yml, to help evaluate the root cause | |
echo "[$(date +%s)][Bandaid] Saved to docker-bandaid-log-$(tmp).txt" >> $logfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "Creating backup folder if one doesn't exist already..." | |
mkdir -p ./backups/3.5.3/ | |
echo "Backing up the Mastodon Database" | |
docker exec mastodon-db-1 pg_dump -Fc -U postgres postgres > ./backups/3.5.3/pg-3.5.3.dump | |
echo "Assuming docker-compose.yml exists in this directory, replacing v3.5.3 with v4.0.0" | |
sed -i 's/v3.5.3/v4.0.0/g' docker-compose.yml | |
echo "Pulling new versions from dockerhub" | |
docker compose pull | |
echo "Performing Pre-deployment database migrations..." |