Migrate to Blazor WASM, MSSQL platform DB, and durable audio PVC.
build-and-deploy / deploy (push) Failing after 15m11s
build-and-deploy / deploy (push) Failing after 15m11s
Remove in-cluster Postgres; serve WASM via nginx; add audio import job for Gooya archives.
This commit is contained in:
+12
-15
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build images, import into k3s, apply manifests, roll out.
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
@@ -30,9 +29,10 @@ fi
|
||||
build_with_retry() {
|
||||
local dockerfile="$1"
|
||||
local tag="$2"
|
||||
shift 2
|
||||
local attempt=1
|
||||
local max_attempts=3
|
||||
until docker build "${BUILD_ARGS[@]}" -f "${dockerfile}" -t "${tag}" .; do
|
||||
until docker build "${BUILD_ARGS[@]}" "$@" -f "${dockerfile}" -t "${tag}" .; do
|
||||
if [ "$attempt" -ge "$max_attempts" ]; then
|
||||
echo "docker build ${tag} failed after ${max_attempts} attempts" >&2
|
||||
exit 1
|
||||
@@ -43,9 +43,14 @@ build_with_retry() {
|
||||
done
|
||||
}
|
||||
|
||||
echo "==> build api + web"
|
||||
echo "==> remove legacy postgres resources if present"
|
||||
kubectl -n "${NS}" delete deploy tafsirquran-postgres --ignore-not-found
|
||||
kubectl -n "${NS}" delete svc tafsirquran-postgres --ignore-not-found
|
||||
kubectl -n "${NS}" delete pvc tafsirquran-pg-data --ignore-not-found
|
||||
|
||||
echo "==> build api + web (wasm/nginx)"
|
||||
build_with_retry Dockerfile.api "${API_IMAGE}"
|
||||
build_with_retry Dockerfile.web "${WEB_IMAGE}"
|
||||
build_with_retry Dockerfile.web "${WEB_IMAGE}" --build-arg "API_BASE=${PUBLIC_API}/"
|
||||
|
||||
echo "==> import images into k3s"
|
||||
docker save "${API_IMAGE}" | k3s ctr images import -
|
||||
@@ -54,21 +59,12 @@ docker save "${WEB_IMAGE}" | k3s ctr images import -
|
||||
echo "==> apply manifests"
|
||||
kubectl apply -f "${MANIFEST}"
|
||||
|
||||
# Keep public API URL for the Blazor host in sync with NodePort
|
||||
kubectl -n "${NS}" create configmap tafsirquran-web-env \
|
||||
--from-literal=ASPNETCORE_URLS='http://+:8080' \
|
||||
--from-literal=ApiBaseAddress="${PUBLIC_API}/" \
|
||||
--dry-run=client -o yaml | kubectl apply -f -
|
||||
|
||||
echo "==> wait postgres"
|
||||
kubectl -n "${NS}" rollout status deploy/tafsirquran-postgres --timeout=180s
|
||||
|
||||
echo "==> restart api + web"
|
||||
kubectl -n "${NS}" rollout restart deploy/tafsirquran-api deploy/tafsirquran-web
|
||||
kubectl -n "${NS}" rollout status deploy/tafsirquran-api --timeout=300s
|
||||
kubectl -n "${NS}" rollout status deploy/tafsirquran-api --timeout=360s
|
||||
kubectl -n "${NS}" rollout status deploy/tafsirquran-web --timeout=240s
|
||||
|
||||
kubectl -n "${NS}" get pods,svc -o wide
|
||||
kubectl -n "${NS}" get pods,svc,pvc -o wide
|
||||
|
||||
echo "==> smoke"
|
||||
curl -fsS --max-time 30 "http://127.0.0.1:30821/" | head -c 200; echo
|
||||
@@ -77,4 +73,5 @@ curl -fsS --max-time 30 -o /dev/null -w "web:%{http_code}\n" "http://127.0.0.1:3
|
||||
|
||||
echo "web → ${PUBLIC_WEB}/"
|
||||
echo "api → ${PUBLIC_API}/"
|
||||
echo "audio PVC: tafsirquran-audio (import via k8s/audio-import-job.yaml)"
|
||||
echo "deploy ok"
|
||||
|
||||
Reference in New Issue
Block a user