Modification script files for deployment of the webapp with Kubernetes
This commit is contained in:
parent
823b9df176
commit
3444a94c5f
@ -1,4 +1,20 @@
|
||||
#!/bin/bash
|
||||
# Prepare the app: create the storage directory and build the Docker images
|
||||
set -e
|
||||
|
||||
echo "╔══════════════════════════════════════════╗"
|
||||
echo "║ Vigimétéo – Prepare App ║"
|
||||
echo "╚══════════════════════════════════════════╝"
|
||||
echo "Preparing app..."
|
||||
docker compose build
|
||||
echo "App is prepared."
|
||||
|
||||
# 1 - Create the directory used by the PersistentVolume
|
||||
mkdir -p ~/vigimeteo-db-data
|
||||
|
||||
# 2 - Build Docker images
|
||||
docker build -t vigimeteo-backend:latest ./Back-end
|
||||
docker build -t vigimeteo-frontend:latest ./Front-end
|
||||
|
||||
echo ""
|
||||
echo "════════════════════════════════════════════"
|
||||
echo " Preparation complete! Run ./start-app.sh"
|
||||
echo "════════════════════════════════════════════"
|
||||
@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo "Removed app."
|
||||
docker compose down -v --rmi local
|
||||
@ -1,4 +1,39 @@
|
||||
#!/bin/bash
|
||||
echo "Running app ..."
|
||||
docker compose up -d
|
||||
echo "The app is available at http://localhost:5000"
|
||||
# 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"
|
||||
|
||||
@ -1,3 +1,22 @@
|
||||
#!/bin/bash
|
||||
# Remove all Kubernetes objects for Vigimeteo
|
||||
set -e
|
||||
|
||||
echo "╔══════════════════════════════════════════╗"
|
||||
echo "║ Vigimétéo – Stop App ║"
|
||||
echo "╚══════════════════════════════════════════╝"
|
||||
|
||||
echo "Stopping app..."
|
||||
docker compose stop
|
||||
|
||||
# 1- Deleting the namespace removes everything inside it automatically
|
||||
kubectl delete namespace vigimeteo --ignore-not-found
|
||||
|
||||
# 2 - The PersistentVolume is cluster-scoped so it must be deleted separately
|
||||
kubectl delete pv vigimeteo-db-pv --ignore-not-found
|
||||
echo ""
|
||||
echo "════════════════════════════════════════════"
|
||||
echo " All Vigimeteo Kubernetes objects removed."
|
||||
echo " Note: ~/vigimeteo-db-data was NOT deleted."
|
||||
echo " Run: rm -rf ~/vigimeteo-db-data to clean up."
|
||||
echo "════════════════════════════════════════════"
|
||||
echo "App stopped."
|
||||
|
||||
Loading…
Reference in New Issue
Block a user