fix(scripts): improve patch.sh

- let patch.sh run while the coolify container is stopped
- If the compose files are from 4.4 but an older Coolify is installed the error now prints the command to update to 4.4.7
This commit is contained in:
peaklabs-dev
2026-10-21 21:35:08 +02:00
parent 5d21b048a8
commit 82b40eb852
+6 -3
View File
@@ -49,8 +49,11 @@ check_installation() {
}
read_version() {
current_version="$(docker exec -w /var/www/html coolify php bootstrap/getVersion.php 2> /dev/null)" || die "the coolify container is not running"
ok "Coolify $BOLD$current_version$RESET is running"
local image
image="$(docker inspect --format '{{.Image}}' coolify 2> /dev/null)" || die "the coolify container does not exist"
# Read from the image, because the mitigation advice was to stop the coolify container
current_version="$(docker run --rm --network none --entrypoint php -w /var/www/html "$image" bootstrap/getVersion.php < /dev/null 2> /dev/null)" || die "could not read the Coolify version from the coolify container"
ok "Coolify $BOLD$current_version$RESET is installed"
}
select_patch_version() {
@@ -70,7 +73,7 @@ check_compose_files() {
if [[ "$patch_version" == 4.4.* ]]; then
needs_realtime=false
fi
[ "$has_realtime" = "$needs_realtime" ] || die "the compose files in $SOURCE_DIR do not belong to Coolify $current_version, upgrade to the latest version from the dashboard instead"
[ "$has_realtime" = "$needs_realtime" ] || die "the compose files in $SOURCE_DIR do not belong to Coolify $current_version, update to ${PATCH_VERSIONS[4]} instead: curl -fsSL https://cdn.coollabs.io/coolify/upgrade.sh | sudo bash -s ${PATCH_VERSIONS[4]}"
ok "the compose files belong to Coolify $current_version"
}