Files
ProxmoxVE/install/managemydamnlife-install.sh
T
CanbiZ (MickLesk) 50e5c6982b Use setup_postgresql_db / setup_mariadb_db instead of hand-written SQL (#17622)
Also append instead of overwrite the second creds block in onlyoffice, planka and pterodactyl-panel, which dropped the database credentials.
2026-10-01 08:12:33 +02:00

66 lines
1.6 KiB
Bash

#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: vhsdream
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/intri-in/manage-my-damn-life-nextjs
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
msg_ok "Installed dependencies"
NODE_VERSION="22" setup_nodejs
setup_mariadb
MARIADB_DB_NAME="mmdl" MARIADB_DB_USER="mmdl" MARIADB_DB_CREDS_FILE="$HOME/mmdl.creds" setup_mariadb_db
fetch_and_deploy_gh_release "mmdl" "intri-in/manage-my-damn-life-nextjs" "tarball"
msg_info "Configuring ${APPLICATION}"
cp /opt/mmdl/sample.env.local /opt/mmdl/.env
sed -i -e 's|db|localhost|' \
-e "s|myuser|mmdl|" \
-e "s|mypassword|${MARIADB_DB_PASS}|" \
-e 's|5433|3306|' \
-e 's|DB_DIALECT=postgres|DB_DIALECT=mysql|' \
-e "s|sample_install_mmdm|mmdl|" \
-e "s|=PASSWORD|=$(openssl rand -base64 40 | tr -dc 'a-zA-Z0-9' | head -c40)|" \
/opt/mmdl/.env
cd /opt/mmdl
export NEXT_TELEMETRY_DISABLED=1
export CI="true"
$STD npm install
$STD npm run migrate
$STD npm run build
msg_ok "Configured ${APPLICATION}"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/mmdl.service
[Unit]
Description=${APPLICATION} Service
After=network.target mariadb.service
[Service]
WorkingDirectory=/opt/mmdl
EnvironmentFile=/opt/mmdl/.env
ExecStart=/usr/bin/npm run start
Restart=on-abnormal
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now mmdl
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc