File tree Expand file tree Collapse file tree 7 files changed +133
-0
lines changed
Expand file tree Collapse file tree 7 files changed +133
-0
lines changed Original file line number Diff line number Diff line change 1+ apiVersion : v1
2+ kind : ConfigMap
3+ metadata :
4+ name : chatsphere-config
5+ data :
6+ PORT : " 5000"
7+ BASE_URL : " /api/v1"
8+ CLIENT_URL : " "
9+ SALT_ROUNDS : " 10"
10+ DEPLOYMENT_API_URL : " https://chatsphere-api.onrender.com"
11+ EMAIL_ENGINE_SMTP_HOST : " smtp.gmail.com"
12+ EMAIL_ENGINE_SMTP_PORT : " 587"
13+ CLOUDINARY_CLOUD_NAME : " dvi7vuujv"
14+ CLOUDINARY_API_KEY : " 924453735929192"
Original file line number Diff line number Diff line change 1+ apiVersion : apps/v1
2+ kind : Deployment
3+ metadata :
4+ name : chatsphere-api
5+ spec :
6+ replicas : 2
7+ selector :
8+ matchLabels :
9+ app : chatsphere-api
10+ template :
11+ metadata :
12+ labels :
13+ app : chatsphere-api
14+ spec :
15+ containers :
16+ - name : chatsphere-api
17+ image : bishoysedra/chatsphere_api:latest
18+ ports :
19+ - containerPort : 5000
20+ envFrom :
21+ - configMapRef :
22+ name : chatsphere-config
23+ - secretRef :
24+ name : chatsphere-secrets
Original file line number Diff line number Diff line change 1+ apiVersion : v1
2+ kind : Service
3+ metadata :
4+ name : chatsphere-service
5+ spec :
6+ selector :
7+ app : chatsphere-api
8+ ports :
9+ - protocol : TCP
10+ port : 80
11+ targetPort : 5000
12+ type : ClusterIP
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ NAMESPACE=default # change if you used another namespace
5+
6+ echo " 🧹 Cleaning up Chatsphere resources from namespace: $NAMESPACE "
7+
8+ # Delete Deployment and Service
9+ kubectl delete deployment chatsphere-api -n $NAMESPACE --ignore-not-found
10+ kubectl delete service chatsphere-service -n $NAMESPACE --ignore-not-found
11+
12+ # Delete ConfigMap & Secret
13+ kubectl delete configmap chatsphere-config -n $NAMESPACE --ignore-not-found
14+ kubectl delete secret chatsphere-secrets -n $NAMESPACE --ignore-not-found
15+
16+ # Delete Ingress if exists
17+ kubectl delete ingress chatsphere-ingress -n $NAMESPACE --ignore-not-found
18+
19+ echo " ✅ Cleanup finished. Current resources:"
20+ kubectl get all -n $NAMESPACE
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ NAMESPACE=default # change if using custom namespace
5+ SECRET_NAME=chatsphere-secrets
6+
7+ echo " 🚀 Starting Kubernetes deployment in namespace: $NAMESPACE "
8+
9+ # 1. Apply ConfigMap
10+ echo " 📦 Applying ConfigMap..."
11+ kubectl apply -f k8s/configmap.yaml -n $NAMESPACE
12+
13+ # 2. Create/Update Secret from .env
14+ if [ ! -f .env ]; then
15+ echo " ❌ .env file not found! Please create one with your secrets."
16+ exit 1
17+ fi
18+
19+ echo " 🔑 Creating/Updating Kubernetes Secret from .env..."
20+ kubectl delete secret $SECRET_NAME -n $NAMESPACE --ignore-not-found
21+ kubectl create secret generic $SECRET_NAME -n $NAMESPACE --from-env-file=.env
22+
23+ # 3. Apply Deployment & Service
24+ echo " ⚙️ Applying Deployment and Service..."
25+ kubectl apply -f k8s/deployment.yaml -n $NAMESPACE
26+ kubectl apply -f k8s/service.yaml -n $NAMESPACE
27+
28+ # 4. Apply Ingress if exists
29+ if [ -f k8s/ingress.yaml ]; then
30+ echo " 🌍 Applying Ingress..."
31+ kubectl apply -f k8s/ingress.yaml -n $NAMESPACE
32+ fi
33+
34+ # 5. Wait for pods
35+ echo " ⏳ Waiting for pods to become ready..."
36+ kubectl rollout status deployment/chatsphere-api -n $NAMESPACE
37+
38+ # 6. Show resources
39+ echo " ✅ Deployment finished. Current resources:"
40+ kubectl get all -n $NAMESPACE
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ NAMESPACE=default # change if using custom namespace
5+ LOCAL_PORT=5000 # port on localhost
6+ SERVICE_PORT=80 # service port (from service.yaml)
7+
8+ echo " 🔌 Starting port-forward from localhost:$LOCAL_PORT -> service/chatsphere-service:$SERVICE_PORT "
9+ echo " 👉 Press Ctrl+C to stop."
10+
11+ kubectl port-forward service/chatsphere-service $LOCAL_PORT :$SERVICE_PORT -n $NAMESPACE
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ echo " 🔄 Restarting Chatsphere Kubernetes deployment..."
5+
6+ # Step 1: Cleanup old resources
7+ ./cleanup.sh
8+
9+ # Step 2: Deploy fresh resources
10+ ./deploy.sh
11+
12+ echo " ✅ Restart complete!"
You can’t perform that action at this time.
0 commit comments