Refactor (#6829)
This commit is contained in:
parent
c12ec76181
commit
ef7c774a24
@ -32,36 +32,32 @@ function update_script() {
|
|||||||
$STD npm install -g pnpm@latest
|
$STD npm install -g pnpm@latest
|
||||||
msg_ok "Installed pnpm"
|
msg_ok "Installed pnpm"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/diced/zipline/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
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}"
|
msg_info "Stopping ${APP}"
|
||||||
systemctl stop zipline
|
systemctl stop zipline
|
||||||
msg_ok "${APP} Stopped"
|
msg_ok "${APP} Stopped"
|
||||||
|
|
||||||
msg_info "Updating ${APP} to ${RELEASE}"
|
|
||||||
cp /opt/zipline/.env /opt/
|
|
||||||
mkdir -p /opt/zipline-uploads
|
mkdir -p /opt/zipline-uploads
|
||||||
if [ -d /opt/zipline/uploads ] && [ "$(ls -A /opt/zipline/uploads)" ]; then
|
if [ -d /opt/zipline/uploads ] && [ "$(ls -A /opt/zipline/uploads)" ]; then
|
||||||
cp -R /opt/zipline/uploads/* /opt/zipline-uploads/
|
cp -R /opt/zipline/uploads/* /opt/zipline-uploads/
|
||||||
fi
|
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")
|
cp /opt/zipline/.env /opt/
|
||||||
$STD unzip v"${RELEASE}".zip
|
|
||||||
rm -R /opt/zipline
|
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
|
cd /opt/zipline
|
||||||
mv /opt/.env /opt/zipline/.env
|
mv /opt/.env /opt/zipline/.env
|
||||||
$STD pnpm install
|
$STD pnpm install
|
||||||
$STD pnpm build
|
$STD pnpm build
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
|
||||||
msg_ok "Updated ${APP}"
|
msg_ok "Updated ${APP}"
|
||||||
|
|
||||||
msg_info "Starting ${APP}"
|
msg_info "Starting ${APP}"
|
||||||
systemctl start zipline
|
systemctl start zipline
|
||||||
msg_ok "Started ${APP}"
|
msg_ok "Started ${APP}"
|
||||||
|
|
||||||
msg_info "Cleaning Up"
|
|
||||||
rm -rf v"${RELEASE}".zip
|
|
||||||
msg_ok "Cleaned"
|
|
||||||
msg_ok "Updated Successfully"
|
msg_ok "Updated Successfully"
|
||||||
else
|
else
|
||||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"updateable": true,
|
"updateable": true,
|
||||||
"privileged": false,
|
"privileged": false,
|
||||||
"interface_port": 3000,
|
"interface_port": 3000,
|
||||||
"documentation": null,
|
"documentation": "https://zipline.diced.sh/docs/get-started",
|
||||||
"website": "https://zipline.diced.sh/",
|
"website": "https://zipline.diced.sh/",
|
||||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/zipline.webp",
|
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/zipline.webp",
|
||||||
"config_path": "/opt/zipline/.env",
|
"config_path": "/opt/zipline/.env",
|
||||||
|
@ -16,6 +16,7 @@ update_os
|
|||||||
|
|
||||||
NODE_VERSION="22" NODE_MODULE="pnpm@latest" setup_nodejs
|
NODE_VERSION="22" NODE_MODULE="pnpm@latest" setup_nodejs
|
||||||
PG_VERSION="16" setup_postgresql
|
PG_VERSION="16" setup_postgresql
|
||||||
|
fetch_and_deploy_gh_release "zipline" "diced/zipline" "tarball"
|
||||||
|
|
||||||
msg_info "Setting up PostgreSQL"
|
msg_info "Setting up PostgreSQL"
|
||||||
DB_NAME=ziplinedb
|
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_ok "Set up PostgreSQL"
|
||||||
|
|
||||||
msg_info "Installing Zipline (Patience)"
|
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
|
cd /opt/zipline
|
||||||
cat <<EOF >/opt/zipline/.env
|
cat <<EOF >/opt/zipline/.env
|
||||||
DATABASE_URL=postgres://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME
|
DATABASE_URL=postgres://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME
|
||||||
@ -55,7 +51,6 @@ EOF
|
|||||||
mkdir -p /opt/zipline-uploads
|
mkdir -p /opt/zipline-uploads
|
||||||
$STD pnpm install
|
$STD pnpm install
|
||||||
$STD pnpm build
|
$STD pnpm build
|
||||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
|
||||||
msg_ok "Installed Zipline"
|
msg_ok "Installed Zipline"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
@ -77,8 +72,8 @@ msg_ok "Created Service"
|
|||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
rm -f /opt/v${RELEASE}.zip
|
|
||||||
$STD apt-get -y autoremove
|
$STD apt-get -y autoremove
|
||||||
$STD apt-get -y autoclean
|
$STD apt-get -y autoclean
|
||||||
msg_ok "Cleaned"
|
msg_ok "Cleaned"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user