From 397a933240625566802dee7726aee9eb8c05e0e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20L=C3=BCbke?= Date: Wed, 1 Apr 2026 23:38:56 +0200 Subject: [PATCH] fix: context deadline exceeded error in create-namespace.sh init script (#136) --- compose/scripts/create-namespace.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/compose/scripts/create-namespace.sh b/compose/scripts/create-namespace.sh index 45334f0..096520f 100755 --- a/compose/scripts/create-namespace.sh +++ b/compose/scripts/create-namespace.sh @@ -1,18 +1,24 @@ #!/bin/sh set -eu - NAMESPACE=${DEFAULT_NAMESPACE:-default} TEMPORAL_ADDRESS=${TEMPORAL_ADDRESS:-temporal:7233} +TEMPORAL_HOST=$(echo $TEMPORAL_ADDRESS | cut -d: -f1) +TEMPORAL_PORT=$(echo $TEMPORAL_ADDRESS | cut -d: -f2) + echo "Waiting for Temporal server port to be available..." -nc -z -w 10 $(echo $TEMPORAL_ADDRESS | cut -d: -f1) $(echo $TEMPORAL_ADDRESS | cut -d: -f2) +nc -z -w 10 $TEMPORAL_HOST $TEMPORAL_PORT echo 'Temporal server port is available' +# Resolve hostname to IPv4 to work around some very weird issue +TEMPORAL_IP=$(getent ahosts $TEMPORAL_HOST | grep STREAM | head -1 | awk '{print $1}') +RESOLVED_ADDRESS="${TEMPORAL_IP}:${TEMPORAL_PORT}" +echo "Resolved $TEMPORAL_ADDRESS to $RESOLVED_ADDRESS" + echo 'Waiting for Temporal server to be healthy...' max_attempts=3 attempt=0 - -until temporal operator cluster health --address $TEMPORAL_ADDRESS; do +until temporal operator cluster health --address $RESOLVED_ADDRESS; do attempt=$((attempt + 1)) if [ $attempt -ge $max_attempts ]; then echo "Server did not become healthy after $max_attempts attempts" @@ -23,5 +29,5 @@ until temporal operator cluster health --address $TEMPORAL_ADDRESS; do done echo "Server is healthy, creating namespace '$NAMESPACE'..." -temporal operator namespace describe -n $NAMESPACE --address $TEMPORAL_ADDRESS || temporal operator namespace create -n $NAMESPACE --address $TEMPORAL_ADDRESS +temporal operator namespace describe -n $NAMESPACE --address $RESOLVED_ADDRESS || temporal operator namespace create -n $NAMESPACE --address $RESOLVED_ADDRESS echo "Namespace '$NAMESPACE' created"