feat(new-service): render __DOMAIN__ from INGRESS_DOMAIN; HTTPS URLs and health checks

Plan 11 step 7. INGRESS_DOMAIN=lab.holtlabs.xyz; health checks pin the host
to INGRESS_IP on 443 and verify the wildcard cert.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
nholtware 2026-11-10 13:15:00 -06:00
parent b133a0d120
commit 2a6971df03
4 changed files with 22 additions and 17 deletions

View file

@ -171,13 +171,13 @@ render_manifests() {
for f in "${extra[@]}"; do add+=" - $f\n"; done
sed -i "s|^ # Added by the render recipe.*$|${add%\\n}|" "$out/kustomization.yaml"
sed -i '/^$/d' "$out/kustomization.yaml"
sed -i "s/__APP__/$NAME/g" "$out"/*.yaml
sed -i "s/__APP__/$NAME/g; s/__DOMAIN__/$INGRESS_DOMAIN/g" "$out"/*.yaml
else
if [[ -z $API_APP ]]; then
rm "$out/ingress-api.yaml" "$out/middleware.yaml"
sed -i '/ingress-api.yaml$/d; /middleware.yaml$/d; /# \/api -> backend/d' "$out/kustomization.yaml"
fi
sed -i "s/__APP__/$NAME/g; s/__API__/$API_APP/g" "$out"/*.yaml
sed -i "s/__APP__/$NAME/g; s/__API__/$API_APP/g; s/__DOMAIN__/$INGRESS_DOMAIN/g" "$out"/*.yaml
fi
! grep -rn '__[A-Z]*__' "$out" || die "unrendered placeholder left in manifests"
kustomize_build "$out" >/dev/null || die "kustomize build of rendered manifests failed"
@ -291,14 +291,14 @@ if ((WAIT)) && ! is_dry; then
local p
for p in "$@"; do
[[ $(curl -s -o /dev/null -w '%{http_code}' --max-time 5 \
--resolve "$HOST:80:$INGRESS_IP" "http://$HOST$p") == 200 ]] || return 1
--resolve "$HOST:443:$INGRESS_IP" "https://$HOST$p") == 200 ]] || return 1
done
}
paths=("$HEALTH_PATH")
[[ -n $API_APP ]] && paths+=(/api/readyz)
wait_until 180 5 "http://$HOST${paths[*]} -> 200" http_ok "${paths[@]}"
wait_until 180 5 "https://$HOST${paths[*]} -> 200" http_ok "${paths[@]}"
for p in "${paths[@]}"; do
printf ' GET %s -> %s\n' "$p" "$(curl -s --max-time 5 --resolve "$HOST:80:$INGRESS_IP" "http://$HOST$p")" >&2
printf ' GET %s -> %s\n' "$p" "$(curl -s --max-time 5 --resolve "$HOST:443:$INGRESS_IP" "https://$HOST$p")" >&2
done
fi