From ef7c774a24faf20fdd15d87e6a6c2431d8ba9aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Thu, 14 Aug 2025 21:05:44 +0200 Subject: [PATCH] Refactor (#6829) --- ct/zipline.sh | 16 ++++++---------- frontend/public/json/zipline.json | 2 +- install/zipline-install.sh | 9 ++------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/ct/zipline.sh b/ct/zipline.sh index 113736b838..fa1c564904 100644 --- a/ct/zipline.sh +++ b/ct/zipline.sh @@ -32,36 +32,32 @@ function update_script() { $STD npm install -g pnpm@latest msg_ok "Installed pnpm" fi + RELEASE=$(curl -fsSL https://api.github.com/repos/diced/zipline/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 ~/.zipline ]] || [[ "${RELEASE}" != "$(cat ~/.zipline)" ]]; then msg_info "Stopping ${APP}" systemctl stop zipline msg_ok "${APP} Stopped" - msg_info "Updating ${APP} to ${RELEASE}" - cp /opt/zipline/.env /opt/ mkdir -p /opt/zipline-uploads if [ -d /opt/zipline/uploads ] && [ "$(ls -A /opt/zipline/uploads)" ]; then cp -R /opt/zipline/uploads/* /opt/zipline-uploads/ fi - curl -fsSL "https://github.com/diced/zipline/archive/refs/tags/v${RELEASE}.zip" -o $(basename "https://github.com/diced/zipline/archive/refs/tags/v${RELEASE}.zip") - $STD unzip v"${RELEASE}".zip + cp /opt/zipline/.env /opt/ rm -R /opt/zipline - mv zipline-"${RELEASE}" /opt/zipline + fetch_and_deploy_gh_release "zipline" "diced/zipline" "tarball" + + msg_info "Updating ${APP} to ${RELEASE}" cd /opt/zipline mv /opt/.env /opt/zipline/.env $STD pnpm install $STD pnpm build - echo "${RELEASE}" >/opt/${APP}_version.txt msg_ok "Updated ${APP}" msg_info "Starting ${APP}" systemctl start zipline msg_ok "Started ${APP}" - msg_info "Cleaning Up" - rm -rf v"${RELEASE}".zip - msg_ok "Cleaned" msg_ok "Updated Successfully" else msg_ok "No update required. ${APP} is already at ${RELEASE}" diff --git a/frontend/public/json/zipline.json b/frontend/public/json/zipline.json index 5e5039253f..69ca1c3649 100644 --- a/frontend/public/json/zipline.json +++ b/frontend/public/json/zipline.json @@ -9,7 +9,7 @@ "updateable": true, "privileged": false, "interface_port": 3000, - "documentation": null, + "documentation": "https://zipline.diced.sh/docs/get-started", "website": "https://zipline.diced.sh/", "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/zipline.webp", "config_path": "/opt/zipline/.env", diff --git a/install/zipline-install.sh b/install/zipline-install.sh index bd414f0675..822089bd82 100644 --- a/install/zipline-install.sh +++ b/install/zipline-install.sh @@ -16,6 +16,7 @@ update_os NODE_VERSION="22" NODE_MODULE="pnpm@latest" setup_nodejs PG_VERSION="16" setup_postgresql +fetch_and_deploy_gh_release "zipline" "diced/zipline" "tarball" msg_info "Setting up PostgreSQL" DB_NAME=ziplinedb @@ -37,11 +38,6 @@ $STD sudo -u postgres psql -c "ALTER ROLE $DB_USER SET timezone TO 'UTC'" msg_ok "Set up PostgreSQL" msg_info "Installing Zipline (Patience)" -cd /opt -RELEASE=$(curl -fsSL https://api.github.com/repos/diced/zipline/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') -curl -fsSL "https://github.com/diced/zipline/archive/refs/tags/v${RELEASE}.zip" -o "v${RELEASE}.zip" -$STD unzip v"${RELEASE}".zip -mv zipline-"${RELEASE}" /opt/zipline cd /opt/zipline cat </opt/zipline/.env DATABASE_URL=postgres://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME @@ -55,7 +51,6 @@ EOF mkdir -p /opt/zipline-uploads $STD pnpm install $STD pnpm build -echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" msg_ok "Installed Zipline" msg_info "Creating Service" @@ -77,8 +72,8 @@ msg_ok "Created Service" motd_ssh customize + msg_info "Cleaning up" -rm -f /opt/v${RELEASE}.zip $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned"