feat: Update deployment configuration and add build & deploy script

This commit is contained in:
salah 2026-02-26 22:38:02 +01:00
parent b81d48a008
commit de270529dd
2 changed files with 49 additions and 3 deletions

46
deploy.sh Normal file
View File

@ -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"

View File

@ -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: /