AdventureLog: Full UV Mig

This commit is contained in:
CanbiZ 2025-06-04 10:03:36 +02:00
parent e08247874d
commit 3b912745e7
2 changed files with 15 additions and 7 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/python_to_uv/misc/build.func)
# Copyright (c) 2021-2025 tteck # Copyright (c) 2021-2025 tteck
# Author: MickLesk (Canbiz) # Author: MickLesk (Canbiz)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
@ -27,6 +27,8 @@ function update_script() {
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
PYTHON_VERSION="3.12" setup_uv
RELEASE=$(curl -fsSL https://api.github.com/repos/seanmorley15/AdventureLog/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') RELEASE=$(curl -fsSL https://api.github.com/repos/seanmorley15/AdventureLog/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping Services" msg_info "Stopping Services"
@ -43,10 +45,16 @@ function update_script() {
mv /opt/adventurelog-backup/backend/server/.env /opt/adventurelog/backend/server/.env mv /opt/adventurelog-backup/backend/server/.env /opt/adventurelog/backend/server/.env
mv /opt/adventurelog-backup/backend/server/media /opt/adventurelog/backend/server/media mv /opt/adventurelog-backup/backend/server/media /opt/adventurelog/backend/server/media
cd /opt/adventurelog/backend/server cd /opt/adventurelog/backend/server
$STD pip install --upgrade pip $STD uv venv --python "$UV_PYTHON_VERSION" .venv
$STD pip install -r requirements.txt if grep -q "ExecStart=.*python3 manage.py runserver" /etc/systemd/system/adventurelog-backend.service; then
$STD python3 manage.py collectstatic --noinput sed -i "s|ExecStart=.*python3 manage.py runserver|ExecStart=$(pwd)/.venv/bin/python manage.py runserver|" /etc/systemd/system/adventurelog-backend.service
$STD python3 manage.py migrate systemctl daemon-reload
fi
$STD uv pip install --upgrade pip --python=.venv/bin/python
$STD uv pip install -r requirements.txt --python=.venv/bin/python
$STD uv run --python=.venv/bin/python python manage.py collectstatic --noinput
$STD uv run --python=.venv/bin/python python manage.py migrate
mv /opt/adventurelog-backup/frontend/.env /opt/adventurelog/frontend/.env mv /opt/adventurelog-backup/frontend/.env /opt/adventurelog/frontend/.env
cd /opt/adventurelog/frontend cd /opt/adventurelog/frontend

View File

@ -78,7 +78,7 @@ DISABLE_REGISTRATION=False
EOF EOF
cd /opt/adventurelog/backend/server cd /opt/adventurelog/backend/server
mkdir -p /opt/adventurelog/backend/server/media mkdir -p /opt/adventurelog/backend/server/media
$STD uv venv --python $UV_PYTHON_VERSION /opt/adventurelog/backend/server/venv $STD uv venv --python $UV_PYTHON_VERSION /opt/adventurelog/backend/server/.venv
$STD uv pip install --upgrade pip $STD uv pip install --upgrade pip
$STD uv pip install -r requirements.txt $STD uv pip install -r requirements.txt
$STD uv run python manage.py collectstatic --noinput $STD uv run python manage.py collectstatic --noinput
@ -120,7 +120,7 @@ After=network.target postgresql.service
[Service] [Service]
WorkingDirectory=/opt/adventurelog/backend/server WorkingDirectory=/opt/adventurelog/backend/server
ExecStart=/opt/adventurelog/backend/server/venv/bin/python manage.py runserver 0.0.0.0:8000 ExecStart=/opt/adventurelog/backend/server/.venv/bin/python manage.py runserver 0.0.0.0:8000
Restart=always Restart=always
EnvironmentFile=/opt/adventurelog/backend/server/.env EnvironmentFile=/opt/adventurelog/backend/server/.env