mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-07-20 23:46:12 +02:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30f855f852 |
@@ -511,26 +511,8 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
|
||||
|
||||
- #### 🐞 Bug Fixes
|
||||
|
||||
- RomM: use backup helpers in update / clear folder [@MickLesk](https://github.com/MickLesk) ([#15915](https://github.com/community-scripts/ProxmoxVE/pull/15915))
|
||||
- Zammad : bind Elasticsearch to 127.0.0.1 [@MickLesk](https://github.com/MickLesk) ([#15909](https://github.com/community-scripts/ProxmoxVE/pull/15909))
|
||||
- Omada: fix package version extraction [@MickLesk](https://github.com/MickLesk) ([#15908](https://github.com/community-scripts/ProxmoxVE/pull/15908))
|
||||
- fix(wanderer): use PocketBase-relative plugin symlink in unprivileged LXC [@michelroegl-brunner](https://github.com/michelroegl-brunner) ([#15911](https://github.com/community-scripts/ProxmoxVE/pull/15911))
|
||||
|
||||
- #### 💥 Breaking Changes
|
||||
|
||||
- Gotify: Migration to v3 [@MickLesk](https://github.com/MickLesk) ([#15912](https://github.com/community-scripts/ProxmoxVE/pull/15912))
|
||||
|
||||
### 💾 Core
|
||||
|
||||
- #### ✨ New Features
|
||||
|
||||
- tools.func: add support for extracting 7z archives [@MickLesk](https://github.com/MickLesk) ([#15919](https://github.com/community-scripts/ProxmoxVE/pull/15919))
|
||||
- Meilisearch : use dumpless Meilisearch upgrades [@MickLesk](https://github.com/MickLesk) ([#15921](https://github.com/community-scripts/ProxmoxVE/pull/15921))
|
||||
|
||||
- #### 🔧 Refactor
|
||||
|
||||
- core: Improve GPU detection and mapping logic [@MickLesk](https://github.com/MickLesk) ([#15918](https://github.com/community-scripts/ProxmoxVE/pull/15918))
|
||||
|
||||
## 2026-07-19
|
||||
|
||||
### 🚀 Updated Scripts
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ function update_script() {
|
||||
exit
|
||||
fi
|
||||
|
||||
RELEASE="v0.27.2"
|
||||
RELEASE="v0.27.0"
|
||||
if check_for_gh_release "affine_app" "toeverything/AFFiNE" "${RELEASE}" "each release is tested individually before the version is updated. Please do not open issues for this"; then
|
||||
msg_info "Stopping Services"
|
||||
systemctl stop affine-web affine-worker
|
||||
|
||||
@@ -36,30 +36,6 @@ function update_script() {
|
||||
fetch_and_deploy_gh_release "gotify" "gotify/server" "prebuild" "latest" "/opt/gotify" "gotify-linux-$(arch_resolve).zip"
|
||||
chmod +x /opt/gotify/gotify-linux-$(arch_resolve)
|
||||
|
||||
if [[ ! -f /opt/gotify/gotify-server.env ]]; then
|
||||
gotify_old_config=""
|
||||
for f in /opt/gotify/config.yml /etc/gotify/config.yml; do
|
||||
[[ -f "$f" ]] && gotify_old_config="$f" && break
|
||||
done
|
||||
if [[ -n "$gotify_old_config" ]]; then
|
||||
msg_info "Migrating ${gotify_old_config} to env format (Gotify 3.x)"
|
||||
if /opt/gotify/gotify-linux-$(arch_resolve) migrate-config "$gotify_old_config" >/opt/gotify/gotify-server.env 2>/dev/null; then
|
||||
mv "$gotify_old_config" "${gotify_old_config}.bak"
|
||||
msg_ok "Migrated config to /opt/gotify/gotify-server.env (backup: ${gotify_old_config}.bak)"
|
||||
else
|
||||
rm -f /opt/gotify/gotify-server.env
|
||||
msg_warn "Config migration failed — left ${gotify_old_config} in place, review manually"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! grep -qE '^ExecStart=.* serve' /etc/systemd/system/gotify.service 2>/dev/null; then
|
||||
msg_info "Migrating service to serve subcommand (Gotify 3.x)"
|
||||
sed -i -E 's|^(ExecStart=/opt/gotify/.*gotify-linux-[^ ]+)$|\1 serve|' /etc/systemd/system/gotify.service
|
||||
systemctl daemon-reload
|
||||
msg_ok "Migrated service to serve subcommand"
|
||||
fi
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start gotify
|
||||
msg_ok "Started Service"
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ function update_script() {
|
||||
grep -o 'https://static\.tp-link\.com/upload/software/[^"]*linux_x64[^"]*\.deb' |
|
||||
head -n1)
|
||||
OMADA_PKG=$(basename "${OMADA_URL}")
|
||||
VERSION=$(sed -n 's/.*_v\([0-9.]*\)_linux.*/\1/p' <<<"${OMADA_PKG}")
|
||||
VERSION=$(sed -n 's/.*_v\([0-9.]*\)_.*_\([0-9]\{14\}\)\.deb$/\1-\2/p' <<<"${OMADA_PKG}")
|
||||
|
||||
CURRENT_VERSION=$(cat $HOME/.omada 2>/dev/null || echo "0")
|
||||
|
||||
|
||||
+5
-22
@@ -37,29 +37,18 @@ function update_script() {
|
||||
systemctl stop romm-backend romm-worker romm-scheduler romm-watcher
|
||||
msg_ok "Stopped Services"
|
||||
|
||||
create_backup /opt/romm/.env
|
||||
BACKUP_DIR=/opt/romm-players.backup create_backup \
|
||||
/opt/romm/frontend/dist/assets/emulatorjs \
|
||||
/opt/romm/frontend/dist/assets/ruffle
|
||||
msg_info "Backing up configuration"
|
||||
cp /opt/romm/.env /opt/romm/.env.backup
|
||||
msg_ok "Backed up configuration"
|
||||
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "romm" "rommapp/romm" "tarball" "latest" "/opt/romm"
|
||||
|
||||
restore_backup
|
||||
fetch_and_deploy_gh_release "romm" "rommapp/romm" "tarball" "latest" "/opt/romm"
|
||||
|
||||
msg_info "Updating ROMM"
|
||||
cp /opt/romm/.env.backup /opt/romm/.env
|
||||
cd /opt/romm
|
||||
$STD uv sync --all-extras
|
||||
cd /opt/romm/backend
|
||||
$STD uv run alembic upgrade head
|
||||
if [[ -f /opt/romm/backend/utils/rom_patcher/package.json ]]; then
|
||||
cd /opt/romm/backend/utils/rom_patcher
|
||||
$STD npm install --ignore-scripts --no-audit --no-fund
|
||||
if [[ -d node_modules/rom-patcher/rom-patcher-js ]]; then
|
||||
rm -rf rom-patcher-js
|
||||
cp -r node_modules/rom-patcher/rom-patcher-js ./rom-patcher-js
|
||||
fi
|
||||
rm -rf node_modules
|
||||
fi
|
||||
cd /opt/romm/frontend
|
||||
$STD npm install
|
||||
$STD npm run build
|
||||
@@ -84,12 +73,6 @@ function update_script() {
|
||||
msg_ok "Started Services"
|
||||
msg_ok "Updated successfully"
|
||||
fi
|
||||
|
||||
if check_for_gh_release "EmulatorJS" "EmulatorJS/EmulatorJS" "v4.2.3"; then
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "EmulatorJS" "EmulatorJS/EmulatorJS" "prebuild" "v4.2.3" "/opt/romm/frontend/dist/assets/emulatorjs" "4.2.3.7z"
|
||||
systemctl restart romm-backend romm-worker romm-scheduler romm-watcher
|
||||
msg_ok "Updated EmulatorJS successfully"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ PG_DB_NAME="affine" PG_DB_USER="affine" setup_postgresql_db
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
setup_rust
|
||||
|
||||
fetch_and_deploy_gh_release "affine_app" "toeverything/AFFiNE" "tarball" "v0.27.2" "/opt/affine"
|
||||
fetch_and_deploy_gh_release "affine_app" "toeverything/AFFiNE" "tarball" "v0.27.0" "/opt/affine"
|
||||
|
||||
msg_info "Setting up Directories"
|
||||
rm -rf /root/.affine
|
||||
|
||||
@@ -27,7 +27,7 @@ After=network.target
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=/opt/gotify
|
||||
ExecStart=/opt/gotify/gotify-linux-$(arch_resolve) serve
|
||||
ExecStart=/opt/gotify/./gotify-linux-$(arch_resolve)
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ OMADA_PKG=$(basename "${OMADA_URL}")
|
||||
curl_download "${OMADA_PKG}" "${OMADA_URL}"
|
||||
$STD dpkg -i "${OMADA_PKG}"
|
||||
rm -rf "${OMADA_PKG}"
|
||||
VERSION=$(sed -n 's/.*_v\([0-9.]*\)_linux.*/\1/p' <<<"${OMADA_PKG}")
|
||||
VERSION=$(sed -n 's/.*_v\([0-9.]*\)_.*_\([0-9]\{14\}\)\.deb$/\1-\2/p' <<<"${OMADA_PKG}")
|
||||
echo "${VERSION}" >$HOME/.omada
|
||||
msg_ok "Installed Omada Controller"
|
||||
|
||||
|
||||
@@ -134,8 +134,6 @@ else
|
||||
fi
|
||||
|
||||
fetch_and_deploy_gh_release "romm" "rommapp/romm" "tarball"
|
||||
fetch_and_deploy_gh_release "ruffle" "ruffle-rs/ruffle" "prebuild" "latest" "/opt/romm/frontend/dist/assets/ruffle" "ruffle-*-web-selfhosted.zip"
|
||||
fetch_and_deploy_gh_release "EmulatorJS" "EmulatorJS/EmulatorJS" "prebuild" "v4.2.3" "/opt/romm/frontend/dist/assets/emulatorjs" "4.2.3.7z"
|
||||
|
||||
msg_info "Creating environment file"
|
||||
sed -i 's/^supervised no/supervised systemd/' /etc/redis/redis.conf
|
||||
@@ -161,9 +159,6 @@ ROMM_AUTH_SECRET_KEY=$AUTH_SECRET_KEY
|
||||
DISABLE_DOWNLOAD_ENDPOINT_AUTH=false
|
||||
DISABLE_CSRF_PROTECTION=false
|
||||
|
||||
SCREENSCRAPER_DEV_ID=
|
||||
SCREENSCRAPER_DEV_PASSWORD=
|
||||
|
||||
ENABLE_RESCAN_ON_FILESYSTEM_CHANGE=true
|
||||
RESCAN_ON_FILESYSTEM_CHANGE_DELAY=5
|
||||
|
||||
@@ -186,18 +181,6 @@ cd /opt/romm/backend
|
||||
$STD uv run alembic upgrade head
|
||||
msg_ok "Set up RomM Backend"
|
||||
|
||||
if [[ -f /opt/romm/backend/utils/rom_patcher/package.json ]]; then
|
||||
msg_info "Building ROM Patcher helper"
|
||||
cd /opt/romm/backend/utils/rom_patcher
|
||||
$STD npm install --ignore-scripts --no-audit --no-fund
|
||||
if [[ -d node_modules/rom-patcher/rom-patcher-js ]]; then
|
||||
rm -rf rom-patcher-js
|
||||
cp -r node_modules/rom-patcher/rom-patcher-js ./rom-patcher-js
|
||||
fi
|
||||
rm -rf node_modules
|
||||
msg_ok "Built ROM Patcher helper"
|
||||
fi
|
||||
|
||||
msg_info "Setting up RomM Frontend"
|
||||
cd /opt/romm/frontend
|
||||
$STD npm install
|
||||
|
||||
@@ -31,10 +31,7 @@ $STD apt install -y elasticsearch
|
||||
sed -i 's/^#\{0,2\} *-Xms[0-9]*g.*/-Xms2g/' /etc/elasticsearch/jvm.options
|
||||
sed -i 's/^#\{0,2\} *-Xmx[0-9]*g.*/-Xmx2g/' /etc/elasticsearch/jvm.options
|
||||
cat <<EOF >/etc/elasticsearch/elasticsearch.yml
|
||||
path.data: /var/lib/elasticsearch
|
||||
path.logs: /var/log/elasticsearch
|
||||
discovery.type: single-node
|
||||
network.host: 127.0.0.1
|
||||
xpack.security.enabled: false
|
||||
bootstrap.memory_lock: false
|
||||
EOF
|
||||
@@ -43,7 +40,7 @@ systemctl daemon-reload
|
||||
systemctl enable -q elasticsearch
|
||||
systemctl restart -q elasticsearch
|
||||
for i in $(seq 1 30); do
|
||||
if curl -s http://127.0.0.1:9200 >/dev/null 2>&1; then
|
||||
if curl -s http://localhost:9200 >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
@@ -58,7 +55,7 @@ setup_deb822_repo \
|
||||
"$(get_os_info version_id)" \
|
||||
"main"
|
||||
$STD apt install -y zammad
|
||||
$STD zammad run rails r "Setting.set('es_url', 'http://127.0.0.1:9200')"
|
||||
$STD zammad run rails r "Setting.set('es_url', 'http://localhost:9200')"
|
||||
$STD zammad run rake zammad:searchindex:rebuild
|
||||
msg_ok "Installed Zammad"
|
||||
|
||||
|
||||
+119
-61
@@ -2587,16 +2587,6 @@ _deploy_unpacked_archive() {
|
||||
msg_error "Failed to extract TAR archive"
|
||||
return 251
|
||||
}
|
||||
elif [[ "$filename" == *.7z ]]; then
|
||||
if [[ -f /etc/alpine-release ]]; then
|
||||
ensure_dependencies 7zip
|
||||
else
|
||||
ensure_dependencies p7zip-full
|
||||
fi
|
||||
7z x -y -o"$workdir" "$archive" >/dev/null 2>&1 || {
|
||||
msg_error "Failed to extract 7z archive"
|
||||
return 251
|
||||
}
|
||||
else
|
||||
msg_error "Unsupported archive format: $filename"
|
||||
return 65
|
||||
@@ -6991,7 +6981,7 @@ setup_meilisearch() {
|
||||
CURRENT_VERSION=$(/usr/bin/meilisearch --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1) || CURRENT_VERSION="0.0.0"
|
||||
NEW_VERSION="${CHECK_UPDATE_RELEASE#v}"
|
||||
|
||||
# Extract major.minor for comparison (Meilisearch changes its on-disk DB format between minor versions)
|
||||
# Extract major.minor for comparison (Meilisearch requires dump/restore between minor versions)
|
||||
local CURRENT_MAJOR_MINOR NEW_MAJOR_MINOR
|
||||
CURRENT_MAJOR_MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f1,2)
|
||||
NEW_MAJOR_MINOR=$(echo "$NEW_VERSION" | cut -d. -f1,2)
|
||||
@@ -7003,72 +6993,140 @@ setup_meilisearch() {
|
||||
msg_info "MeiliSearch version change detected (${CURRENT_VERSION} → ${NEW_VERSION}), preparing data migration"
|
||||
fi
|
||||
|
||||
# Read connection + storage paths for the in-place (dumpless) upgrade
|
||||
local MEILI_HOST MEILI_PORT MEILI_DB_PATH
|
||||
# Read config values for dump/restore
|
||||
local MEILI_HOST MEILI_PORT MEILI_MASTER_KEY MEILI_DUMP_DIR
|
||||
MEILI_HOST="${MEILISEARCH_HOST:-127.0.0.1}"
|
||||
MEILI_PORT="${MEILISEARCH_PORT:-7700}"
|
||||
MEILI_DB_PATH=$(grep -E "^db_path\s*=" /etc/meilisearch.toml 2>/dev/null | sed 's/.*=\s*"\(.*\)"/\1/' | tr -d ' ' || true)
|
||||
MEILI_DB_PATH="${MEILI_DB_PATH:-/var/lib/meilisearch/data}"
|
||||
MEILI_DUMP_DIR="${MEILISEARCH_DUMP_DIR:-/var/lib/meilisearch/dumps}"
|
||||
MEILI_MASTER_KEY=$(grep -E "^master_key\s*=" /etc/meilisearch.toml 2>/dev/null | sed 's/.*=\s*"\(.*\)"/\1/' | tr -d ' ' || true)
|
||||
|
||||
systemctl stop meilisearch
|
||||
# Create dump before update if migration is needed
|
||||
local DUMP_UID=""
|
||||
if [[ "$NEEDS_MIGRATION" == "true" ]] && [[ -n "$MEILI_MASTER_KEY" ]]; then
|
||||
msg_info "Creating MeiliSearch data dump before upgrade"
|
||||
|
||||
# Safety backup of the data dir before any in-place migration.
|
||||
# Dumpless upgrade mutates the DB in place and cannot be rolled back on
|
||||
# failure, so keep a tarball to restore from. (No master_key/API needed.)
|
||||
local MEILI_BACKUP=""
|
||||
if [[ "$NEEDS_MIGRATION" == "true" ]]; then
|
||||
MEILI_BACKUP="/var/lib/meilisearch/pre-upgrade-${CURRENT_VERSION}.tar.gz"
|
||||
msg_info "Backing up data dir before upgrade → ${MEILI_BACKUP}"
|
||||
if ! tar -czf "$MEILI_BACKUP" -C "$MEILI_DB_PATH" . 2>/dev/null; then
|
||||
msg_error "MeiliSearch data backup failed — aborting upgrade to avoid data loss"
|
||||
systemctl start meilisearch
|
||||
return 100
|
||||
# Trigger dump creation
|
||||
local DUMP_RESPONSE
|
||||
DUMP_RESPONSE=$(curl -s -X POST "http://${MEILI_HOST}:${MEILI_PORT}/dumps" \
|
||||
-H "Authorization: Bearer ${MEILI_MASTER_KEY}" \
|
||||
-H "Content-Type: application/json" 2>/dev/null) || true
|
||||
|
||||
# The initial response only contains taskUid, not dumpUid
|
||||
# dumpUid is only available after the task completes
|
||||
local TASK_UID
|
||||
TASK_UID=$(echo "$DUMP_RESPONSE" | grep -oP '"taskUid":\s*\K[0-9]+' || true)
|
||||
|
||||
if [[ -n "$TASK_UID" ]]; then
|
||||
msg_info "Waiting for dump task ${TASK_UID} to complete..."
|
||||
local MAX_WAIT=120
|
||||
local WAITED=0
|
||||
local TASK_RESULT=""
|
||||
|
||||
while [[ $WAITED -lt $MAX_WAIT ]]; do
|
||||
TASK_RESULT=$(curl -s "http://${MEILI_HOST}:${MEILI_PORT}/tasks/${TASK_UID}" \
|
||||
-H "Authorization: Bearer ${MEILI_MASTER_KEY}" 2>/dev/null) || true
|
||||
|
||||
local TASK_STATUS
|
||||
TASK_STATUS=$(echo "$TASK_RESULT" | grep -oP '"status":\s*"\K[^"]+' || true)
|
||||
|
||||
if [[ "$TASK_STATUS" == "succeeded" ]]; then
|
||||
# Extract dumpUid from the completed task details
|
||||
DUMP_UID=$(echo "$TASK_RESULT" | grep -oP '"dumpUid":\s*"\K[^"]+' || true)
|
||||
if [[ -n "$DUMP_UID" ]]; then
|
||||
msg_ok "MeiliSearch dump created successfully: ${DUMP_UID}"
|
||||
else
|
||||
msg_warn "Dump task succeeded but could not extract dumpUid"
|
||||
fi
|
||||
break
|
||||
elif [[ "$TASK_STATUS" == "failed" ]]; then
|
||||
local ERROR_MSG
|
||||
ERROR_MSG=$(echo "$TASK_RESULT" | grep -oP '"message":\s*"\K[^"]+' || echo "Unknown error")
|
||||
msg_warn "MeiliSearch dump failed: ${ERROR_MSG}"
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
WAITED=$((WAITED + 2))
|
||||
done
|
||||
|
||||
if [[ $WAITED -ge $MAX_WAIT ]]; then
|
||||
msg_warn "MeiliSearch dump timed out after ${MAX_WAIT}s"
|
||||
fi
|
||||
else
|
||||
msg_warn "Could not trigger MeiliSearch dump (no taskUid in response)"
|
||||
msg_info "Response was: ${DUMP_RESPONSE:-empty}"
|
||||
fi
|
||||
msg_ok "Backup created: ${MEILI_BACKUP}"
|
||||
fi
|
||||
|
||||
# Replace the binary
|
||||
if [[ "$NEEDS_MIGRATION" == "true" ]] && [[ -z "$DUMP_UID" ]]; then
|
||||
msg_error "MeiliSearch migration requires a successful dump before upgrade"
|
||||
msg_error "Ensure the service is running and master_key is configured, or set MEILISEARCH_SKIP_MIGRATION=1 to force (data loss risk)"
|
||||
if [[ "${MEILISEARCH_SKIP_MIGRATION:-}" != "1" ]]; then
|
||||
return 100
|
||||
fi
|
||||
msg_warn "MEILISEARCH_SKIP_MIGRATION=1 — proceeding without dump (manual reindex may be required)"
|
||||
fi
|
||||
|
||||
# Stop service and update binary
|
||||
systemctl stop meilisearch
|
||||
if [[ "$(arch_resolve)" == "arm64" ]]; then
|
||||
fetch_and_deploy_gh_release "meilisearch" "meilisearch/meilisearch" "singlefile" "latest" "/usr/bin" "meilisearch-linux-aarch64"
|
||||
else
|
||||
fetch_and_deploy_gh_release "meilisearch" "meilisearch/meilisearch" "binary"
|
||||
fi
|
||||
|
||||
if [[ "$NEEDS_MIGRATION" == "true" ]]; then
|
||||
# One-time in-place migration via --experimental-dumpless-upgrade.
|
||||
# Meilisearch migrates the on-disk DB during this startup; subsequent
|
||||
# normal (systemd) starts run without the flag.
|
||||
msg_info "Migrating data in place (dumpless upgrade ${CURRENT_VERSION} → ${NEW_VERSION})"
|
||||
/usr/bin/meilisearch --config-file-path /etc/meilisearch.toml --experimental-dumpless-upgrade >/dev/null 2>&1 &
|
||||
local MEILI_PID=$!
|
||||
# If migration needed and dump was created, remove old data and import dump
|
||||
if [[ "$NEEDS_MIGRATION" == "true" ]] && [[ -n "$DUMP_UID" ]]; then
|
||||
local MEILI_DB_PATH
|
||||
MEILI_DB_PATH=$(grep -E "^db_path\s*=" /etc/meilisearch.toml 2>/dev/null | sed 's/.*=\s*"\(.*\)"/\1/' | tr -d ' ' || true)
|
||||
MEILI_DB_PATH="${MEILI_DB_PATH:-/var/lib/meilisearch/data}"
|
||||
|
||||
local MAX_WAIT=300
|
||||
local WAITED=0
|
||||
local MIGRATED=false
|
||||
while [[ $WAITED -lt $MAX_WAIT ]]; do
|
||||
if curl -sf "http://${MEILI_HOST}:${MEILI_PORT}/health" &>/dev/null; then
|
||||
MIGRATED=true
|
||||
break
|
||||
msg_info "Removing old MeiliSearch database for migration"
|
||||
find "${MEILI_DB_PATH:?}" -mindepth 1 -delete
|
||||
|
||||
# Import dump using CLI flag (this is the supported method)
|
||||
local DUMP_FILE="${MEILI_DUMP_DIR}/${DUMP_UID}.dump"
|
||||
if [[ -f "$DUMP_FILE" ]]; then
|
||||
msg_info "Importing dump: ${DUMP_FILE}"
|
||||
|
||||
# Start meilisearch with --import-dump flag
|
||||
# This is a one-time import that happens during startup
|
||||
/usr/bin/meilisearch --config-file-path /etc/meilisearch.toml --import-dump "$DUMP_FILE" >/dev/null 2>&1 &
|
||||
local MEILI_PID=$!
|
||||
|
||||
# Wait for meilisearch to become healthy (import happens during startup)
|
||||
msg_info "Waiting for MeiliSearch to import and start..."
|
||||
local MAX_WAIT=300
|
||||
local WAITED=0
|
||||
while [[ $WAITED -lt $MAX_WAIT ]]; do
|
||||
if curl -sf "http://${MEILI_HOST}:${MEILI_PORT}/health" &>/dev/null; then
|
||||
msg_ok "MeiliSearch is healthy after import"
|
||||
break
|
||||
fi
|
||||
# Check if process is still running
|
||||
if ! kill -0 $MEILI_PID 2>/dev/null; then
|
||||
msg_warn "MeiliSearch process exited during import"
|
||||
break
|
||||
fi
|
||||
sleep 3
|
||||
WAITED=$((WAITED + 3))
|
||||
done
|
||||
|
||||
# Stop the manual process
|
||||
kill $MEILI_PID 2>/dev/null || true
|
||||
wait $MEILI_PID 2>/dev/null || true
|
||||
sleep 2
|
||||
|
||||
# Start via systemd for proper management
|
||||
systemctl start meilisearch
|
||||
|
||||
if systemctl is-active --quiet meilisearch; then
|
||||
msg_ok "MeiliSearch migrated successfully"
|
||||
else
|
||||
msg_warn "MeiliSearch failed to start after migration - check logs with: journalctl -u meilisearch"
|
||||
fi
|
||||
# Bail early if the migration process died
|
||||
if ! kill -0 $MEILI_PID 2>/dev/null; then
|
||||
msg_warn "MeiliSearch process exited during migration"
|
||||
break
|
||||
fi
|
||||
sleep 3
|
||||
WAITED=$((WAITED + 3))
|
||||
done
|
||||
|
||||
# Stop the one-shot migration process and hand over to systemd
|
||||
kill $MEILI_PID 2>/dev/null || true
|
||||
wait $MEILI_PID 2>/dev/null || true
|
||||
sleep 2
|
||||
systemctl start meilisearch
|
||||
|
||||
if [[ "$MIGRATED" == "true" ]] && systemctl is-active --quiet meilisearch; then
|
||||
msg_ok "MeiliSearch migrated successfully (backup kept at ${MEILI_BACKUP})"
|
||||
else
|
||||
msg_error "MeiliSearch migration failed. Restore with: systemctl stop meilisearch; rm -rf ${MEILI_DB_PATH:?}/*; tar -xzf ${MEILI_BACKUP} -C ${MEILI_DB_PATH}; then reinstall the previous version"
|
||||
msg_warn "Dump file not found: ${DUMP_FILE}"
|
||||
systemctl start meilisearch
|
||||
fi
|
||||
else
|
||||
systemctl start meilisearch
|
||||
|
||||
Reference in New Issue
Block a user