Skip to content

Commit 3382ec2

Browse files
Add spliit (ct) (#14966)
Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com>
1 parent 2c0ec7c commit 3382ec2

3 files changed

Lines changed: 151 additions & 0 deletions

File tree

ct/headers/spliit

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
_____ ___ _ __
2+
/ ___/____ / (_|_) /_
3+
\__ \/ __ \/ / / / __/
4+
___/ / /_/ / / / / /_
5+
/____/ .___/_/_/_/\__/
6+
/_/

ct/spliit.sh

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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}"

install/spliit-install.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env bash
2+
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+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
PG_VERSION="16" setup_postgresql
17+
PG_DB_NAME="spliit" PG_DB_USER="spliit" setup_postgresql_db
18+
NODE_VERSION="22" setup_nodejs
19+
fetch_and_deploy_gh_release "spliit" "spliit-app/spliit" "tarball"
20+
21+
msg_info "Configuring Application"
22+
cat <<EOF >/opt/spliit/.env
23+
POSTGRES_PRISMA_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}?schema=public
24+
POSTGRES_URL_NON_POOLING=postgresql://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}?schema=public
25+
NEXT_PUBLIC_DEFAULT_CURRENCY_CODE=
26+
NEXT_TELEMETRY_DISABLED=1
27+
NODE_ENV=production
28+
PORT=3000
29+
HOSTNAME=0.0.0.0
30+
EOF
31+
msg_ok "Configured Application"
32+
33+
msg_info "Building Application"
34+
cd /opt/spliit
35+
$STD npm ci --ignore-scripts
36+
$STD npx prisma generate
37+
$STD npm run build
38+
msg_ok "Built Application"
39+
40+
msg_info "Running Database Migrations"
41+
cd /opt/spliit
42+
$STD npx prisma migrate deploy
43+
msg_ok "Ran Database Migrations"
44+
45+
msg_info "Creating Service"
46+
cat <<EOF >/etc/systemd/system/spliit.service
47+
[Unit]
48+
Description=Spliit
49+
After=network.target postgresql.service
50+
Requires=postgresql.service
51+
52+
[Service]
53+
Type=simple
54+
User=root
55+
WorkingDirectory=/opt/spliit
56+
EnvironmentFile=/opt/spliit/.env
57+
ExecStart=/usr/bin/npm run start
58+
Restart=on-failure
59+
RestartSec=5
60+
61+
[Install]
62+
WantedBy=multi-user.target
63+
EOF
64+
systemctl enable -q --now spliit
65+
msg_ok "Created Service"
66+
67+
motd_ssh
68+
customize
69+
cleanup_lxc

0 commit comments

Comments
 (0)