From b09c0bebac0109074d2803f52ad0f0ca12e72a96 Mon Sep 17 00:00:00 2001 From: tremor021 Date: Sun, 26 Oct 2025 20:35:58 +0100 Subject: [PATCH] Pangolin test --- ct/pangolin.sh | 44 +++++++++++++++++ install/pangolin-install.sh | 97 +++++++++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+) create mode 100644 ct/pangolin.sh create mode 100644 install/pangolin-install.sh diff --git a/ct/pangolin.sh b/ct/pangolin.sh new file mode 100644 index 000000000..b1f5b7193 --- /dev/null +++ b/ct/pangolin.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE +# Source: https://pangolin.net/ + +APP="Pangolin" +var_tags="${var_tags:-proxy}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-4096}" +var_disk="${var_disk:-5}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +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 /opt/pangolin ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_info "Updating $APP LXC" + $STD apt-get update + $STD apt-get -y upgrade + msg_ok "Updated $APP LXC" + 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 "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}" diff --git a/install/pangolin-install.sh b/install/pangolin-install.sh new file mode 100644 index 000000000..850440e78 --- /dev/null +++ b/install/pangolin-install.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: Slaviša Arežina (tremor021) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://pangolin.net/ + +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 \ + sqlite3 \ + iptables +msg_ok "Installed Dependencies" + +NODE_VERSION="22" setup_nodejs +fetch_and_deploy_gh_release "pangolin" "fosrl/pangolin" "tarball" +fetch_and_deploy_gh_release "gerbil" "fosrl/gerbil" "singlefile" "latest" "/usr/bin" "gerbil_linux_amd64" +IP_ADDR=$(hostname -I | awk '{print $1}') + +msg_info "Setup Pangolin (Patience)" +export BUILD=oss +export DATABASE=sqlite +cd /opt/pangolin +$STD npm ci +echo "export * from \"./$DATABASE\";" > server/db/index.ts +echo "export const build = \"$BUILD\" as any;" > server/build.ts +cp tsconfig.oss.json tsconfig.json +mkdir -p dist +$STD npm run next:build +$STD node esbuild.mjs -e server/index.ts -o dist/server.mjs -b $BUILD +$STD node esbuild.mjs -e server/setup/migrationsSqlite.ts -o dist/migrations.mjs +$STD npm run build:cli +cp -R .next/standalone ./ +cp ./cli/wrapper.sh /usr/local/bin/pangctl +chmod +x /usr/local/bin/pangctl ./dist/cli.mjs +cp server/db/names.json ./dist/names.json +$STD npm run db:sqlite:generate +$STD npm run db:sqlite:push +msg_ok "Setup Pangolin" + +msg_info "Creating Pangolin Service" +cat </etc/systemd/system/pangolin.service +[Unit] +Description=Pangolin Service +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/pangolin +ExecStart=/usr/bin/npm start +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now pangolin +msg_ok "Created pangolin Service" + +msg_info "Setting up gerbil" +mkdir -p /var/config +cat </etc/systemd/system/gerbil.service +[Unit] +Description=Gerbil Service +After=network.target +Requires=pangolin.service + +[Service] +Type=simple +User=root +ExecStart=/usr/bin/gerbil --reachableAt=http://$IP_ADDR:3004 --generateAndSaveKeyTo=/var/config/key --remoteConfig=http://$IP_ADDR:3001/api/v1/ +Restart=always +RestartSec=10 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now gerbil +msg_ok "Set up gerbil" + + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt -y autoremove +$STD apt -y autoclean +$STD apt -y clean +msg_ok "Cleaned"