-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
129 lines (114 loc) · 5.49 KB
/
deploy.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
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
125
126
127
128
129
#!/bin/zsh
scriptPath=${0:a:h}
# Login with kubeadmin
$(crc console --credentials | grep kubeadmin | awk -F "'" '{print $2}')
# Update scc to enable any user id except root user's
if (! oc get serviceaccount runasnonroot); then
oc create serviceaccount runasnonroot
oc adm policy add-scc-to-user nonroot -z runasnonroot --as system:admin
fi
# Update scc to enable any user id
if (! oc get serviceaccount runasroot); then
oc create serviceaccount runasroot
oc adm policy add-scc-to-user anyuid -z runasroot --as system:admin
fi
# Login with developer
$(crc console --credentials | grep developer | awk -F "'" '{print $2}')
# Switch to project
oc project task-manager
applyFileList=""
for fileName in "$scriptPath"/deployment/*.yaml; do
applyFileList+="$fileName,"
done
oc apply -f "${applyFileList:0:-1}"
oc delete all -l 'app=user-writer'
oc new-app user-writer \
--env='JAVA_APP_JAR=/tmp/artifacts/m2/com/corp/concepts/taskmanager/services/user-writer/0.0.1-SNAPSHOT/user-writer-0.0.1-SNAPSHOT.jar' \
--env='IDP_PROT=https' \
--env='IDP_HOST=idp-task-manager.apps-crc.testing' \
--env='IDP_PORT=443' \
--env='SR_HOST=schemaregistry' \
--env='SERVER_PORT=8080' \
--env='BROKER_1=kafka-broker-1:19091' \
--env='BROKER_2=kafka-broker-2:19092' \
--env='BROKER_3=kafka-broker-3:19093' \
--env='TZ=Europe/Istanbul' \
--env='JAVA_OPTS=-Djavax.net.ssl.trustStore=/mnt/trust/cacerts -Djavax.net.ssl.trustStorePassword=changeit'
oc patch deployment/user-writer -p '{"metadata":{"labels":{"app.kubernetes.io/part-of": "user"}}}'
oc set volume deployment/user-writer --add --name idp-trust-volume -t secret -m /mnt/trust --secret-name=idp-trust --overwrite
oc delete all -l 'app=user-reader'
oc new-app user-reader \
--env='JAVA_APP_JAR=/tmp/artifacts/m2/com/corp/concepts/taskmanager/services/user-reader/0.0.1-SNAPSHOT/user-reader-0.0.1-SNAPSHOT.jar' \
--env='IDP_PROT=https' \
--env='IDP_HOST=idp-task-manager.apps-crc.testing' \
--env='IDP_PORT=443' \
--env='SERVER_PORT=8080' \
--env='DB_HOST=appdb' \
--env='DB_PORT=5432' \
--env='DB_NAME=appdb' \
--env='DB_USER=dbuser' \
--env='DB_PASS=db1234' \
--env='TZ=Europe/Istanbul' \
--env='JAVA_OPTS=-Djavax.net.ssl.trustStore=/mnt/trust/cacerts -Djavax.net.ssl.trustStorePassword=changeit'
oc patch deployment/user-reader -p '{"metadata":{"labels":{"app.kubernetes.io/part-of": "user"}}}'
oc set volume deployment/user-reader --add --name idp-trust-volume -t secret -m /mnt/trust --secret-name=idp-trust --overwrite
oc delete all -l 'app=task-writer'
oc new-app task-writer \
--env='JAVA_APP_JAR=/tmp/artifacts/m2/com/corp/concepts/taskmanager/services/task-writer/0.0.1-SNAPSHOT/task-writer-0.0.1-SNAPSHOT.jar' \
--env='IDP_PROT=https' \
--env='IDP_HOST=idp-task-manager.apps-crc.testing' \
--env='IDP_PORT=443' \
--env='SR_HOST=schemaregistry' \
--env='SERVER_PORT=8080' \
--env='BROKER_1=kafka-broker-1:19091' \
--env='BROKER_2=kafka-broker-2:19092' \
--env='BROKER_3=kafka-broker-3:19093' \
--env='TZ=Europe/Istanbul' \
--env='JAVA_OPTS=-Djavax.net.ssl.trustStore=/mnt/trust/cacerts -Djavax.net.ssl.trustStorePassword=changeit'
oc patch deployment/task-writer -p '{"metadata":{"labels":{"app.kubernetes.io/part-of": "task"}}}'
oc set volume deployment/task-writer --add --name idp-trust-volume -t secret -m /mnt/trust --secret-name=idp-trust --overwrite
oc delete all -l 'app=task-reader'
oc new-app task-reader \
--env='JAVA_APP_JAR=/tmp/artifacts/m2/com/corp/concepts/taskmanager/services/task-reader/0.0.1-SNAPSHOT/task-reader-0.0.1-SNAPSHOT.jar' \
--env='IDP_PROT=https' \
--env='IDP_HOST=idp-task-manager.apps-crc.testing' \
--env='IDP_PORT=443' \
--env='SERVER_PORT=8080' \
--env='DB_HOST=appdb' \
--env='DB_PORT=5432' \
--env='DB_NAME=appdb' \
--env='DB_USER=dbuser' \
--env='DB_PASS=db1234' \
--env='TZ=Europe/Istanbul' \
--env='JAVA_OPTS=-Djavax.net.ssl.trustStore=/mnt/trust/cacerts -Djavax.net.ssl.trustStorePassword=changeit'
oc patch deployment/task-reader -p '{"metadata":{"labels":{"app.kubernetes.io/part-of": "task"}}}'
oc set volume deployment/task-reader --add --name idp-trust-volume -t secret -m /mnt/trust --secret-name=idp-trust --overwrite
oc delete all -l 'app=task-processor'
oc new-app task-processor \
--env='JAVA_APP_JAR=/tmp/artifacts/m2/com/corp/concepts/taskmanager/services/task-processor/0.0.1-SNAPSHOT/task-processor-0.0.1-SNAPSHOT.jar' \
--env='IDP_PROT=https' \
--env='IDP_HOST=idp-task-manager.apps-crc.testing' \
--env='IDP_PORT=443' \
--env='SR_HOST=schemaregistry' \
--env='SERVER_PORT=8080' \
--env='BROKER_1=kafka-broker-1:19091' \
--env='BROKER_2=kafka-broker-2:19092' \
--env='BROKER_3=kafka-broker-3:19093' \
--env='STATE_DIR_ROOT=/var/lib/ks-state' \
--env='TZ=Europe/Istanbul' \
--env='JAVA_OPTS=-Djavax.net.ssl.trustStore=/mnt/trust/cacerts -Djavax.net.ssl.trustStorePassword=changeit'
oc patch deployment/task-processor -p '{"metadata":{"labels":{"app.kubernetes.io/part-of": "task"}}}'
oc set volume deployment/task-processor --add --name idp-trust-volume -t secret -m /mnt/trust --secret-name=idp-trust --overwrite
oc set volume deployment/task-processor --add --name tp-ks-state-volume -t pvc --claim-size=1G -m /var/lib/ks-state --overwrite
oc expose service pgadmin
oc expose service ui
oc expose service schemaregistry
oc expose service restproxy
oc expose service kafkaconnect
oc expose service ksql
oc expose service kmonitor
oc expose service user-writer
oc expose service user-reader
oc expose service task-writer
oc expose service task-reader
oc expose service task-processor