Merge pull request 'Fix ldap-init race on first-run setup' (#266) from raucao/ldap-init-race into master
CI / Test (push) Successful in 2m4s

Reviewed-on: #266
Reviewed-by: Greg <greg@kosmos.org>
This commit was merged in pull request #266.
This commit is contained in:
raucao committed 2026-11-09 16:19:27 +00:00
commit f8d6fcb3d2
2 files changed
+18

No files matched your search

+6
View File
@@ -12,6 +12,12 @@ services:
environment:
DS_DM_PASSWORD: passthebutter
SUFFIX_NAME: "dc=kosmos,dc=org"
healthcheck:
test: ["CMD-SHELL", "ldapsearch -x -H ldap://localhost:3389 -D 'cn=Directory Manager' -w \"$$DS_DM_PASSWORD\" -b '' -s base '(objectclass=*)' >/dev/null 2>&1"]
interval: 5s
timeout: 5s
retries: 12
start_period: 30s
ldap-init:
image: 4teamwork/389ds:latest
+12
View File
@@ -4,6 +4,18 @@ set -e
SUFFIX="${LDAP_SUFFIX:-dc=kosmos,dc=org}"
URI="ldap://ldap:3389"
attempt=1
until dsconf -D "cn=Directory Manager" -w "$LDAP_ADMIN_PASSWORD" "$URI" \
backend suffix list --suffix >/dev/null 2>&1; do
if [ "$attempt" -ge 60 ]; then
echo "Timed out waiting for LDAP server at $URI" >&2
exit 1
fi
echo "Waiting for LDAP server at $URI (attempt $attempt)..."
attempt=$((attempt + 1))
sleep 2
done
if dsconf -D "cn=Directory Manager" -w "$LDAP_ADMIN_PASSWORD" "$URI" \
backend suffix list --suffix 2>/dev/null | grep -Fqx "$SUFFIX"; then
echo "LDAP backend for $SUFFIX already exists, skipping."