-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup_minikube.sh
executable file
·44 lines (34 loc) · 2.07 KB
/
setup_minikube.sh
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
#!/bin/sh
command -v minikube >/dev/null 2>&1 || { echo >&2 "minikube not found, aborting..."; exit 1; }
command -v kubectl >/dev/null 2>&1 || { echo >&2 "kubectl not found, aborting..."; exit 1; }
command -v helm >/dev/null 2>&1 || { echo >&2 "helm not found, aborting..."; exit 1; }
minikube start --memory 4000 --disk-size 10000
# Make use of the minikube Docker environment
eval $(minikube docker-env)
docker build -t payment-service -f Dockerfile ./payment-service
docker build --cache-from payment-service -t stock-service -f Dockerfile ./stock-service
docker build --cache-from payment-service -t order-service -f Dockerfile ./order-service
docker build --cache-from payment-service -t user-service -f Dockerfile ./user-service
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add traefik https://containous.github.io/traefik-helm-chart
helm repo update
helm install postgresql --set postgresqlPassword=servicedev bitnami/postgresql
helm install cassandra --set dbUser.password=servicedev bitnami/cassandra
helm install traefik traefik/traefik
# Give the databases some time to start
sleep 20
# Add databases for the different services
kubectl run postgresql-client --rm --tty -i --restart='Never' --namespace default --image bitnami/postgresql \
--env="PGPASSWORD=servicedev" --command -- psql --host postgresql -U postgres -d postgres -p 5432 \
-c "create database payment_service" -c "create database stock_service" \
-c "create database order_service" -c "create database user_service"
# Deploy the PostgreSQL dev version of the services
kubectl apply -f payment-service/k8s/dev-deployment-psql.yaml
kubectl apply -f stock-service/k8s/dev-deployment-psql.yaml
kubectl apply -f order-service/k8s/dev-deployment-psql.yaml
kubectl apply -f user-service/k8s/dev-deployment-psql.yaml
# Deploy the Cassandra dev version of the services
kubectl apply -f payment-service/k8s/dev-deployment-cass.yaml
kubectl apply -f stock-service/k8s/dev-deployment-cass.yaml
kubectl apply -f order-service/k8s/dev-deployment-cass.yaml
kubectl apply -f user-service/k8s/dev-deployment-cass.yaml