fix(mwaa): probe the metadata database over TCP before starting Airflow (#3406)

The official postgres image serves first-boot init through a temporary
server that listens only on the Unix socket, then restarts it. The
readiness probe ran pg_isready over that socket, so it could pass
against the temporary server before the final server accepted TCP
connections from the Airflow container. Probe TCP loopback instead.
This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-09-11 09:26:48 -04:00
1 parent 14b0875a27
commit be578ac13f
1 file changed
+7 -1
@@ -425,11 +425,17 @@ public class MwaaEnvironmentManager {
+ "exec airflow webserver";
}
/**
* Probes over TCP loopback on purpose. The official image runs first-boot init against a
* temporary server that listens only on the Unix socket, so a socket probe can pass before
* the final server accepts the Airflow container's TCP connections.
*/
private void waitForPostgresReady(String containerId) {
Exception last = null;
for (int attempt = 1; attempt <= 60; attempt++) {
try {
ExecResult result = execInContainer(containerId, new String[]{"pg_isready", "-U", "airflow"});
ExecResult result = execInContainer(containerId,
new String[]{"pg_isready", "-h", "127.0.0.1", "-U", "airflow"});
if (result.exitCode() == 0) {
return;
}