Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

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

TATSUNO “Taz” Yasuhirobe578ac13f2b
diff --git a/src/main/java/io/github/hectorvent/floci/services/mwaa/MwaaEnvironmentManager.java b/src/main/java/io/github/hectorvent/floci/services/mwaa/MwaaEnvironmentManager.java
index a5a47ecc79..09d83953d9 100644
--- a/src/main/java/io/github/hectorvent/floci/services/mwaa/MwaaEnvironmentManager.java
+++ b/src/main/java/io/github/hectorvent/floci/services/mwaa/MwaaEnvironmentManager.java
@@ -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;
}