-
Notifications
You must be signed in to change notification settings - Fork 63
/
3_install_microservices_native.sh
executable file
·47 lines (35 loc) · 1.91 KB
/
3_install_microservices_native.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
44
45
46
47
#!/bin/bash
# https://redhat-developer-demos.github.io/istio-tutorial/istio-tutorial/1.0.0/1setup.html
# https://redhat-developer-demos.github.io/istio-tutorial/istio-tutorial/1.0.0/2deploy-microservices.html
# assumes (kubectl or oc) and istioctl and mvn in the PATH
# assumes the 'docker' tool points to minikube/minishift
# assumes this script is in a directory called 'scripts-istio'
# which is a peer of 'istio-tutorial'
# assumes you have 'kubens tutorial' or 'oc project tutorial'
export GRAALVM_HOME=~/tools/graalvm-ce-1.0.0-rc15/Contents/Home/
kubectl create namespace tutorial
# oc adm policy add-scc-to-user privileged -z default -n tutorial
kubens tutorial
# Customer
cd ../istio-tutorial/customer/java/quarkus
mvn package -Pnative -Dnative-image.docker-build=true -DskipTests
docker build -f src/main/docker/Dockerfile.native -t example/customer .
kubectl apply -f <(istioctl kube-inject -f ../../kubernetes/Deployment.yml) -n tutorial
kubectl create -f ../../kubernetes/Service.yml -n tutorial
# for minikube, open a NodePort
kubectl patch service/customer -p '{"spec":{"type":"NodePort"}}' -n tutorial
# for minishift, create a Route
# oc expose service customer
# Preference
cd ../../../preference/java/quarkus
mvn package -Pnative -Dnative-image.docker-build=true -DskipTests
docker build -f src/main/docker/Dockerfile.native -t example/preference:v1 .
kubectl apply -f <(istioctl kube-inject -f ../../kubernetes/Deployment.yml) -n tutorial
kubectl create -f ../../kubernetes/Service.yml -n tutorial
# Recommendation
cd ../../../recommendation/java/quarkus
mvn package -Pnative -Dnative-image.docker-build=true -DskipTests
docker build -f src/main/docker/Dockerfile.native -t example/recommendation:v1 .
kubectl apply -f <(istioctl kube-inject -f ../../kubernetes/Deployment.yml) -n tutorial
kubectl create -f ../../kubernetes/Service.yml -n tutorial
kubectl create -f ../../../customer/kubernetes/Gateway.yml -n tutorial