migrations

This commit is contained in:
CanbiZ 2025-06-03 16:18:24 +02:00
parent 5551c2757c
commit 44c98dda24
6 changed files with 51 additions and 60 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: tteck (tteckster) # Author: tteck (tteckster)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE

View File

@ -23,6 +23,7 @@ $STD apt-get install -y \
python3-pip python3-pip
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
setup_uv
NODE_VERSION="22" NODE_MODULE="pnpm@latest" install_node_and_modules NODE_VERSION="22" NODE_MODULE="pnpm@latest" install_node_and_modules
PG_VERSION="16" PG_MODULES="postgis" install_postgresql PG_VERSION="16" PG_MODULES="postgis" install_postgresql
@ -79,11 +80,13 @@ 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 pip install --upgrade pip $STD uv venv /opt/adventurelog/backend/server/venv
$STD pip install -r requirements.txt source /opt/adventurelog/backend/server/venv/bin/activate
$STD python3 manage.py collectstatic --noinput $STD uv pip install --upgrade pip
$STD python3 manage.py migrate $STD uv pip install -r requirements.txt
$STD python3 manage.py download-countries $STD uv python3 manage.py collectstatic --noinput
$STD uv python3 manage.py migrate
$STD uv python3 manage.py download-countries
cat <<EOF >/opt/adventurelog/frontend/.env cat <<EOF >/opt/adventurelog/frontend/.env
PUBLIC_SERVER_URL=http://$LOCAL_IP:8000 PUBLIC_SERVER_URL=http://$LOCAL_IP:8000
BODY_SIZE_LIMIT=Infinity BODY_SIZE_LIMIT=Infinity
@ -96,7 +99,7 @@ echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
msg_ok "Installed AdventureLog" msg_ok "Installed AdventureLog"
msg_info "Setting up Django Admin" msg_info "Setting up Django Admin"
$STD python3 /opt/adventurelog/backend/server/manage.py shell <<EOF $STD uv python3 /opt/adventurelog/backend/server/manage.py shell <<EOF
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
UserModel = get_user_model() UserModel = get_user_model()
user = UserModel.objects.create_user('$DJANGO_ADMIN_USER', password='$DJANGO_ADMIN_PASS') user = UserModel.objects.create_user('$DJANGO_ADMIN_USER', password='$DJANGO_ADMIN_PASS')

View File

@ -19,15 +19,12 @@ $STD apt-get install -y git \
build-essential build-essential
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Setup Python3" setup_uv
$STD apt-get install -y \ UV_PYTHON_VERSION="3.12"
python3 \
python3-dev \ msg_info "Installing Python $UV_PYTHON_VERSION via uv"
python3-pip \ $STD uv python install $UV_PYTHON_VERSION
python3-venv \ msg_ok "Installed Python $UV_PYTHON_VERSION"
python3-setuptools
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
msg_ok "Setup Python3"
msg_info "Creating user octoprint" msg_info "Creating user octoprint"
useradd -m -s /bin/bash -p $(openssl passwd -1 octoprint) octoprint useradd -m -s /bin/bash -p $(openssl passwd -1 octoprint) octoprint
@ -40,11 +37,9 @@ msg_info "Installing OctoPrint"
$STD sudo -u octoprint bash <<EOF $STD sudo -u octoprint bash <<EOF
mkdir /opt/octoprint mkdir /opt/octoprint
cd /opt/octoprint cd /opt/octoprint
python3 -m venv . uv venv --python $UV_PYTHON_VERSION
source bin/activate uv pip install wheel
pip install --upgrade pip uv pip install octoprint
pip install wheel
pip install octoprint
EOF EOF
msg_ok "Installed OctoPrint" msg_ok "Installed OctoPrint"
@ -60,7 +55,7 @@ Environment="LC_ALL=C.UTF-8"
Environment="LANG=C.UTF-8" Environment="LANG=C.UTF-8"
Type=exec Type=exec
User=octoprint User=octoprint
ExecStart=/opt/octoprint/bin/octoprint serve ExecStart=/opt/octoprint/.venv/bin/octoprint serve
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -19,9 +19,7 @@ $STD apt-get install -y \
p7zip-full p7zip-full
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Setup uv"
setup_uv setup_uv
msg_ok "Setup uv"
msg_info "Setup Unrar" msg_info "Setup Unrar"
cat <<EOF >/etc/apt/sources.list.d/non-free.list cat <<EOF >/etc/apt/sources.list.d/non-free.list

View File

@ -35,13 +35,10 @@ $STD apt-get -y install --no-install-recommends \
x11-apps x11-apps
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
setup_uv
$STD uv python install
NODE_VERSION="22" NODE_MODULE="yarn@latest" install_node_and_modules NODE_VERSION="22" NODE_MODULE="yarn@latest" install_node_and_modules
msg_info "Setup Python3"
$STD apt-get install -y python3
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
msg_ok "Setup Python3"
msg_info "Installing Chromium" msg_info "Installing Chromium"
curl -fsSL https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /etc/apt/trusted.gpg.d/google-archive.gpg curl -fsSL https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /etc/apt/trusted.gpg.d/google-archive.gpg
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >/etc/apt/sources.list.d/google.list echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >/etc/apt/sources.list.d/google.list

View File

@ -20,11 +20,8 @@ $STD apt-get install -y \
libapache2-mod-wsgi-py3 libapache2-mod-wsgi-py3
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
msg_info "Installing Python" setup_uv
$STD apt-get install -y python3-pip $STD uv python install
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
msg_ok "Installed Python"
NODE_VERSION="22" NODE_MODULE="yarn@latest,sass" install_node_and_modules NODE_VERSION="22" NODE_MODULE="yarn@latest,sass" install_node_and_modules
msg_info "Setting up wger" msg_info "Setting up wger"
@ -42,13 +39,14 @@ curl -fsSL "https://github.com/wger-project/wger/archive/refs/tags/$RELEASE.tar.
tar xzf $RELEASE.tar.gz tar xzf $RELEASE.tar.gz
mv wger-$RELEASE /home/wger/src mv wger-$RELEASE /home/wger/src
cd /home/wger/src cd /home/wger/src
$STD pip install -r requirements_prod.txt $STD uv venv /home/wger/.venv
$STD pip install -e . $STD uv pip install -r requirements_prod.txt --python=/home/wger/.venv
$STD uv pip install -e . --python=/home/wger/.venv
$STD wger create-settings --database-path /home/wger/db/database.sqlite $STD wger create-settings --database-path /home/wger/db/database.sqlite
sed -i "s#home/wger/src/media#home/wger/media#g" /home/wger/src/settings.py sed -i "s#home/wger/src/media#home/wger/media#g" /home/wger/src/settings.py
sed -i "/MEDIA_ROOT = '\/home\/wger\/media'/a STATIC_ROOT = '/home/wger/static'" /home/wger/src/settings.py sed -i "/MEDIA_ROOT = '\/home\/wger\/media'/a STATIC_ROOT = '/home/wger/static'" /home/wger/src/settings.py
$STD wger bootstrap $STD wger bootstrap
$STD python3 manage.py collectstatic $STD uv python3 manage.py collectstatic
echo "${RELEASE}" >/opt/wger_version.txt echo "${RELEASE}" >/opt/wger_version.txt
msg_ok "Finished setting up wger" msg_ok "Finished setting up wger"