diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..5d48616 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,46 @@ +#!/bin/bash +set -e + +echo "=== Hadith Scholar API — Build & Deploy ===" + +# ── 1. Build ── +echo "" +echo "📦 Building Docker image..." +docker build -t axxs/hadith-api:latest . + +# ── 2. Push ── +echo "" +echo "⬆️ Pushing to Docker Hub..." +docker push axxs/hadith-api:latest + +# ── 3. Deploy ── +echo "" +echo "🚀 Deploying to Kubernetes..." + +# Create namespace (idempotent) +# kubectl create namespace api --dry-run=client -o yaml | kubectl apply -f - + +# example: namespace "default" +# ⚠️ EDIT THE SECRET VALUES FIRST! +# Open k8s/deployment.yaml and replace REPLACE_ME in the Secret + +kubectl apply -f k8s/deployment.yaml + +# ── 4. Wait for rollout ── +echo "" +echo "⏳ Waiting for rollout..." +kubectl rollout status deployment/hadith-api -n api --timeout=120s + +# ── 5. Verify ── +echo "" +echo "✅ Checking pods..." +kubectl get pods -n api -l app=hadith-api + +echo "" +echo "🌐 API should be available at:" +echo " https://hadith-api.betelgeusebytes.io" +echo " https://hadith-api.betelgeusebytes.io/docs (Swagger)" +echo " https://hadith-api.betelgeusebytes.io/redoc (ReDoc)" +echo "" +echo "📋 Quick test:" +echo " curl https://hadith-api.betelgeusebytes.io/health" diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index 41e0e6d..a78848c 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -34,7 +34,7 @@ spec: spec: containers: - name: hadith-api - image: registry.betelgeusebytes.io/hadith-api:latest # adjust to your registry + image: axxs/hadith-api:latest # adjust to your registry ports: - containerPort: 8000 env: @@ -126,10 +126,10 @@ spec: ingressClassName: nginx tls: - hosts: - - api.betelgeusebytes.io + - hadith-api.betelgeusebytes.io secretName: wildcard-betelgeusebytes-tls rules: - - host: api.betelgeusebytes.io + - host: hadith-api.betelgeusebytes.io http: paths: - path: /