Compare commits

..

7 Commits

Author SHA1 Message Date
CanbiZ (MickLesk) c9e3eb898b Update omniroute.sh 2026-07-30 09:55:10 +02:00
push-app-to-main[bot] f4a3ed1ec8 Add omniroute (ct) 2026-07-30 07:52:01 +00:00
community-scripts-pr-app[bot] 09c11fdecf Update CHANGELOG.md (#16152)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-07-29 21:02:10 +00:00
community-scripts-pr-app[bot] e562ab6128 Update CHANGELOG.md (#16151)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-07-29 15:58:45 +00:00
CanbiZ (MickLesk) b5a9011581 Bichon: Migration for V2 Release (#16145) 2026-07-29 17:58:04 +02:00
community-scripts-pr-app[bot] 450a5948ec Update CHANGELOG.md (#16150)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-07-29 12:11:34 +00:00
CanbiZ (MickLesk) 6ff1e95334 core: Harden remote func bootstrapping with dns issues (#16146)
* Harden remote func bootstrapping

Replace bare `source <(curl ...)` calls with a `_bootstrap_source` helper that validates both the download exit code and the presence of a probe function after sourcing. This prevents silent failures when DNS is not yet available in a freshly booted container or when a download fails mid-stream. Applies to build.func, install.func, and alpine-install.func. Also adds retry flags and a connect timeout to curl/wget.

* Refactor bootstrap error handling with helper

Extract repeated fatal-error logic into a `_bootstrap_die` helper across alpine-install.func, build.func, and install.func. The helper uses `msg_error` when available, falling back to stderr, then exits with code 115. Inline error blocks are replaced with cleaner one-liner `|| _bootstrap_die` calls.
2026-07-29 14:11:08 +02:00
10 changed files with 256 additions and 72 deletions
+11 -2
View File
@@ -512,12 +512,21 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
### 🚀 Updated Scripts
- backup virtual printer in bambuddy [@asylumexp](https://github.com/asylumexp) ([#16142](https://github.com/community-scripts/ProxmoxVE/pull/16142))
- #### 🐞 Bug Fixes
- backup virtual printer in bambuddy [@asylumexp](https://github.com/asylumexp) ([#16142](https://github.com/community-scripts/ProxmoxVE/pull/16142))
- ImmichFrame: check .NET SDK before update deployment [@aidaskni](https://github.com/aidaskni) ([#16104](https://github.com/community-scripts/ProxmoxVE/pull/16104))
- #### ✨ New Features
- Bichon: Migration for V2 Release [@MickLesk](https://github.com/MickLesk) ([#16145](https://github.com/community-scripts/ProxmoxVE/pull/16145))
### 💾 Core
- #### ✨ New Features
- core: Harden remote func bootstrapping with dns issues [@MickLesk](https://github.com/MickLesk) ([#16146](https://github.com/community-scripts/ProxmoxVE/pull/16146))
## 2026-07-28
### 🚀 Updated Scripts
+33 -47
View File
@@ -34,30 +34,27 @@ function update_script() {
CURRENT_VERSION=$(cat /root/.bichon)
fi
MIGRATE_V1=0
if [[ $CURRENT_VERSION == 0.* ]]; then
MIGRATE_V1=1
DISK_USAGE=$(df / | awk 'NR==2 {print $5}' | sed 's/%//')
if [ "$DISK_USAGE" -gt 50 ]; then
echo -e "\n${RD}Warning: Less than 50% free storage remaining on the root disk.${CL}"
echo -e "${RD}Bichon v1 data migration temporarily duplicates data and requires free space for it.${CL}"
if [[ $CURRENT_VERSION != 1.* && $CURRENT_VERSION != 2.* ]]; then
msg_error "Installed ${APP} version (${CURRENT_VERSION}) is too old for an automatic update to v2.x."
msg_error "Please create a new ${APP} container and migrate your data manually."
msg_error "Guide: https://github.com/rustmailer/bichon/wiki/Bichon-v2.x-Migration-Guide"
exit
fi
MIGRATE_V2=0
if [[ $CURRENT_VERSION == 1.* ]]; then
MIGRATE_V2=1
STORAGE_KB=$(du -sk /opt/bichon-data/bichon-storage 2>/dev/null | awk '{print $1}')
FREE_KB=$(df -Pk /opt/bichon-data | awk 'NR==2 {print $4}')
if [[ -n "$STORAGE_KB" && -n "$FREE_KB" && "$FREE_KB" -lt "$STORAGE_KB" ]]; then
echo -e "\n${RD}Warning: migration needs about $((STORAGE_KB / 1024))MB, only $((FREE_KB / 1024))MB free.${CL}"
echo -e "${RD}The new bichon-blob store is written alongside the existing fjall data.${CL}"
read -r -p "Are you sure you want to proceed with the update? (y/N): " proceed
if [[ ! $proceed =~ ^[Yy]$ ]]; then
msg_error "Update cancelled by user."
exit
fi
fi
RAM_TOTAL=$(free -m | awk '/^Mem:/{print $2}')
if [ "$RAM_TOTAL" -lt 2000 ]; then
echo -e "\n${RD}Warning: LXC has less than 2GB of RAM allocated (${RAM_TOTAL}MB).${CL}"
echo -e "${RD}Bichon v1 data migration consumes significant memory and may crash if insufficient.${CL}"
read -r -p "Are you sure you want to proceed with the update? (y/N): " proceed_ram
if [[ ! $proceed_ram =~ ^[Yy]$ ]]; then
msg_error "Update cancelled by user."
exit
fi
fi
fi
if check_for_gh_release "bichon" "rustmailer/bichon"; then
@@ -67,55 +64,44 @@ function update_script() {
create_backup /opt/bichon/bichon.env
if [ "$MIGRATE_V1" -eq 1 ] && [ "$CURRENT_VERSION" != "0.3.7" ]; then
msg_info "Updating to intermediate version v0.3.7"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "bichon" "rustmailer/bichon" "prebuild" "v0.3.7" "/opt/bichon" "bichon-*-$(arch_resolve "x86_64" "aarch64")-unknown-linux-gnu.tar.gz"
restore_backup
systemctl start bichon
sleep 30
systemctl stop bichon
msg_ok "Intermediate update completed"
fi
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "bichon" "rustmailer/bichon" "prebuild" "latest" "/opt/bichon" "bichon-*-$(arch_resolve "x86_64" "aarch64")-unknown-linux-gnu.tar.gz"
restore_backup
if [ "$MIGRATE_V1" -eq 1 ]; then
msg_info "Running Bichon v1 Data Migration (patience)"
if [ "$MIGRATE_V2" -eq 1 ]; then
msg_info "Migrating storage from fjall to bichon-blob (patience)"
$STD apt install -y expect
# Menu: 0 Reset Password, 1 Migrate v0.3.7, 2 Migrate v1.x, 3 Exit
$STD expect <<'EOF'
set timeout -1
spawn /opt/bichon/bichon-admin
expect "*Select an operation*"
send "\033\[B\r"
send "\033\[B\033\[B\r"
expect "*--bichon-root-dir*"
send "/opt/bichon-data\r"
expect "*--bichon-index-dir*"
send "\r"
expect "*--bichon-data-dir*"
send "\r"
expect "*Ready to migrate?*"
send "y"
expect "*Enter batch size*"
expect "*batch size*"
send "1000\r"
expect eof
catch wait
EOF
$STD apt remove --purge expect -y
$STD apt autoremove -y
msg_ok "Migration completed"
msg_info "Cleaning up legacy Bichon v0.x storage files"
rm -rf /opt/bichon-data/envelope
rm -rf /opt/bichon-data/eml
rm -f /opt/bichon-data/mailbox.db
rm -f /opt/bichon-data/meta.db
msg_ok "Cleanup completed"
if [[ ! -d /opt/bichon-data/bichon-storage/blobs ]] ||
[[ "$(cat /opt/bichon-data/STORAGE_VERSION 2>/dev/null)" != "2" ]]; then
msg_error "Storage migration did not complete - service left stopped, legacy data untouched."
msg_error "Run /opt/bichon/bichon-admin manually and select 'Migrate v1.x Storage to v2.x'."
exit
fi
msg_ok "Migrated storage to bichon-blob"
msg_info "Updating Bichon service for v1"
sed -i 's|ExecStart=/opt/bichon/bichon|ExecStart=/opt/bichon/bichon-server|g; s|RestartSec=5|RestartSec=5\n\nLimitNOFILE=65536|g' /etc/systemd/system/bichon.service
systemctl daemon-reload
msg_ok "Service updated"
msg_info "Removing legacy fjall files"
rm -rf /opt/bichon-data/bichon-storage/keyspaces
rm -f /opt/bichon-data/bichon-storage/0.jnl
rm -f /opt/bichon-data/bichon-storage/lock
rm -f /opt/bichon-data/bichon-storage/version
msg_ok "Removed legacy fjall files"
fi
msg_info "Starting service"
+6
View File
@@ -0,0 +1,6 @@
____ _ ____ __
/ __ \____ ___ ____ (_) __ \____ __ __/ /____
/ / / / __ `__ \/ __ \/ / /_/ / __ \/ / / / __/ _ \
/ /_/ / / / / / / / / / / _, _/ /_/ / /_/ / /_/ __/
\____/_/ /_/ /_/_/ /_/_/_/ |_|\____/\__,_/\__/\___/
+69
View File
@@ -0,0 +1,69 @@
#!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/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/diegosouzapw/OmniRoute
APP="OmniRoute"
var_tags="${var_tags:-ai;gateway;llm}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-10}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
var_arm64="${var_arm64:-no}"
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/omniroute ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
msg_info "Checking for Updates"
local LATEST
LATEST=$(npm view omniroute version 2>/dev/null)
if [[ -z "$LATEST" ]]; then
msg_error "Could not determine latest OmniRoute version"
exit
fi
if [[ "$LATEST" == "$(omniroute --version 2>/dev/null)" ]]; then
msg_ok "Already up to date (${LATEST})"
exit
fi
msg_ok "New version available: ${LATEST}"
msg_info "Stopping Service"
systemctl stop omniroute
msg_ok "Stopped Service"
msg_info "Updating OmniRoute to ${LATEST}"
$STD npm install -g omniroute@latest
msg_ok "Updated OmniRoute to ${LATEST}"
msg_info "Starting Service"
systemctl start omniroute
msg_ok "Started Service"
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 "${TAB}${GATEWAY}${BGN}http://${IP}:20128${CL}"
echo -e "${INFO}${YW} The admin password is stored in /opt/omniroute/.env (INITIAL_PASSWORD)${CL}"
+1 -1
View File
@@ -60,7 +60,7 @@ LimitNOFILE=65536
WantedBy=multi-user.target
EOF
systemctl enable -q --now bichon
msg_info "Created Service"
msg_ok "Created Service"
motd_ssh
customize
-6
View File
@@ -71,12 +71,6 @@ msg_ok "Created Service"
msg_info "Starting Service"
systemctl enable -q --now nginx-ui
rm -rf /etc/nginx/sites-enabled/default
sleep 3
cat <<EOF >~/nginx-ui.creds
Nginx UI Install Secret: $(cat /usr/local/etc/nginx-ui/.install_secret 2>/dev/null)
Valid for 10 minutes after service start, then removed.
New secret: systemctl restart nginx-ui && cat /usr/local/etc/nginx-ui/.install_secret
EOF
msg_ok "Started Service"
motd_ssh
+59
View File
@@ -0,0 +1,59 @@
#!/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/diegosouzapw/OmniRoute
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
NODE_VERSION="24" setup_nodejs
msg_info "Installing OmniRoute"
$STD npm install -g omniroute@latest
msg_ok "Installed OmniRoute"
msg_info "Configuring OmniRoute"
mkdir -p /opt/omniroute
cat <<EOF >/opt/omniroute/.env
JWT_SECRET=$(openssl rand -base64 48)
API_KEY_SECRET=$(openssl rand -hex 32)
STORAGE_ENCRYPTION_KEY=$(openssl rand -hex 32)
STORAGE_ENCRYPTION_KEY_VERSION=v1
INITIAL_PASSWORD=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-20)
PORT=20128
OMNIROUTE_SERVER_HOST=0.0.0.0
EOF
chmod 600 /opt/omniroute/.env
msg_ok "Configured OmniRoute"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/omniroute.service
[Unit]
Description=OmniRoute AI Gateway
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=/opt/omniroute
Environment=DATA_DIR=/opt/omniroute
ExecStart=/usr/bin/omniroute
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now omniroute
msg_ok "Created Service"
motd_ssh
customize
cleanup_lxc
+23 -2
View File
@@ -10,8 +10,29 @@ fi
# must write local failure artifacts instead of talking to the telemetry API
# (the host is the single telemetry reporter).
export TELEMETRY_CONTEXT="container"
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
# A freshly booted container may not have DNS up yet. `source <(curl ...)` hides
# curl's exit code, so a failed download would silently source an empty stream.
_bootstrap_die() {
if declare -f msg_error >/dev/null 2>&1; then
msg_error "$1"
else
echo "FATAL: $1" >&2
fi
exit 115
}
_bootstrap_source() {
local url="$1" probe="$2" content
content=$(curl -fsSL --connect-timeout 10 --retry 5 --retry-connrefused --retry-delay 2 "$url") ||
_bootstrap_die "Failed to download ${url##*/}"
source /dev/stdin <<<"$content"
declare -f "$probe" >/dev/null 2>&1 ||
_bootstrap_die "${url##*/} loaded but incomplete (missing ${probe})"
}
_FUNC_BASE="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc"
_bootstrap_source "$_FUNC_BASE/core.func" load_functions
_bootstrap_source "$_FUNC_BASE/error_handler.func" catch_errors
load_functions
catch_errors
+31 -12
View File
@@ -88,19 +88,38 @@ variables() {
fi
}
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func)
# `source <(curl ...)` hides the download exit code, so a failed fetch would
# silently source an empty stream and leave the helpers undefined.
_bootstrap_die() {
if declare -f msg_error >/dev/null 2>&1; then
msg_error "$1"
else
echo "FATAL: $1" >&2
fi
exit 115
}
if command -v curl >/dev/null 2>&1; then
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
load_functions
catch_errors
elif command -v wget >/dev/null 2>&1; then
source <(wget -qO- https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
source <(wget -qO- https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
load_functions
catch_errors
fi
_bootstrap_source() {
local url="$1" probe="$2" content=""
if command -v curl >/dev/null 2>&1; then
content=$(curl -fsSL --connect-timeout 10 --retry 5 --retry-connrefused --retry-delay 2 "$url") || content=""
elif command -v wget >/dev/null 2>&1; then
content=$(wget -qO- --tries=5 --timeout=10 "$url") || content=""
else
_bootstrap_die "Neither curl nor wget available"
fi
[[ -n "$content" ]] || _bootstrap_die "Failed to download ${url##*/}"
source /dev/stdin <<<"$content"
declare -f "$probe" >/dev/null 2>&1 ||
_bootstrap_die "${url##*/} loaded but incomplete (missing ${probe})"
}
_FUNC_BASE="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc"
_bootstrap_source "$_FUNC_BASE/api.func" post_to_api
_bootstrap_source "$_FUNC_BASE/core.func" load_functions
_bootstrap_source "$_FUNC_BASE/error_handler.func" catch_errors
load_functions
catch_errors
# ==============================================================================
# SECTION 2: PRE-FLIGHT CHECKS & SYSTEM VALIDATION
+23 -2
View File
@@ -37,8 +37,29 @@ fi
# (the host is the single telemetry reporter).
export TELEMETRY_CONTEXT="container"
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
# A freshly booted container may not have DNS up yet. `source <(curl ...)` hides
# curl's exit code, so a failed download would silently source an empty stream.
_bootstrap_die() {
if declare -f msg_error >/dev/null 2>&1; then
msg_error "$1"
else
echo "FATAL: $1" >&2
fi
exit 115
}
_bootstrap_source() {
local url="$1" probe="$2" content
content=$(curl -fsSL --connect-timeout 10 --retry 5 --retry-connrefused --retry-delay 2 "$url") ||
_bootstrap_die "Failed to download ${url##*/}"
source /dev/stdin <<<"$content"
declare -f "$probe" >/dev/null 2>&1 ||
_bootstrap_die "${url##*/} loaded but incomplete (missing ${probe})"
}
_FUNC_BASE="https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc"
_bootstrap_source "$_FUNC_BASE/core.func" load_functions
_bootstrap_source "$_FUNC_BASE/error_handler.func" catch_errors
load_functions
catch_errors