-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibreScriptBootstrap.sh
More file actions
executable file
·97 lines (75 loc) · 3.17 KB
/
LibreScriptBootstrap.sh
File metadata and controls
executable file
·97 lines (75 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
if [ "$1" == "--clean" ]; then
kubectl delete -f k8s/db/db-deployment.yml
kubectl delete -f k8s/back/backend-deployment.yml
kubectl delete -f k8s/front/frontend-deployment.yml
kubectl delete -f k8s/front/frontend-service.yml
kubectl delete -f k8s/back/backend-service.yml
exit 0
fi
if [ "$1" == "--log" ]; then
eval $(minikube docker-env)
docker build -f k8s/db/Dockerfile -t librescript-postgres:latest ./k8s/db/
docker build -f k8s/back/Dockerfile -t librescript-backend:latest .
docker build -f k8s/front/Dockerfile -t librescript-frontend:latest .
kubectl apply -f k8s/db/db-deployment.yml
kubectl wait --for=condition=available deployment/postgres-deployment --timeout=300s
kubectl apply -f k8s/back/backend-deployment.yml
kubectl apply -f k8s/back/backend-service.yml
kubectl apply -f k8s/front/frontend-deployment.yml
kubectl apply -f k8s/front/frontend-service.yml
kubectl wait --for=condition=available deployment/backend-deployment --timeout=300s
kubectl wait --for=condition=available deployment/frontend-deployment --timeout=300s
# Start services in background
minikube service frontend-service-external &
minikube service backend-service-external &
# Wait a moment for services to start
sleep 3
# Get URLs
FRONTEND_URL=$(minikube service frontend-service-external --url)
BACKEND_URL=$(minikube service backend-service-external --url)
echo "=== LibreScript Services ==="
echo "Frontend: $FRONTEND_URL"
echo "Backend API: $BACKEND_URL"
echo "============================"
# Open in browser (non-blocking)
if command -v open &> /dev/null; then
open "$FRONTEND_URL"
elif command -v xdg-open &> /dev/null; then
xdg-open "$FRONTEND_URL"
fi
exit 0
fi
# Build des images Docker
eval $(minikube docker-env)
docker build -f k8s/db/Dockerfile -t librescript-postgres:latest ./k8s/db/
docker build -f k8s/back/Dockerfile -t librescript-backend:latest .
docker build -f k8s/front/Dockerfile -t librescript-frontend:latest .
kubectl apply -f k8s/db/db-deployment.yml
kubectl wait --for=condition=available deployment/postgres-deployment --timeout=300s
kubectl apply -f k8s/back/backend-deployment.yml
kubectl apply -f k8s/back/backend-service.yml
kubectl apply -f k8s/front/frontend-deployment.yml
kubectl apply -f k8s/front/frontend-service.yml
kubectl wait --for=condition=available deployment/backend-deployment --timeout=300s
kubectl wait --for=condition=available deployment/frontend-deployment --timeout=300s
# Start services in background
minikube service frontend-service-external &
minikube service backend-service-external &
# Wait a moment for services to start
sleep 3
# Get URLs
FRONTEND_URL=$(minikube service frontend-service-external --url)
BACKEND_URL=$(minikube service backend-service-external --url)
clear
echo "=== LibreScript Services ==="
echo "Frontend: $FRONTEND_URL"
echo ""
echo "Backend API: $BACKEND_URL"
echo "============================"
# Open in browser (non-blocking)
if command -v open &> /dev/null; then
open "$FRONTEND_URL"
elif command -v xdg-open &> /dev/null; then
xdg-open "$FRONTEND_URL"
fi