Changes from old deployment system to new dynamic one

This commit is contained in:
2026-07-28 22:09:40 +02:00
parent a1c5a78b20
commit 6f50fb2263
4 changed files with 42 additions and 272 deletions
+7 -44
View File
@@ -6,7 +6,6 @@ cd "$SCRIPT_DIR"
ENV_FILE="$SCRIPT_DIR/.docker-build.env"
APP_IMAGE_REPO="git.invario-software.eu/invario/inventarsystem"
DIST_DIR="$SCRIPT_DIR/dist"
RUNTIME_COMPOSE_OVERRIDE_FILE="$SCRIPT_DIR/.docker-compose.runtime.override.yml"
SUDO=""
@@ -279,52 +278,19 @@ EOF
fi
}
ensure_app_image_loaded() {
ensure_app_image_ready() {
if docker image inspect "$APP_IMAGE_VALUE" >/dev/null 2>&1; then
return 0
fi
local image_archive
image_archive="$(find_local_dist_image_archive || true)"
if [ -n "$image_archive" ]; then
echo "Loading app image from local dist artifact: $image_archive"
if docker load -i "$image_archive" >/dev/null 2>&1 && docker image inspect "$APP_IMAGE_VALUE" >/dev/null 2>&1; then
return 0
fi
echo "Warning: failed to load expected app image from $image_archive"
fi
echo "Error: local app image not found: $APP_IMAGE_VALUE"
echo "Run ./update.sh so the nightly updater loads the release image first."
exit 1
}
find_local_dist_image_archive() {
local tag archive
if [ ! -d "$DIST_DIR" ]; then
return 1
fi
tag="${APP_IMAGE_VALUE##*:}"
for archive in \
"$DIST_DIR/inventarsystem-image-$tag.tar.gz" \
"$DIST_DIR/inventarsystem-image-$tag.tar" \
"$DIST_DIR/inventarsystem-image.tar.gz" \
"$DIST_DIR/inventarsystem-image.tar"; do
if [ -f "$archive" ]; then
echo "$archive"
return 0
fi
done
archive="$(find "$DIST_DIR" -maxdepth 1 -type f \( -name 'inventarsystem-image-*.tar.gz' -o -name 'inventarsystem-image-*.tar' \) | sort | tail -n1)"
if [ -n "$archive" ]; then
echo "$archive"
echo "Attempting to pull registry image: $APP_IMAGE_VALUE"
if docker pull "$APP_IMAGE_VALUE" >/dev/null 2>&1; then
return 0
fi
return 1
echo "Error: app image not found locally and pull failed: $APP_IMAGE_VALUE"
echo "Run ./update.sh to pull the latest release image from the registry."
exit 1
}
configure_nuitka_mode() {
@@ -605,7 +571,6 @@ verify_stack_health() {
fi
compose_args+=(--env-file "$ENV_FILE")
# Try health check with optional restart on first failure
while [[ $retry_count -lt 2 ]]; do
echo "Waiting for containers to become healthy... (attempt $((retry_count + 1))/2)"
for _ in $(seq 1 60); do
@@ -623,7 +588,6 @@ verify_stack_health() {
sleep 2
done
# First failure: attempt recovery by restarting containers
if [[ $retry_count -eq 0 ]]; then
echo "Health check failed. Attempting to restart containers..."
docker compose "${compose_args[@]}" ps || true
@@ -636,7 +600,6 @@ verify_stack_health() {
fi
done
# Final failure
echo "Error: stack health check failed after restart attempt."
docker compose "${compose_args[@]}" ps || true
docker compose "${compose_args[@]}" logs --tail=120 app redis mongodb || true
@@ -654,7 +617,7 @@ resolve_app_image
configure_host_ports
ensure_min_docker_disk_space
detect_server_capacity
ensure_app_image_loaded
ensure_app_image_ready
write_env_file
write_runtime_compose_override