AdventureLog: add backup folder before update (#6066)

This commit is contained in:
CanbiZ 2025-07-18 19:25:34 +02:00 committed by GitHub
parent c62b244569
commit 745533759a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -35,26 +35,29 @@ function update_script() {
systemctl stop adventurelog-frontend
msg_ok "Services Stopped"
msg_info "Backup Old Installation"
mkdir -p /opt/adventurelog-backup
cp /opt/adventurelog/backend/server/.env /opt/adventurelog-backup/backend/server/.env
cp -r /opt/adventurelog/backend/server/media /opt/adventurelog-backup/backend/server/media
cp /opt/adventurelog/frontend/.env /opt/adventurelog-backup/frontend/.env
msg_ok "Backup done"
fetch_and_deploy_gh_release "adventurelog" "seanmorley15/adventurelog"
PYTHON_VERSION="3.12" setup_uv
msg_info "Updating ${APP} to v${RELEASE}"
# Backend Migration
cp /opt/adventurelog-backup/backend/server/.env /opt/adventurelog/backend/server/.env
cp -r /opt/adventurelog-backup/backend/server/media /opt/adventurelog/backend/server/media
cd /opt/adventurelog/backend/server
if [[ ! -x .venv/bin/python ]]; then
$STD uv venv .venv
$STD .venv/bin/python -m ensurepip --upgrade
fi
$STD .venv/bin/python -m pip install --upgrade pip
$STD .venv/bin/python -m pip install -r requirements.txt
$STD .venv/bin/python -m manage collectstatic --noinput
$STD .venv/bin/python -m manage migrate
# Frontend Migration
cp /opt/adventurelog-backup/frontend/.env /opt/adventurelog/frontend/.env
cd /opt/adventurelog/frontend
$STD pnpm i
@ -68,7 +71,6 @@ function update_script() {
msg_ok "Services Started"
msg_info "Cleaning Up"
rm -rf /opt/v${RELEASE}.zip
rm -rf /opt/adventurelog-backup
msg_ok "Cleaned"