From 286ffc9ef5c1ace67accef213a92ab98e8cdb153 Mon Sep 17 00:00:00 2001 From: Ivan Bazulic Date: Mon, 25 Nov 2024 14:05:04 -0500 Subject: [PATCH] task: Do not remove Quay container on exit When Quay container starts via the systemd unit, it gets automatically removed as a post-stop action. This causes problems when trying to diagnose startup issues, such as any validation errors. Logs are written in journal and can be pulled out by `journalctl` but sometimes it's just easier to call container logs instead. With this change, we set the removal of Quay container, if it exists, as an `ExecStartPre` action. This allows the container to persist after exiting for additional debugging. --- .../project/roles/mirror_appliance/templates/quay.service.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible-runner/context/app/project/roles/mirror_appliance/templates/quay.service.j2 b/ansible-runner/context/app/project/roles/mirror_appliance/templates/quay.service.j2 index c413326..bbc5224 100755 --- a/ansible-runner/context/app/project/roles/mirror_appliance/templates/quay.service.j2 +++ b/ansible-runner/context/app/project/roles/mirror_appliance/templates/quay.service.j2 @@ -8,6 +8,7 @@ Requires=quay-pod.service quay-redis.service Type=simple TimeoutStartSec=5m Environment=PODMAN_SYSTEMD_UNIT=%n +ExecStartPre=-/usr/bin/podman rm --ignore -f --cidfile %t/%n-cid ExecStartPre=-/bin/rm -f %t/%n-pid %t/%n-cid ExecStart=/usr/bin/podman run \ --name quay-app \ @@ -26,7 +27,6 @@ ExecStart=/usr/bin/podman run \ {{ quay_image }} {{ quay_cmd }} ExecStop=-/usr/bin/podman stop --ignore --cidfile %t/%n-cid -t 10 -ExecStopPost=-/usr/bin/podman rm --ignore -f --cidfile %t/%n-cid PIDFile=%t/%n-pid KillMode=none Restart=always