zkt26/z2/start-app.sh

40 lines
1.6 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Deploy all Kubernetes objects for Vigimeteo
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
NS="vigimeteo"
echo "╔══════════════════════════════════════════╗"
echo "║ Vigimétéo Start App ║"
echo "╚══════════════════════════════════════════╝"
echo "Starting app..."
# 1. Create the namespace
kubectl apply -f namespace.yaml
# 2. Create the ConfigMap from the SQL init script, then apply storage and database
kubectl create configmap vigimeteo-db-init \
--from-file=init.sql=sql/init_db.sql \
-n vigimeteo \
--dry-run=client -o yaml | kubectl apply -f -
kubectl apply -f statefulset.yaml
# 3. Wait for the database to be ready before starting the backend
echo "Waiting for PostgreSQL to be ready..."
kubectl rollout status statefulset/vigimeteo-db -n vigimeteo --timeout=120s
# 4. Deploy the backend and frontend
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
# ── Summary ───────────────────────────────────────────────────────────────────
echo ""
echo "════════════════════════════════════════════"
echo " All objects deployed in namespace: $NS"
echo ""
kubectl get all -n "$NS"
echo ""
echo "App deployed! Available at http://localhost:30500"