Migrate to Blazor WASM, MSSQL platform DB, and durable audio PVC.
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:
2026-10-09 22:40:53 +03:30
parent 7f06856f45
commit ae746d65ba
32 changed files with 760 additions and 525 deletions
+12 -15
View File
@@ -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"
+171
View File
@@ -0,0 +1,171 @@
#!/usr/bin/env bash
# Download Tafsir Gooya (قطره چکانی) RAR archives, extract with password, delete RARs.
# Usage: AUDIO_DIR=/data/audio ./scripts/fetch-audio.sh
# or: ./scripts/fetch-audio.sh /path/to/audio
set -euo pipefail
AUDIO_DIR="${1:-${AUDIO_DIR:-/data/audio}}"
PASSWORD="${RAR_PASSWORD:-www.p30download.com}"
BASE_URL="https://pdn.sharezilla.ir/d/audio"
WORKDIR="${AUDIO_DIR}/.download"
mkdir -p "$AUDIO_DIR" "$WORKDIR"
need() { command -v "$1" >/dev/null 2>&1 || { echo "missing dependency: $1" >&2; exit 1; }; }
need curl
if ! command -v unrar >/dev/null 2>&1 && ! command -v 7z >/dev/null 2>&1; then
echo "need unrar or 7z" >&2
exit 1
fi
# slug list matching sharezilla filenames
declare -a SLUGS=(
"001.Tafsir.Gooya.Hamd"
"002.Tafsir.Gooya.Baqara"
"003.Tafsir.Gooya.Ale.imran"
"004.Tafsir.Gooya.Nisa"
"005.Tafsir.Gooya.Maeda"
"006.Tafsir.Gooya.Anaam"
"007.Tafsir.Gooya.Araf"
"008.Tafsir.Gooya.Anfal"
"009.Tafsir.Gooya.Tawba"
"010.Tafsir.Gooya.Yunus"
"011.Tafsir.Gooya.Hud"
"012.Tafsir.Gooya.Yusuf"
"013.Tafsir.Gooya.Rad"
"014.Tafsir.Gooya.Ibrahim"
"015.Tafsir.Gooya.Hijr"
"016.Tafsir.Gooya.Nahl"
"017.Tafsir.Gooya.Isra"
"018.Tafsir.Gooya.Kahf"
"019.Tafsir.Gooya.Maryam"
"020.Tafsir.Gooya.Taha"
"021.Tafsir.Gooya.Anbiya"
"022.Tafsir.Gooya.Hajj"
"023.Tafsir.Gooya.Mumenoon"
"024.Tafsir.Gooya.Noor"
"025.Tafsir.Gooya.Furqan"
"026.Tafsir.Gooya.Shuara"
"027.Tafsir.Gooya.Naml"
"028.Tafsir.Gooya.Qasas"
"029.Tafsir.Gooya.Ankaboot"
"030.Tafsir.Gooya.Room"
"031.Tafsir.Gooya.Luqman"
"032.Tafsir.Gooya.Sajda"
"033.Tafsir.Gooya.Ahzab"
"034.Tafsir.Gooya.Saba"
"035.Tafsir.Gooya.Fatir"
"036.Tafsir.Gooya.Yaseen"
"037.Tafsir.Gooya.Saaffat"
"038.Tafsir.Gooya.Sad"
"039.Tafsir.Gooya.Zumar"
"040.Tafsir.Gooya.Ghafir"
"041.Tafsir.Gooya.Fussilat"
"042.Tafsir.Gooya.Shura"
"043.Tafsir.Gooya.Zukhruf"
"044.Tafsir.Gooya.Dukhan"
"045.Tafsir.Gooya.Jathiya"
"046.Tafsir.Gooya.Ahqaf"
"047.Tafsir.Gooya.Muhammad"
"048.Tafsir.Gooya.Fath"
"049.Tafsir.Gooya.Hujaraat"
"050.Tafsir.Gooya.Qaf"
"051.Tafsir.Gooya.Dhariyat"
"052.Tafsir.Gooya.Tur"
"053.Tafsir.Gooya.Najm"
"054.Tafsir.Gooya.Qamar"
"055.Tafsir.Gooya.Ar-Rahman"
"056.Tafsir.Gooya.Waqia"
"057.Tafsir.Gooya.Hadid"
"058.Tafsir.Gooya.Mujadila"
"059.Tafsir.Gooya.Hashr"
"060.Tafsir.Gooya.Mumtahina"
"061.Tafsir.Gooya.Saff"
"062.Tafsir.Gooya.Jumua"
"063.Tafsir.Gooya.Munafiqoon"
"064.Tafsir.Gooya.Taghabun"
"065.Tafsir.Gooya.Talaq"
"066.Tafsir.Gooya.Tahrim"
"067.Tafsir.Gooya.Mulk"
"068.Tafsir.Gooya.Qalam"
"069.Tafsir.Gooya.Haaqqa"
"070.Tafsir.Gooya.Maarij"
"071.Tafsir.Gooya.Nooh"
"072.Tafsir.Gooya.Jinn"
"073.Tafsir.Gooya.Muzzammil"
"074.Tafsir.Gooya.muddaththir"
"075.Tafsir.Gooya.Qiyama"
"076.Tafsir.Gooya.Insan"
"077.Tafsir.Gooya.Mursalat"
"078.Tafsir.Gooya.Naba"
"079.Tafsir.Gooya.Naziat"
"080.Tafsir.Gooya.Abasa"
"081.Tafsir.Gooya.Takwir"
"082.Tafsir.Gooya.Infitar"
"083.Tafsir.Gooya.Mutaffifin"
"084.Tafsir.Gooya.Inshiqaq"
"085.Tafsir.Gooya.Brooj"
"086.Tafsir.Gooya.Tariq"
"087.Tafsir.Gooya.Ala"
"088.Tafsir.Gooya.Ghashiya"
"089.Tafsir.Gooya.Fajr"
"090.Tafsir.Gooya.Balad"
"091.Tafsir.Gooya.Shams"
"092.Tafsir.Gooya.Lail"
"093.Tafsir.Gooya.Dhuha"
"094.Tafsir.Gooya.Inshirah"
"095.Tafsir.Gooya.Tin"
"096.Tafsir.Gooya.Alaq"
"097.Tafsir.Gooya.Qadr"
"098.Tafsir.Gooya.Bayyina"
"099.Tafsir.Gooya.Zalzala"
"100.Tafsir.Gooya.Adiyat"
"101.Tafsir.Gooya.Qaria"
"102.Tafsir.Gooya.Takathur"
"103.Tafsir.Gooya.Asr"
"104.Tafsir.Gooya.Humaza"
"105.Tafsir.Gooya.Fil"
"106.Tafsir.Gooya.Quarish"
"107.Tafsir.Gooya.Maun"
"108.Tafsir.Gooya.kauther"
"109.Tafsir.Gooya.Kafiroon"
"110.Tafsir.Gooya.Nasr"
"111.Tafsir.Gooya.Masad"
"112.Tafsir.Gooya.Ikhlas"
"113.Tafsir.Gooya.Falaq"
"114.Tafsir.Gooya.Nas"
)
extract_one() {
local rar="$1"
local dest="$2"
mkdir -p "$dest"
if command -v unrar >/dev/null 2>&1; then
unrar x -o+ -p"${PASSWORD}" "$rar" "$dest/"
else
7z x -y "-p${PASSWORD}" "-o${dest}" "$rar"
fi
}
for slug in "${SLUGS[@]}"; do
num="${slug%%.*}"
out_dir="${AUDIO_DIR}/${num}"
# skip if already has audio
if find "$out_dir" -type f \( -iname '*.mp3' -o -iname '*.m4a' -o -iname '*.ogg' \) 2>/dev/null | grep -q .; then
echo "==> skip ${num} (already extracted)"
continue
fi
rar="${WORKDIR}/${slug}.rar"
url="${BASE_URL}/${slug}.rar"
echo "==> download ${slug}"
curl -fL --retry 5 --retry-delay 3 -o "$rar" "$url"
echo "==> extract ${slug} -> ${out_dir}"
extract_one "$rar" "$out_dir"
rm -f "$rar"
echo "==> done ${num}"
done
rmdir "$WORKDIR" 2>/dev/null || true
echo "audio import finished under ${AUDIO_DIR}"
find "$AUDIO_DIR" -type f \( -iname '*.mp3' -o -iname '*.m4a' \) | wc -l