Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

update.sh on Podman: a container that is gone stopped as it started, in its own last words

milind-soni5ff9596d66e2
diff --git a/deploy/e2e/podman.sh b/deploy/e2e/podman.sh
index bf69712edc..4b8b204210 100755
--- a/deploy/e2e/podman.sh
+++ b/deploy/e2e/podman.sh
@@ -246,6 +246,7 @@ status=0
OMB_UPDATE_WAIT_S=90 "$DIR/update.sh" --image localhost/omb-broken:e2e --allow-older >"$OUT/update-broken.txt" 2>&1 || status=$?
cat "$OUT/update-broken.txt"
[ "$status" = 1 ] || fail "the broken update exited $status, not 1"
+contains "$OUT/update-broken.txt" "did not work: it stopped as it started (broken on purpose)." "the broken update did not say why in the server's own words"
contains "$OUT/update-broken.txt" "Your server runs $NEW_VERSION again, with its data as it was before the update." "the broken update was not rolled back"
[ "$(sed -n 's/^Image=//p' "$UNIT")" = "$new_image" ] || fail "the unit does not name $NEW_VERSION again"
healthy_again
diff --git a/deploy/update.sh b/deploy/update.sh
index cd48a57a14..f29c061305 100755
--- a/deploy/update.sh
+++ b/deploy/update.sh
@@ -144,7 +144,8 @@ podman_compose() {
shift 2
podman exec "$SERVER_UNIT" "$@" </dev/null
;;
- logs) journalctl --user -u "$SERVER_UNIT.service" -n 40 -o cat --no-pager ;;
+ # The container's own lines, not systemd's about it.
+ logs) journalctl --user -u "$SERVER_UNIT.service" -t "$SERVER_UNIT" -n 40 -o cat --no-pager ;;
*) return 1 ;;
esac
}
@@ -553,6 +554,8 @@ wait_healthy() {
WHY=""
while :; do
cid=$(container)
+ # A Podman install's container goes with the process it ran (systemd starts a new one): gone is stopped.
+ if [ -z "$cid" ] && [ -n "$UNIT" ]; then WHY="it stopped as it started ($(last_words))"; return 1; fi
if [ -z "$cid" ]; then WHY="its container is gone"; return 1; fi
state=$(inspect '{{.State.Status}} {{.RestartCount}} {{.Image}}' "$cid")
status=${state%% *}