ghost: migrated to v6 + Docker Compose setup

This commit is contained in:
2026-07-09 02:14:16 -07:00
parent 7f860d47b9
commit 1934ce36af
9 changed files with 144 additions and 96 deletions

View File

@@ -8,29 +8,30 @@ logFile=${HOME}/backup_logs/$(date +%y_%m).log
{
echo -e "\n[+] ghost backup\n"
cd "${BLOG_PATH}" || exit
TMP_DIR="/tmp/${USER}-backup"
mkdir -p "${TMP_DIR}"
if ! /usr/bin/expect "${HOME}"/"${USER}"-credentials.exp; then
curl -Ss \
-H "Title: Ghost Blog" \
-H "Priority: 3" \
-H "Tags: warning,backup" \
-d "Backup not completed - ghost backup failure" \
"${NOTIF_URL}"
rm -r "${BLOG_PATH}"/backup*
exit 1
fi
sudo docker compose -f "${HOME}"/"${USER}"-compose.yaml stop ghost
echo "[+] local backup taken"
# Dump database
# shellcheck disable=SC2024
sudo docker exec ghost-mysql mysqldump \
-u root --password="${DB_ROOT_PASSWORD}" \
--no-tablespaces ghost >"${TMP_DIR}/db.sql"
if ! rclone copyto "${BLOG_PATH}"/backup*.zip "${BUCKET_PATH}" -v; then
# Backup content (exclude logs)
rsync -a --exclude='logs/' "${VOLUME_PATH}/content/" "${TMP_DIR}/content/"
sudo docker compose -f "${HOME}"/"${USER}"-compose.yaml start ghost
if ! rclone copy "${TMP_DIR}" "${BUCKET_PATH}" -v; then
curl -Ss \
-H "Title: Ghost Blog" \
-H "Priority: 3" \
-H "Tags: warning,backup" \
-d "Backup not completed - rclone failure" \
"${NOTIF_URL}"
rm -r "${BLOG_PATH}"/backup*
rm -rf "${TMP_DIR}"
exit 1
fi
@@ -40,6 +41,6 @@ logFile=${HOME}/backup_logs/$(date +%y_%m).log
-H "Tags: heavy_check_mark,backup" \
-d "Backup completed" \
"${NOTIF_URL}"
rm -r "${BLOG_PATH}"/backup*
rm -rf "${TMP_DIR}"
} &>>"$logFile"