diff --git a/ct/split-pro.sh b/ct/split-pro.sh new file mode 100644 index 000000000..a33ed6ced --- /dev/null +++ b/ct/split-pro.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +# Copyright (c) 2021-2026 community-scripts ORG +# Author: johanngrobe +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/oss-apps/split-pro + +APP="Split Pro" +var_tags="${var_tags:-finance;expense-sharing}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-4096}" +var_disk="${var_disk:-6}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_unprivileged="${var_unprivileged:-1}" + +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d /opt/split-pro ]]; then + msg_error "No Split Pro Installation Found!" + exit + fi + + if check_for_gh_release "split-pro" "oss-apps/split-pro"; then + msg_info "Stopping Service" + systemctl stop split-pro + msg_ok "Stopped Service" + + msg_info "Backing up Data" + cp /opt/split-pro/.env /opt/split-pro.env + msg_ok "Backed up Data" + + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "split-pro" "oss-apps/split-pro" "tarball" "latest" "/opt/split-pro" + + msg_info "Building Application" + cd /opt/split-pro + $STD pnpm install --frozen-lockfile + $STD pnpm build + cp /opt/split-pro.env /opt/split-pro/.env + rm -f /opt/split-pro.env + ln -sf /opt/split-pro_data/uploads /opt/split-pro/uploads + $STD pnpm exec prisma migrate deploy + msg_ok "Built Application" + + msg_info "Starting Service" + systemctl start split-pro + msg_ok "Started Service" + msg_ok "Updated successfully!" + fi + exit +} + +start +build_container +description +msg_ok "Completed successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}" diff --git a/frontend/public/json/split-pro.json b/frontend/public/json/split-pro.json new file mode 100644 index 000000000..34b85b49c --- /dev/null +++ b/frontend/public/json/split-pro.json @@ -0,0 +1,44 @@ +{ + "name": "Split Pro", + "slug": "split-pro", + "categories": [ + 12 + ], + "date_created": "2026-02-12", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 3000, + "documentation": "https://github.com/oss-apps/split-pro/blob/main/docker/README.md", + "website": "https://github.com/oss-apps/split-pro", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/splitpro.webp", + "config_path": "/opt/split-pro/.env", + "description": "SplitPro is a self-hosted, open source way to share expenses with friends. It is designed as a replacement for Splitwise.", + "install_methods": [ + { + "type": "default", + "script": "ct/split-pro.sh", + "resources": { + "cpu": 2, + "ram": 4096, + "hdd": 6, + "os": "debian", + "version": "13" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Before first use you must configure email credentials or authentication (OAuth/OIDC) provider in `/opt/split-pro/.env` and restart the service `systemctl restart split-pro`.", + "type": "warning" + }, + { + "text": "Receipt uploads are stored in `/opt/split-pro_data/uploads`", + "type": "info" + } + ] +} diff --git a/install/split-pro-install.sh b/install/split-pro-install.sh new file mode 100644 index 000000000..7d33df8e2 --- /dev/null +++ b/install/split-pro-install.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: johanngrobe +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/oss-apps/split-pro + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +NODE_VERSION="22" NODE_MODULE="pnpm" setup_nodejs +PG_VERSION="17" setup_postgresql + +msg_info "Installing Dependencies" +$STD apt install -y \ + openssl \ + postgresql-17-cron +msg_ok "Installed Dependencies" + +PG_DB_NAME="splitpro" PG_DB_USER="splitpro" setup_postgresql_db + +msg_info "Setting up pg_cron" +sed -i "/^#shared_preload_libraries/s/^#//" /etc/postgresql/17/main/postgresql.conf +sed -i "/^shared_preload_libraries/s/''/pg_cron/" /etc/postgresql/17/main/postgresql.conf +systemctl restart postgresql +$STD sudo -u postgres psql -c "ALTER SYSTEM SET cron.database_name = 'splitpro'" +$STD sudo -u postgres psql -c "ALTER SYSTEM SET cron.timezone = 'UTC'" +systemctl restart postgresql +$STD sudo -u postgres psql -d splitpro -c "CREATE EXTENSION IF NOT EXISTS pg_cron" +$STD sudo -u postgres psql -d splitpro -c "GRANT USAGE ON SCHEMA cron TO splitpro" +$STD sudo -u postgres psql -d splitpro -c "GRANT ALL ON ALL TABLES IN SCHEMA cron TO splitpro" +msg_ok "Setup pg_cron complete" + +fetch_and_deploy_gh_release "split-pro" "oss-apps/split-pro" "tarball" "latest" "/opt/split-pro" + +msg_info "Installing Dependencies" +cd /opt/split-pro +$STD pnpm install --frozen-lockfile +msg_ok "Installed Dependencies" + +msg_info "Building Split Pro" +cd /opt/split-pro +mkdir -p /opt/split-pro_data/uploads +ln -sf /opt/split-pro_data/uploads /opt/split-pro/uploads +NEXTAUTH_SECRET=$(openssl rand -base64 32) +cp .env.example .env +sed -i "s|^DATABASE_URL=.*|DATABASE_URL=\"postgresql://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}\"|" .env +sed -i "s|^NEXTAUTH_SECRET=.*|NEXTAUTH_SECRET=\"${NEXTAUTH_SECRET}\"|" .env +sed -i "s|^NEXTAUTH_URL=.*|NEXTAUTH_URL=\"http://${LOCAL_IP}:3000\"|" .env +sed -i "s|^NEXTAUTH_URL_INTERNAL=.*|NEXTAUTH_URL_INTERNAL=\"http://localhost:3000\"|" .env +sed -i "/^POSTGRES_CONTAINER_NAME=/d" .env +sed -i "/^POSTGRES_USER=/d" .env +sed -i "/^POSTGRES_PASSWORD=/d" .env +sed -i "/^POSTGRES_DB=/d" .env +sed -i "/^POSTGRES_PORT=/d" .env +$STD pnpm build +$STD pnpm exec prisma migrate deploy +msg_ok "Built Split Pro" + +msg_info "Creating Service" +cat </etc/systemd/system/split-pro.service +[Unit] +Description=Split Pro +After=network.target postgresql.service +Requires=postgresql.service + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/split-pro +EnvironmentFile=/opt/split-pro/.env +ExecStart=/usr/bin/pnpm start +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now split-pro +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc