Add Spliit script
Disclaimer: drafted with Claude Opus 4.7
This commit is contained in:
71
install/spliit-install.sh
Executable file
71
install/spliit-install.sh
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: a (cynicalchicken)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||
# Source: https://github.com/spliit-app/spliit
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y \
|
||||
build-essential \
|
||||
git
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
PG_VERSION="16" setup_postgresql
|
||||
PG_DB_NAME="spliit" PG_DB_USER="spliit" setup_postgresql_db
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
|
||||
fetch_and_deploy_gh_release "spliit" "spliit-app/spliit" "tarball"
|
||||
|
||||
msg_info "Configuring Application"
|
||||
cat <<EOF >/opt/spliit/.env
|
||||
POSTGRES_PRISMA_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}?schema=public
|
||||
POSTGRES_URL_NON_POOLING=postgresql://${PG_DB_USER}:${PG_DB_PASS}@localhost:5432/${PG_DB_NAME}?schema=public
|
||||
NEXT_PUBLIC_DEFAULT_CURRENCY_CODE=
|
||||
NEXT_TELEMETRY_DISABLED=1
|
||||
NODE_ENV=production
|
||||
PORT=3000
|
||||
HOSTNAME=0.0.0.0
|
||||
EOF
|
||||
msg_ok "Configured Application"
|
||||
|
||||
msg_info "Building Application"
|
||||
cd /opt/spliit
|
||||
set -a && source /opt/spliit/.env && set +a
|
||||
$STD npm install
|
||||
$STD npm run build
|
||||
msg_ok "Built Application"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/spliit.service
|
||||
[Unit]
|
||||
Description=Spliit
|
||||
After=network.target postgresql.service
|
||||
Requires=postgresql.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/spliit
|
||||
EnvironmentFile=/opt/spliit/.env
|
||||
ExecStart=/usr/bin/npm run start
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now spliit
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
Reference in New Issue
Block a user