Repository navigation
Expand file tree
/
Copy pathdeploy_on_cluster.sh
More file actions
executable file
·124 lines (109 loc) · 3.14 KB
/
Copy pathdeploy_on_cluster.sh
File metadata and controls
executable file
·124 lines (109 loc) · 3.14 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No cluster specified given."
exit -1
fi
source env.sh
echo
echo $HEADLINE
echo "Starting Traefik"
echo $HEADLINE
kubectl apply -f traefik/ingress-route.yaml
kubectl apply -f traefik/traefik-service.yaml
kubectl apply -f traefik/traefik-deployment.yaml
kubectl apply -f traefik/traefik-router.yaml
echo
echo $HEADLINE
echo "Starting Support"
echo $HEADLINE
kubectl create namespace uc4-support
kubectl apply -f support/imaginary.yaml
kubectl apply -f support/pdf.yaml
kubectl apply -f support/dashboard.yaml
kubectl apply -f support/metrics.yaml
kubectl apply -f support/cafiles.yaml
echo
echo $HEADLINE
echo "Starting Postgres"
echo $HEADLINE
kubectl create namespace postgres
kubectl apply -f postgres/postgres-config.yaml
kubectl apply -f postgres/postgres-configmap.yaml
kubectl apply -f postgres/postgres-storage.yaml
kubectl apply -f postgres/postgres-deployment.yaml
kubectl apply -f postgres/postgres-service.yaml
echo
echo $HEADLINE
echo "Starting Kafka"
echo $HEADLINE
kubectl create namespace kafka
kubectl apply -f kafka/kafka.yaml -n kafka
sleep 10
kubectl apply -f kafka/kafka-single.yaml -n kafka
echo
echo $HEADLINE
echo "Wait for Kafka & Postgres"
echo $HEADLINE
(
kubectl wait --for=condition=Ready pods --all --timeout=300s -n postgres
kubectl wait kafka/strimzi --for=condition=Ready --timeout=300s -n kafka
) || (
echo "Waiting error, trying again in a few seconds"
sleep 2
kubectl wait --for=condition=Ready pods --all --timeout=300s -n postgres
kubectl wait kafka/strimzi --for=condition=Ready --timeout=300s -n kafka
) || (
echo "Waiting error, trying again in a few seconds"
sleep 10
kubectl wait --for=condition=Ready pods --all --timeout=300s -n postgres
kubectl wait kafka/strimzi --for=condition=Ready --timeout=300s -n kafka
) || (
echo "Waiting failed"
exit -1
)
sleep 60
echo
echo $HEADLINE
echo "Set RBAC"
echo $HEADLINE
kubectl create namespace uc4-lagom
kubectl apply -f rbac.yaml
echo
echo $HEADLINE
echo "Load Files"
echo $HEADLINE
kubectl create configmap files --from-file=files/ -n uc4-lagom
echo
echo $HEADLINE
echo "Starting Services"
echo $HEADLINE
source versions_$1.sh
kubectl create secret generic application-secret --from-literal=secret="$(openssl rand -base64 48)" -n uc4-lagom
kubectl create secret generic jwt-secret --from-literal=secret="$(openssl rand -base64 48)" -n uc4-lagom
kubectl create secret generic uc4-master-secret --from-literal=secret="$(openssl rand -base64 48)" -n uc4-lagom
kubectl create secret generic uc4-kafka-salt --from-literal=secret="$(openssl rand -base64 48)" -n uc4-lagom
kubectl apply -f secrets
for filename in services/*.yaml
do
envsubst < $filename | kubectl apply -f -
done
echo
echo $HEADLINE
echo "Wait for Services"
echo $HEADLINE
(
kubectl wait --for=condition=Ready pods --all --timeout=300s -n uc4-lagom
) || (
echo "Waiting error, trying again in a few seconds"
sleep 2
kubectl wait --for=condition=Ready pods --all --timeout=300s -n uc4-lagom
) || (
echo "Waiting error, trying again in a few seconds"
sleep 10
kubectl wait --for=condition=Ready pods --all --timeout=300s -n uc4-lagom
) || (
echo "Waiting failed"
exit -1
)
sleep 60