Compare commits

...
Author SHA1 Message Date
push-app-to-main[bot] f0d339e7f3 Add 9router (ct) 2026-11-13 07:41:24 +00:00
2 changed files with 129 additions and 0 deletions

No files matched your search

+66
View File
@@ -0,0 +1,66 @@
#!/usr/bin/env bash
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/decolua/9router
APP="9Router"
var_tags="${var_tags:-ai;llm;gateway}"
var_cpu="${var_cpu:-1}"
var_ram="${var_ram:-1024}"
var_disk="${var_disk:-4}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_arm64="${var_arm64:-yes}"
var_unprivileged="${var_unprivileged:-1}"
header_info "$APP"
variables
color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /usr/lib/node_modules/9router ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
CURRENT=$(jq -r '.version' /usr/lib/node_modules/9router/package.json)
RELEASE=$(npm view 9router version)
if [[ "$CURRENT" == "$RELEASE" ]]; then
msg_ok "No update available: 9Router (${CURRENT})"
exit
fi
NODE_VERSION="22" setup_nodejs
msg_info "Stopping 9Router"
systemctl stop 9router
msg_ok "Stopped 9Router"
msg_info "Updating 9Router to ${RELEASE}"
$STD npm install -g --ignore-scripts "9router@${RELEASE}"
msg_ok "Updated 9Router to ${RELEASE}"
msg_info "Starting 9Router"
systemctl start 9router
msg_ok "Started 9Router"
msg_ok "Updated successfully!"
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 "${GATEWAY}${BGN}http://${IP}:20128/dashboard${CL}"
echo -e "${INFO}${YW}Dashboard password: INITIAL_PASSWORD in /opt/9router_data/.env (inside the container)${CL}"
+63
View File
@@ -0,0 +1,63 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: MickLesk (CanbiZ)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Source: https://github.com/decolua/9router
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
NODE_VERSION="22" setup_nodejs
setup_ffmpeg
msg_info "Installing 9Router"
$STD npm install -g --ignore-scripts "9router@${var_appversion:-latest}"
msg_ok "Installed 9Router"
msg_info "Configuring 9Router"
mkdir -p /opt/9router_data
cat <<EOF >/opt/9router_data/.env
DATA_DIR=/opt/9router_data
PORT=20128
HOSTNAME=0.0.0.0
NODE_ENV=production
NEXT_TELEMETRY_DISABLED=1
BASE_URL=http://localhost:20128
INITIAL_PASSWORD=$(random_password)
JWT_SECRET=$(openssl rand -hex 32)
API_KEY_SECRET=$(openssl rand -hex 32)
MACHINE_ID_SALT=$(openssl rand -hex 16)
EOF
chmod 600 /opt/9router_data/.env
msg_ok "Configured 9Router"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/9router.service
[Unit]
Description=9Router
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
WorkingDirectory=/usr/lib/node_modules/9router/app
EnvironmentFile=/opt/9router_data/.env
ExecStart=/usr/bin/node /usr/lib/node_modules/9router/app/custom-server.js
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now 9router
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc