Compare commits

..

1 Commits

Author SHA1 Message Date
MickLesk c4bcc1a053 Bichon: Migration for V2 Release 2026-07-29 07:41:09 +02:00
8 changed files with 51 additions and 160 deletions
-14
View File
@@ -510,20 +510,6 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
## 2026-07-29 ## 2026-07-29
### 🚀 Updated Scripts
- backup virtual printer in bambuddy [@asylumexp](https://github.com/asylumexp) ([#16142](https://github.com/community-scripts/ProxmoxVE/pull/16142))
- #### 🐞 Bug Fixes
- ImmichFrame: check .NET SDK before update deployment [@aidaskni](https://github.com/aidaskni) ([#16104](https://github.com/community-scripts/ProxmoxVE/pull/16104))
### 💾 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 ## 2026-07-28
### 🚀 Updated Scripts ### 🚀 Updated Scripts
+1 -2
View File
@@ -42,8 +42,7 @@ function update_script() {
/opt/bambuddy/data \ /opt/bambuddy/data \
/opt/bambuddy/bambuddy.db \ /opt/bambuddy/bambuddy.db \
/opt/bambuddy/bambutrack.db \ /opt/bambuddy/bambutrack.db \
/opt/bambuddy/archive \ /opt/bambuddy/archive
/opt/bambuddy/virtual_printer
msg_ok "Backed up Configuration and Data" msg_ok "Backed up Configuration and Data"
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "bambuddy" "maziggy/bambuddy" "tarball" "latest" "/opt/bambuddy" CLEAN_INSTALL=1 fetch_and_deploy_gh_release "bambuddy" "maziggy/bambuddy" "tarball" "latest" "/opt/bambuddy"
+33 -47
View File
@@ -34,30 +34,27 @@ function update_script() {
CURRENT_VERSION=$(cat /root/.bichon) CURRENT_VERSION=$(cat /root/.bichon)
fi fi
MIGRATE_V1=0 if [[ $CURRENT_VERSION != 1.* && $CURRENT_VERSION != 2.* ]]; then
if [[ $CURRENT_VERSION == 0.* ]]; then msg_error "Installed ${APP} version (${CURRENT_VERSION}) is too old for an automatic update to v2.x."
MIGRATE_V1=1 msg_error "Please create a new ${APP} container and migrate your data manually."
DISK_USAGE=$(df / | awk 'NR==2 {print $5}' | sed 's/%//') msg_error "Guide: https://github.com/rustmailer/bichon/wiki/Bichon-v2.x-Migration-Guide"
if [ "$DISK_USAGE" -gt 50 ]; then exit
echo -e "\n${RD}Warning: Less than 50% free storage remaining on the root disk.${CL}" fi
echo -e "${RD}Bichon v1 data migration temporarily duplicates data and requires free space for it.${CL}"
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 read -r -p "Are you sure you want to proceed with the update? (y/N): " proceed
if [[ ! $proceed =~ ^[Yy]$ ]]; then if [[ ! $proceed =~ ^[Yy]$ ]]; then
msg_error "Update cancelled by user." msg_error "Update cancelled by user."
exit exit
fi fi
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 fi
if check_for_gh_release "bichon" "rustmailer/bichon"; then if check_for_gh_release "bichon" "rustmailer/bichon"; then
@@ -67,55 +64,44 @@ function update_script() {
create_backup /opt/bichon/bichon.env 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" 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 restore_backup
if [ "$MIGRATE_V1" -eq 1 ]; then if [ "$MIGRATE_V2" -eq 1 ]; then
msg_info "Running Bichon v1 Data Migration (patience)" msg_info "Migrating storage from fjall to bichon-blob (patience)"
$STD apt install -y expect $STD apt install -y expect
# Menu: 0 Reset Password, 1 Migrate v0.3.7, 2 Migrate v1.x, 3 Exit
$STD expect <<'EOF' $STD expect <<'EOF'
set timeout -1 set timeout -1
spawn /opt/bichon/bichon-admin spawn /opt/bichon/bichon-admin
expect "*Select an operation*" expect "*Select an operation*"
send "\033\[B\r" send "\033\[B\033\[B\r"
expect "*--bichon-root-dir*" expect "*--bichon-root-dir*"
send "/opt/bichon-data\r" send "/opt/bichon-data\r"
expect "*--bichon-index-dir*"
send "\r"
expect "*--bichon-data-dir*" expect "*--bichon-data-dir*"
send "\r" send "\r"
expect "*Ready to migrate?*" expect "*batch size*"
send "y"
expect "*Enter batch size*"
send "1000\r" send "1000\r"
expect eof expect eof
catch wait catch wait
EOF EOF
$STD apt remove --purge expect -y $STD apt remove --purge expect -y
$STD apt autoremove -y $STD apt autoremove -y
msg_ok "Migration completed"
msg_info "Cleaning up legacy Bichon v0.x storage files" if [[ ! -d /opt/bichon-data/bichon-storage/blobs ]] ||
rm -rf /opt/bichon-data/envelope [[ "$(cat /opt/bichon-data/STORAGE_VERSION 2>/dev/null)" != "2" ]]; then
rm -rf /opt/bichon-data/eml msg_error "Storage migration did not complete - service left stopped, legacy data untouched."
rm -f /opt/bichon-data/mailbox.db msg_error "Run /opt/bichon/bichon-admin manually and select 'Migrate v1.x Storage to v2.x'."
rm -f /opt/bichon-data/meta.db exit
msg_ok "Cleanup completed" fi
msg_ok "Migrated storage to bichon-blob"
msg_info "Updating Bichon service for v1" msg_info "Removing legacy fjall files"
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 rm -rf /opt/bichon-data/bichon-storage/keyspaces
systemctl daemon-reload rm -f /opt/bichon-data/bichon-storage/0.jnl
msg_ok "Service updated" rm -f /opt/bichon-data/bichon-storage/lock
rm -f /opt/bichon-data/bichon-storage/version
msg_ok "Removed legacy fjall files"
fi fi
msg_info "Starting service" msg_info "Starting service"
-19
View File
@@ -30,25 +30,6 @@ function update_script() {
exit exit
fi fi
if ! dotnet --list-sdks 2>/dev/null | grep -q '^8\.'; then
msg_info "Installing .NET SDK 8.0"
if [[ "$(arch_resolve)" == "arm64" ]]; then
curl -fsSL https://dot.net/v1/dotnet-install.sh -o /tmp/dotnet-install.sh
$STD bash /tmp/dotnet-install.sh --channel 8.0 --install-dir /usr/lib/dotnet8
ln -sf /usr/lib/dotnet8/dotnet /usr/bin/dotnet
rm -f /tmp/dotnet-install.sh
else
setup_deb822_repo \
"microsoft" \
"https://packages.microsoft.com/keys/microsoft-2025.asc" \
"https://packages.microsoft.com/debian/13/prod/" \
"trixie" \
"main"
$STD apt install -y dotnet-sdk-8.0
fi
msg_ok "Installed .NET SDK 8.0"
fi
if check_for_gh_release "immichframe" "immichFrame/ImmichFrame"; then if check_for_gh_release "immichframe" "immichFrame/ImmichFrame"; then
msg_info "Stopping Service" msg_info "Stopping Service"
systemctl stop immichframe systemctl stop immichframe
+1 -1
View File
@@ -60,7 +60,7 @@ LimitNOFILE=65536
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
systemctl enable -q --now bichon systemctl enable -q --now bichon
msg_info "Created Service" msg_ok "Created Service"
motd_ssh motd_ssh
customize customize
+2 -23
View File
@@ -10,29 +10,8 @@ fi
# must write local failure artifacts instead of talking to the telemetry API # must write local failure artifacts instead of talking to the telemetry API
# (the host is the single telemetry reporter). # (the host is the single telemetry reporter).
export TELEMETRY_CONTEXT="container" export TELEMETRY_CONTEXT="container"
# A freshly booted container may not have DNS up yet. `source <(curl ...)` hides source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
# curl's exit code, so a failed download would silently source an empty stream. source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
_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 load_functions
catch_errors catch_errors
+12 -31
View File
@@ -88,38 +88,19 @@ variables() {
fi fi
} }
# `source <(curl ...)` hides the download exit code, so a failed fetch would source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func)
# 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
}
_bootstrap_source() { if command -v curl >/dev/null 2>&1; then
local url="$1" probe="$2" content="" source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
if command -v curl >/dev/null 2>&1; then source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
content=$(curl -fsSL --connect-timeout 10 --retry 5 --retry-connrefused --retry-delay 2 "$url") || content="" load_functions
elif command -v wget >/dev/null 2>&1; then catch_errors
content=$(wget -qO- --tries=5 --timeout=10 "$url") || content="" elif command -v wget >/dev/null 2>&1; then
else source <(wget -qO- https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
_bootstrap_die "Neither curl nor wget available" source <(wget -qO- https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
fi load_functions
[[ -n "$content" ]] || _bootstrap_die "Failed to download ${url##*/}" catch_errors
source /dev/stdin <<<"$content" fi
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 # SECTION 2: PRE-FLIGHT CHECKS & SYSTEM VALIDATION
+2 -23
View File
@@ -37,29 +37,8 @@ fi
# (the host is the single telemetry reporter). # (the host is the single telemetry reporter).
export TELEMETRY_CONTEXT="container" export TELEMETRY_CONTEXT="container"
# A freshly booted container may not have DNS up yet. `source <(curl ...)` hides source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
# curl's exit code, so a failed download would silently source an empty stream. source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
_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 load_functions
catch_errors catch_errors