mirror of
https://github.com/community-scripts/ProxmoxVED.git
synced 2026-03-08 01:08:12 +00:00
feat: add health check and release tag recording for LocalAGI installation and updates
This commit is contained in:
@@ -21,6 +21,23 @@ variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function health_check() {
|
||||
header_info
|
||||
|
||||
if [[ ! -d /opt/localagi ]]; then
|
||||
msg_error "LocalAGI not found at /opt/localagi"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! systemctl is-active --quiet localagi; then
|
||||
msg_error "LocalAGI service not running"
|
||||
return 1
|
||||
fi
|
||||
|
||||
msg_ok "Health check passed: LocalAGI installed and service running"
|
||||
return 0
|
||||
}
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
@@ -58,6 +75,16 @@ function update_script() {
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "localagi" "mudler/LocalAGI" "tarball" "latest" "/opt/localagi"
|
||||
msg_ok "Updated LocalAGI"
|
||||
|
||||
# Record installed release tag for update checks
|
||||
msg_info "Recording installed LocalAGI release tag"
|
||||
release_tag=$(curl -fsSL "https://api.github.com/repos/mudler/LocalAGI/releases/latest" | grep -E '"tag_name"' | head -n1 | sed -E 's/[^\"]*"([^"]+)".*/\1/' 2>/dev/null || true)
|
||||
if [[ -n "$release_tag" ]]; then
|
||||
echo "$release_tag" >/opt/localagi/LOCALAGI_VERSION.txt 2>/dev/null || msg_warn "Failed to write version file"
|
||||
msg_ok "Recorded release: $release_tag"
|
||||
else
|
||||
msg_warn "Could not determine release tag for LocalAGI"
|
||||
fi
|
||||
|
||||
# Ensure dedicated system user exists and ownership is correct
|
||||
if ! id -u localagi >/dev/null 2>&1; then
|
||||
msg_info "Creating system user 'localagi'"
|
||||
@@ -144,6 +171,11 @@ EOF
|
||||
}
|
||||
msg_ok "Started LocalAGI (external-llm)"
|
||||
|
||||
# Run health check after start
|
||||
health_check || {
|
||||
msg_warn "Health check failed after update; check service logs"
|
||||
}
|
||||
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
exit
|
||||
|
||||
@@ -33,6 +33,16 @@ if [[ ! -d /opt/localagi/webui/react-ui ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Record installed release tag for update checks
|
||||
msg_info "Recording installed LocalAGI release tag"
|
||||
release_tag=$(curl -fsSL "https://api.github.com/repos/mudler/LocalAGI/releases/latest" | grep -E '"tag_name"' | head -n1 | sed -E 's/[^\"]*"([^"]+)".*/\1/' 2>/dev/null || true)
|
||||
if [[ -n "$release_tag" ]]; then
|
||||
echo "$release_tag" >/opt/localagi/LOCALAGI_VERSION.txt 2>/dev/null || msg_warn "Failed to write version file"
|
||||
msg_ok "Recorded release: $release_tag"
|
||||
else
|
||||
msg_warn "Could not determine release tag for LocalAGI"
|
||||
fi
|
||||
|
||||
mkdir -p /opt/localagi/pool
|
||||
|
||||
msg_info "Configuring LocalAGI"
|
||||
|
||||
Reference in New Issue
Block a user