This commit is contained in:
Slaviša Arežina 2025-08-14 21:05:44 +02:00 committed by GitHub
parent c12ec76181
commit ef7c774a24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 18 deletions

View File

@ -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}"

View File

@ -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",

View File

@ -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 <<EOF >/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"