Compare commits

..

3 Commits

Author SHA1 Message Date
Sam Heinz ae18f7f4c2 feat(erpnext): add migration to v16/update install script for v16 2026-06-27 22:13:32 +10:00
community-scripts-pr-app[bot] 8b99d3b1cc Update CHANGELOG.md (#15430)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-06-27 02:52:41 +00:00
Copilot 039470965b fix(endurain): replace Poetry/uv-pip backend setup with uv sync --frozen --no-dev (#15429)
* Initial plan

* fix: remove exclude-newer constraint from pyproject.toml before uv pip install in endurain

* fix(endurain): replace poetry+uv pip with uv sync --frozen --no-dev

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-06-27 12:52:18 +10:00
5 changed files with 66 additions and 18 deletions
+6
View File
@@ -486,6 +486,12 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
</details>
## 2026-06-27
### ❔ Uncategorized
- fix(endurain): replace Poetry/uv-pip backend setup with uv sync --frozen --no-dev [@Copilot](https://github.com/Copilot) ([#15429](https://github.com/community-scripts/ProxmoxVE/pull/15429))
## 2026-06-26
### 🚀 Updated Scripts
+1 -4
View File
@@ -63,10 +63,7 @@ function update_script() {
cd /opt/endurain/backend
UV_VERSION=$(grep -Po 'required-version\s*=\s*"\K[^"]+' pyproject.toml 2>/dev/null || echo "0.11.18")
UV_VERSION="$UV_VERSION" setup_uv
$STD poetry export -f requirements.txt --output requirements.txt --without-hashes
$STD uv venv --clear
$STD uv pip install -r requirements.txt
$STD uv pip install pytz
$STD uv sync --frozen --no-dev
msg_ok "Backend Updated"
msg_info "Starting Service"
+53 -3
View File
@@ -29,9 +29,59 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
msg_info "Updating ERPNext"
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:$PATH"; cd /opt/frappe-bench && bench update --reset'
msg_ok "Updated ERPNext"
FRAPPE_MAJOR="$(grep -oP '__version__\s*=\s*[\x27"]\K[0-9]+' /opt/frappe-bench/apps/frappe/frappe/__init__.py 2>/dev/null || echo 0)"
SITE="$(ls /opt/frappe-bench/sites/*/site_config.json 2>/dev/null | head -1 | cut -d/ -f5)"
[[ -z "$SITE" ]] && SITE="site1.local"
if [[ "${FRAPPE_MAJOR:-0}" -lt 16 ]] && { [[ "${PHS_SILENT:-0}" == "1" ]] || whiptail --backtitle "Proxmox VE Helper Scripts" --title "ERPNext v16 Major Upgrade" \
--yesno "A major upgrade from Frappe/ERPNext v15 to v16 is available.\n\nUpgrade to v16 now?" 16 78; }; then
msg_info "Backing up site ${SITE}"
$STD sudo -u frappe bash -c "export PATH=\"\$HOME/.local/bin:/usr/local/bin:\$PATH\"; cd /opt/frappe-bench && bench --site ${SITE} backup"
msg_ok "Backup created"
msg_info "Installing Dependencies"
$STD apt-get install -y pkg-config
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:/usr/local/bin:$PATH"; uv python install 3.14'
msg_ok "Installed Dependencies"
msg_info "Migrating bench environment"
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:/usr/local/bin:$PATH"; cd /opt/frappe-bench && bench migrate-env "$(uv python find 3.14)"'
msg_ok "Migrated environment"
msg_info "Switching Frappe and ERPNext to v16 (Patience)"
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:/usr/local/bin:$PATH"; cd /opt/frappe-bench && bench switch-to-branch version-16 frappe erpnext --upgrade' || true
NEW_MAJOR="$(grep -oP '__version__\s*=\s*[\x27"]\K[0-9]+' /opt/frappe-bench/apps/frappe/frappe/__init__.py 2>/dev/null || echo 0)"
if [[ "${NEW_MAJOR:-0}" -lt 16 ]]; then
msg_error "Failed to switch Frappe/ERPNext to v16"
exit 250
fi
msg_ok "Switched to v16"
msg_info "Running database migration (Patience)"
for i in 1 2 3; do
$STD sudo -u frappe bash -c "export PATH=\"\$HOME/.local/bin:/usr/local/bin:\$PATH\"; cd /opt/frappe-bench && bench --site ${SITE} migrate" && break
[[ "$i" -eq 3 ]] && {
msg_error "Database migration failed after 3 attempts"
exit 253
}
done
msg_ok "Database migrated"
msg_info "Building assets"
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:/usr/local/bin:$PATH"; cd /opt/frappe-bench && bench build --production'
msg_ok "Assets built"
msg_info "Restarting ERPNext"
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:/usr/local/bin:$PATH"; cd /opt/frappe-bench && bench restart'
msg_ok "Upgraded ERPNext to v16"
else
msg_info "Updating ERPNext"
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:$PATH"; cd /opt/frappe-bench && bench update --reset'
msg_ok "Updated ERPNext"
fi
msg_ok "Updated successfully!"
exit
}
+1 -8
View File
@@ -83,14 +83,7 @@ msg_info "Setting up Backend"
cd /opt/endurain/backend
UV_VERSION=$(grep -Po 'required-version\s*=\s*"\K[^"]+' pyproject.toml 2>/dev/null || echo "0.11.18")
UV_VERSION="$UV_VERSION" setup_uv
$STD uv tool install poetry
$STD uv tool update-shell
export PATH="/root/.local/bin:$PATH"
$STD poetry self add poetry-plugin-export
$STD poetry export -f requirements.txt --output requirements.txt --without-hashes
$STD uv venv --clear
$STD uv pip install -r requirements.txt
$STD uv pip install pytz
$STD uv sync --frozen --no-dev
msg_ok "Setup Backend"
msg_info "Creating Service"
+5 -3
View File
@@ -31,11 +31,12 @@ $STD apt install -y \
libjpeg-dev \
libmariadb-dev \
python3-pip \
pkg-config \
cron
msg_ok "Installed Dependencies"
NODE_VERSION="24" NODE_MODULE="yarn" setup_nodejs
UV_PYTHON="3.13" setup_uv
UV_PYTHON="3.14" setup_uv
setup_mariadb
msg_info "Configuring MariaDB for ERPNext"
@@ -68,8 +69,9 @@ msg_info "Initializing Frappe Bench"
ADMIN_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
DB_ROOT_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '${DB_ROOT_PASS}'; FLUSH PRIVILEGES;"
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:$PATH"; cd /opt && bench init --frappe-branch version-15 frappe-bench'
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:$PATH"; cd /opt/frappe-bench && bench get-app erpnext --branch version-15'
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:$PATH"; uv python install 3.14'
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:$PATH"; cd /opt && bench init --frappe-branch version-16 --python "$(uv python find 3.14)" frappe-bench'
$STD sudo -u frappe bash -c 'export PATH="$HOME/.local/bin:$PATH"; cd /opt/frappe-bench && bench get-app erpnext --branch version-16'
msg_info "Starting Redis Services for Site Setup"
$STD sudo -u frappe bash -c 'redis-server /opt/frappe-bench/config/redis_queue.conf --daemonize yes'