zkt25/z2/start-app.sh
Andrii Pervashov aa03f35ae0 z2 upload
2025-04-10 08:22:24 +02:00

30 lines
817 B
Bash

#!/bin/bash
set -e
echo "Starting the app..."
kubectl apply -f namespace.yaml
kubectl apply -f statefulset.yaml
kubectl apply -f service.yaml
kubectl apply -f deployment.yaml
echo "Waiting for MongoDB..."
kubectl wait --for=condition=Ready pod -l app=mongodb -n expense-tracker --timeout=120s
echo "Waiting for Backend..."
kubectl wait --for=condition=Ready pod -l app=backend -n expense-tracker --timeout=120s
echo "Waiting for Frontend..."
kubectl wait --for=condition=Ready pod -l app=frontend -n expense-tracker --timeout=120s
echo "Waiting for connectivity...."
NODE_PORT=$(kubectl get service frontend-service -n expense-tracker -o jsonpath='{.spec.ports[0].nodePort}')
MINIKUBE_IP=$(minikube ip 2>/dev/null || echo "localhost")
echo "App started"
echo "Access it at: http://$MINIKUBE_IP:$NODE_PORT"