feat: Update deployment configuration and add build & deploy script
This commit is contained in:
parent
b81d48a008
commit
de270529dd
|
|
@ -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"
|
||||
|
|
@ -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: /
|
||||
|
|
|
|||
Loading…
Reference in New Issue