2025-11-01 20:06:45 +01:00
#!/usr/bin/env bash
2026-09-02 13:18:14 +02:00
_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" )
2026-01-06 13:28:12 +01:00
# Copyright (c) 2021-2026 community-scripts ORG
2025-11-01 20:06:45 +01:00
# Author: Slaviša Arežina (tremor021)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
2026-02-24 15:11:53 +01:00
# Source: https://pangolin.net/ | Github: https://github.com/fosrl/pangolin
2025-11-01 20:06:45 +01:00
APP = "Pangolin"
2026-09-18 09:57:47 +02:00
PANGOLIN_VERSION = " ${ PANGOLIN_VERSION :- 1 .23.0 } "
2025-11-01 20:06:45 +01:00
var_tags = " ${ var_tags :- proxy } "
var_cpu = " ${ var_cpu :- 2 } "
var_ram = " ${ var_ram :- 4096 } "
2026-02-28 14:45:59 +01:00
var_disk = " ${ var_disk :- 10 } "
2025-11-01 20:06:45 +01:00
var_os = " ${ var_os :- debian } "
var_version = " ${ var_version :- 13 } "
2026-06-22 04:45:41 +10:00
var_arm64 = " ${ var_arm64 :- yes } "
2025-11-01 20:06:45 +01:00
var_unprivileged = " ${ var_unprivileged :- 1 } "
var_tun = " ${ var_tun :- 1 } "
2026-08-07 04:49:45 +02:00
export var_pangolin_url = " ${ var_pangolin_url :- } "
export var_pangolin_email = " ${ var_pangolin_email :- } "
2025-11-01 20:06:45 +01:00
header_info " $APP "
variables
color
catch_errors
function update_script() {
2025-11-07 14:59:34 +01:00
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/pangolin ]] ; then
msg_error "No ${ APP } Installation Found!"
exit
fi
2025-11-01 20:06:45 +01:00
2026-02-28 10:21:39 +01:00
ensure_dependencies build-essential python3
2026-07-14 22:54:55 +02:00
if ! command -v psql & >/dev/null; then
msg_error "This installation uses SQLite and cannot be upgraded to Pangolin ${ PANGOLIN_VERSION } ."
echo -e " ${ INFO }${ YW } Starting with Pangolin 1.20.0, PostgreSQL is required as the database backend. ${ CL } "
echo -e " ${ INFO }${ YW } An automatic migration of your existing SQLite data is not supported. ${ CL } "
echo -e " ${ INFO }${ YW } Please create a new LXC with the Pangolin install script, which sets up PostgreSQL automatically. ${ CL } "
echo -e " ${ INFO }${ YW } Your current data is preserved in this container and can be manually migrated if needed. ${ CL } "
exit 1
fi
2026-02-24 11:38:15 +01:00
NODE_VERSION = "24" setup_nodejs
2026-05-03 22:30:21 +02:00
if check_for_gh_release "pangolin" "fosrl/pangolin" " $PANGOLIN_VERSION " "Pinned to a tested release because Pangolin's schema changes have repeatedly broken unattended updates. To try a newer version at your own risk, run: 'export PANGOLIN_VERSION=<tag>' and re-run update. If it breaks, please open an issue at https://github.com/community-scripts/ProxmoxVE/issues with the error log." ; then
2025-11-07 14:59:34 +01:00
msg_info "Stopping Service"
systemctl stop pangolin
systemctl stop gerbil
2026-10-03 08:19:10 +02:00
msg_ok "Stopped Service"
2025-11-01 20:06:45 +01:00
2026-07-14 22:54:55 +02:00
DB_URL = $( sed -n 's/.*connection_string: "\(.*\)".*/\1/p' /opt/pangolin/config/config.yml)
create_backup /opt/pangolin/config
2025-11-01 20:06:45 +01:00
2026-05-03 22:30:21 +02:00
CLEAN_INSTALL = 1 fetch_and_deploy_gh_release "pangolin" "fosrl/pangolin" "tarball" " $PANGOLIN_VERSION "
2026-06-22 04:45:41 +10:00
CLEAN_INSTALL = 1 fetch_and_deploy_gh_release "gerbil" "fosrl/gerbil" "singlefile" "latest" "/usr/bin" "gerbil_linux_ $( arch_resolve) "
2025-11-01 20:06:45 +01:00
2025-11-07 14:59:34 +01:00
msg_info "Updating Pangolin"
cd /opt/pangolin
2026-09-04 17:52:31 +02:00
$STD npm ci --allow-remote= all
2026-07-14 22:54:55 +02:00
$STD npm run set:pg
2025-11-07 14:59:34 +01:00
$STD npm run set:oss
rm -rf server/private
2026-07-14 22:54:55 +02:00
DATABASE_URL = " $DB_URL " $STD npm run db:generate
2026-02-06 14:25:44 +01:00
$STD npm run build
2025-11-07 14:59:34 +01:00
$STD npm run build:cli
cp -R .next/standalone ./
2026-07-14 22:54:55 +02:00
cp -r server/migrations ./dist/init
2025-11-07 14:59:34 +01:00
chmod +x ./dist/cli.mjs
cp server/db/names.json ./dist/names.json
2026-01-25 15:01:31 -05:00
cp server/db/ios_models.json ./dist/ios_models.json
cp server/db/mac_models.json ./dist/mac_models.json
2025-11-07 14:59:34 +01:00
msg_ok "Updated Pangolin"
2025-11-01 20:06:45 +01:00
2026-07-14 22:54:55 +02:00
restore_backup
2025-11-02 20:53:05 +01:00
2026-05-03 22:30:21 +02:00
if ! grep -q '^ExecStartPre=/usr/bin/node dist/migrations.mjs' /etc/systemd/system/pangolin.service 2>/dev/null; then
msg_info "Adding migration step to pangolin.service"
sed -i '/^ExecStart=\/usr\/bin\/node --enable-source-maps dist\/server.mjs/i ExecStartPre=/usr/bin/node dist/migrations.mjs' /etc/systemd/system/pangolin.service
systemctl daemon-reload
msg_ok "Updated pangolin.service"
2026-04-20 09:21:54 +02:00
fi
2026-05-03 22:30:21 +02:00
msg_info "Running database migrations"
cd /opt/pangolin
ENVIRONMENT = prod $STD node dist/migrations.mjs
2026-07-14 22:54:55 +02:00
2026-02-21 14:48:22 +01:00
msg_ok "Ran database migrations"
2026-01-19 22:41:01 +01:00
msg_info "Updating Badger plugin version"
BADGER_VERSION = $( get_latest_github_release "fosrl/badger" "false" )
sed -i "s/version: \"v[0-9.]*\"/version: \" $BADGER_VERSION \"/g" /opt/pangolin/config/traefik/traefik_config.yml
msg_ok "Updated Badger plugin version"
2025-11-07 14:59:34 +01:00
msg_info "Starting Services"
systemctl start pangolin
systemctl start gerbil
msg_ok "Started Services"
msg_ok "Updated successfully!"
fi
exit
2025-11-01 20:06:45 +01:00
}
start
build_container
description
2026-01-06 22:57:40 +01:00
msg_ok "Completed successfully!\n"
2025-11-01 20:06:45 +01:00
echo -e " ${ CREATING }${ GN }${ APP } setup has been successfully initialized! ${ CL } "
2026-06-03 11:03:13 +02:00
echo -e " ${ INFO }${ YW } Access it using the following URL: ${ CL } "
2026-07-14 22:54:55 +02:00
echo -e " ${ GATEWAY }${ BGN } https://<YOUR_PANGOLIN_URL> or http:// ${ IP } :3002 ${ CL } "