|
| 1 | +#!/usr/bin/env bash |
| 2 | +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) |
| 3 | +# Copyright (c) 2021-2026 community-scripts ORG |
| 4 | +# Author: phof |
| 5 | +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE |
| 6 | +# Source: https://github.com/spliit-app/spliit |
| 7 | + |
| 8 | +APP="Spliit" |
| 9 | +var_tags="${var_tags:-finance;expense-sharing}" |
| 10 | +var_cpu="${var_cpu:-2}" |
| 11 | +var_ram="${var_ram:-2048}" |
| 12 | +var_disk="${var_disk:-8}" |
| 13 | +var_os="${var_os:-debian}" |
| 14 | +var_version="${var_version:-13}" |
| 15 | +var_arm64="${var_arm64:-no}" |
| 16 | +var_unprivileged="${var_unprivileged:-1}" |
| 17 | + |
| 18 | +header_info "$APP" |
| 19 | +variables |
| 20 | +color |
| 21 | +catch_errors |
| 22 | + |
| 23 | +function update_script() { |
| 24 | + header_info |
| 25 | + check_container_storage |
| 26 | + check_container_resources |
| 27 | + |
| 28 | + if [[ ! -d /opt/spliit ]]; then |
| 29 | + msg_error "No ${APP} Installation Found!" |
| 30 | + exit |
| 31 | + fi |
| 32 | + |
| 33 | + if check_for_gh_release "spliit" "spliit-app/spliit"; then |
| 34 | + msg_info "Stopping Service" |
| 35 | + systemctl stop spliit |
| 36 | + msg_ok "Stopped Service" |
| 37 | + |
| 38 | + msg_info "Backing up Configuration" |
| 39 | + rm -f /opt/spliit.env.bak |
| 40 | + cp /opt/spliit/.env /opt/spliit.env.bak |
| 41 | + msg_ok "Backed up Configuration" |
| 42 | + |
| 43 | + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "spliit" "spliit-app/spliit" "tarball" |
| 44 | + |
| 45 | + msg_info "Restoring Configuration" |
| 46 | + cp /opt/spliit.env.bak /opt/spliit/.env |
| 47 | + msg_ok "Restored Configuration" |
| 48 | + |
| 49 | + msg_info "Building Application" |
| 50 | + cd /opt/spliit |
| 51 | + $STD npm ci --ignore-scripts |
| 52 | + $STD npx prisma generate |
| 53 | + $STD npm run build |
| 54 | + msg_ok "Built Application" |
| 55 | + |
| 56 | + msg_info "Running Database Migrations" |
| 57 | + cd /opt/spliit |
| 58 | + $STD npx prisma migrate deploy |
| 59 | + msg_ok "Ran Database Migrations" |
| 60 | + |
| 61 | + msg_info "Starting Service" |
| 62 | + systemctl start spliit |
| 63 | + msg_ok "Started Service" |
| 64 | + msg_ok "Updated successfully!" |
| 65 | + fi |
| 66 | + exit |
| 67 | +} |
| 68 | + |
| 69 | +start |
| 70 | +build_container |
| 71 | +description |
| 72 | + |
| 73 | +msg_ok "Completed Successfully!\n" |
| 74 | +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" |
| 75 | +echo -e "${INFO}${YW} Access it using the following URL:${CL}" |
| 76 | +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}" |
0 commit comments