From c2838b69ce53b7c12a1e11b9d37d4f9f913a912b Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Mon, 23 Mar 2026 20:43:17 +0100 Subject: [PATCH] Refactor: PartDB (#13229) --- ct/part-db.sh | 23 +++++++---------------- install/part-db-install.sh | 14 ++------------ 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/ct/part-db.sh b/ct/part-db.sh index fe17d51a1..c58e73040 100644 --- a/ct/part-db.sh +++ b/ct/part-db.sh @@ -27,36 +27,27 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - - RELEASE=$(get_latest_github_release "Part-DB/Part-DB-server") + if check_for_gh_release "partdb" "Part-DB/Part-DB-server"; then msg_info "Stopping Service" systemctl stop apache2 msg_ok "Stopped Service" - msg_info "Updating $APP to v${RELEASE}" - cd /opt mv /opt/partdb/ /opt/partdb-backup - curl -fsSL "https://github.com/Part-DB/Part-DB-server/archive/refs/tags/v${RELEASE}.zip" -o "/opt/v${RELEASE}.zip" - $STD unzip "v${RELEASE}.zip" - mv /opt/Part-DB-server-${RELEASE}/ /opt/partdb + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "partdb" "Part-DB/Part-DB-server" "prebuild" "latest" "/opt/partdb" "partdb_with_assets.zip" + msg_info "Updating Part-DB" cd /opt/partdb/ - cp -r "/opt/partdb-backup/.env.local" /opt/partdb/ - cp -r "/opt/partdb-backup/public/media" /opt/partdb/public/ - cp -r "/opt/partdb-backup/config/banner.md" /opt/partdb/config/ - + cp -r /opt/partdb-backup/.env.local /opt/partdb/ + cp -r /opt/partdb-backup/public/media /opt/partdb/public/ + cp -r /opt/partdb-backup/config/banner.md /opt/partdb/config/ export COMPOSER_ALLOW_SUPERUSER=1 $STD composer install --no-dev -o --no-interaction - $STD yarn install - $STD yarn build $STD php bin/console cache:clear $STD php bin/console doctrine:migrations:migrate -n chown -R www-data:www-data /opt/partdb - rm -r "/opt/v${RELEASE}.zip" rm -r /opt/partdb-backup - echo "${RELEASE}" >~/.partdb - msg_ok "Updated $APP to v${RELEASE}" + msg_ok "Updated Part-DB" msg_info "Starting Service" systemctl start apache2 diff --git a/install/part-db-install.sh b/install/part-db-install.sh index 23d8ae678..110ed3acf 100644 --- a/install/part-db-install.sh +++ b/install/part-db-install.sh @@ -13,27 +13,19 @@ setting_up_container network_check update_os -NODE_VERSION="22" NODE_MODULE="yarn@latest" setup_nodejs PG_VERSION="16" setup_postgresql PG_DB_NAME="partdb" PG_DB_USER="partdb" setup_postgresql_db PHP_VERSION="8.4" PHP_APACHE="YES" PHP_MODULE="xsl" PHP_POST_MAX_SIZE="100M" PHP_UPLOAD_MAX_FILESIZE="100M" setup_php setup_composer -msg_info "Installing Part-DB (Patience)" -cd /opt -RELEASE=$(get_latest_github_release "Part-DB/Part-DB-server") -curl -fsSL "https://github.com/Part-DB/Part-DB-server/archive/refs/tags/v${RELEASE}.zip" -o "/opt/v${RELEASE}.zip" -$STD unzip "v${RELEASE}.zip" -mv /opt/Part-DB-server-${RELEASE}/ /opt/partdb +fetch_and_deploy_gh_release "partdb" "Part-DB/Part-DB-server" "prebuild" "latest" "/opt/partdb" "partdb_with_assets.zip" +msg_info "Installing Part-DB" cd /opt/partdb/ cp .env .env.local sed -i "s|DATABASE_URL=\"sqlite:///%kernel.project_dir%/var/app.db\"|DATABASE_URL=\"postgresql://${PG_DB_USER}:${PG_DB_PASS}@127.0.0.1:5432/${PG_DB_NAME}?serverVersion=12.19&charset=utf8\"|" .env.local - export COMPOSER_ALLOW_SUPERUSER=1 $STD composer install --no-dev -o --no-interaction -$STD yarn install -$STD yarn build $STD php bin/console cache:clear php bin/console doctrine:migrations:migrate -n >~/database-migration-output chown -R www-data:www-data /opt/partdb @@ -44,8 +36,6 @@ ADMIN_PASS=$(grep -oP 'The initial password for the "admin" user is: \K\w+' ~/da echo "Part-DB Admin Password: $ADMIN_PASS" } >>~/partdb.creds rm -rf ~/database-migration-output -rm -rf "/opt/v${RELEASE}.zip" -echo "${RELEASE}" >~/.partdb msg_ok "Installed Part-DB" msg_info "Creating Service"