mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-10-24 04:05:03 +00:00
Every interactive prompt takes a var_<app>_<name> override and treats a closed stdin like Enter (`|| true`), so an install keeps going after the console that started it is gone. Values the script cannot do without end with exit 64 and name the variable to set. Validation loops stop asking when nobody can answer instead of spinning on an empty read.
78 lines
2.0 KiB
Bash
78 lines
2.0 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Copyright (c) 2021-2026 community-scripts ORG
|
|
# Author: tomfrenzel
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
# Source: https://github.com/thedevs-network/kutt
|
|
|
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
color
|
|
verb_ip6
|
|
catch_errors
|
|
setting_up_container
|
|
network_check
|
|
update_os
|
|
|
|
echo "${TAB3}How would you like to handle SSL termination?"
|
|
echo "${TAB3}[i]-Internal (self-signed SSL Certificate) [e]-External (use your own reverse proxy)"
|
|
ssl_choice="${var_kutt_ssl:-}"
|
|
[[ -n "$ssl_choice" ]] || read -rp "${TAB3}Enter your choice <i/e> (default: i): " ssl_choice || true
|
|
ssl_choice=${ssl_choice:-i}
|
|
case "${ssl_choice,,}" in
|
|
i)
|
|
DEFAULT_HOST="$LOCAL_IP"
|
|
|
|
msg_info "Configuring Caddy"
|
|
$STD apt install -y caddy
|
|
cat <<EOF >/etc/caddy/Caddyfile
|
|
$LOCAL_IP {
|
|
reverse_proxy localhost:3000
|
|
}
|
|
EOF
|
|
systemctl restart caddy
|
|
msg_ok "Configured Caddy"
|
|
;;
|
|
e)
|
|
custom_host="${var_kutt_hostname:-}"
|
|
[[ -n "$custom_host" ]] || read -r -p "${TAB3}Enter the hostname you want to use for Kutt (eg. kutt.example.com): " custom_host || true
|
|
[[ -n "$custom_host" ]] || { msg_error "No hostname given; set var_kutt_hostname or answer the prompt"; exit 64; }
|
|
if [[ "$custom_host" ]]; then
|
|
DEFAULT_HOST="$custom_host"
|
|
fi
|
|
;;
|
|
esac
|
|
|
|
NODE_VERSION="22" setup_nodejs
|
|
fetch_and_deploy_gh_release "kutt" "thedevs-network/kutt" "tarball"
|
|
|
|
msg_info "Configuring Kutt"
|
|
cd /opt/kutt
|
|
cp .example.env ".env"
|
|
sed -i "s|JWT_SECRET=|JWT_SECRET=$(openssl rand -base64 32)|g" ".env"
|
|
sed -i "s|DEFAULT_DOMAIN=.*|DEFAULT_DOMAIN=$DEFAULT_HOST|g" ".env"
|
|
$STD npm install
|
|
$STD npm run migrate
|
|
msg_ok "Configured Kutt"
|
|
|
|
msg_info "Creating Services"
|
|
cat <<EOF >/etc/systemd/system/kutt.service
|
|
[Unit]
|
|
Description=Kutt server
|
|
After=network-online.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
WorkingDirectory=/opt/kutt
|
|
ExecStart=/usr/bin/npm start
|
|
Restart=always
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
systemctl enable -q --now kutt
|
|
msg_ok "Created Services"
|
|
|
|
motd_ssh
|
|
customize
|
|
cleanup_lxc
|