-
Notifications
You must be signed in to change notification settings - Fork 2
/
devfile-sdi.yaml
301 lines (270 loc) · 7.97 KB
/
devfile-sdi.yaml
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
schemaVersion: 2.2.0
metadata:
name: SDI
#attributes:
# controller.devfile.io/storage-type: ephemeral
components:
- name: tools
container:
image: alm-repos.sogei.it/devfile/universal-developer-image:ubi8-4407fa4_v2.4
# env:
# - name: spring_profiles_active
# value: devspaces
# - name: MAVEN_OPTS
# value: "-Dmaven.wagon.http.ssl.insecure=true"
endpoints:
- exposure: none
name: debug
protocol: tcp
targetPort: 5005
- exposure: public
name: app
protocol: http
targetPort: 8080
path: /
# - exposure: public
# name: ms-nir
# protocol: http
# targetPort: 5001
# path: /nir/1
volumeMounts:
- name: m2
path: /home/user/.m2
memoryLimit: 6G
memoryRequest: 2G
cpuLimit: 1500m
cpuRequest: 400m
mountSources: true
- name: m2
volume:
size: 2G
# - name: kafka
# openshift:
# uri: 'https://raw.githubusercontent.com/pietroaragona/openshift-devspaces-assets/main/kafka-deployment-v0.3.yaml'
# endpoints:
# - name: kafka-broker
# targetPort: 9092
# - name: kafka-ui
# targetPort: 8888
# path: /
# - name: kafka
# kubernetes:
# deployByDefault: true
# inlined: |
# apiVersion: v1
# kind: Pod
# metadata:
# name: kafka
# spec:
# containers:
# - image: docker.io/lsnidero/kafka
# name: kafka
# ports:
# - name: broker-9092
# containerPort: 9092
# - name: kafka
# openshift:
# uri: 'kafka-deployment-v0.3.yaml'
# endpoints:
# - name: kafka-broker
# targetPort: 9092
# - name: kafka-ui
# targetPort: 8888
# path: /
- name: kafka
container:
image: docker.io/lsnidero/kafka
endpoints:
- name: kafka-broker
targetPort: 9092
- name: zookeeper
targetPort: 2181
exposure: internal
volumeMounts:
- name: zookeeper-vol
path: /var/lib/zookeeper
memoryLimit: 768Mi
mountSources: true
# - name: nginx
# kubernetes:
# deployByDefault: true
# inlined: |
# apiVersion: apps/v1
# kind: Deployment
# metadata:
# name: nginx
# spec:
# selector:
# matchLabels:
# app: nginx
# template:
# metadata:
# labels:
# app: nginx
# spec:
# containers:
# - name: nginx
# image: nginxinc/nginx-unprivileged
# ports:
# - containerPort: 80
- name: zookeeper-vol
volume:
size: 1G
ephemeral: true
- name: kafka-ui
container:
image: provectuslabs/kafka-ui:v0.6.1
endpoints:
- name: kafka-ui
targetPort: 8888
memoryLimit: 1024Mi
cpuLimit: 500m
cpuRequest: 10m
env:
- name: KAFKA_CLUSTERS_0_NAMEl
value: local
- name: KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS
value: localhost:9092
- name: KAFKA_CLUSTERS_0_ZOOKEEPER
value: localhost:2181
- name: KAFKA_CLUSTERS_0_READONLY
value: "false"
- name: SERVER_PORT
value: "8888"
- name: mongo
container:
image: alm-repos.sogei.it/devfile/mongo-rs:5_v1.0.6
env:
- name: MONGO_INITDB_ROOT_USERNAME
value: "root"
- name: MONGO_INITDB_ROOT_PASSWORD
value: "MyPassword"
- name: MONGO_INITDB_USERNAME
value: "sdiuser"
- name: MONGO_INITDB_PASSWORD
value: "sdiuser"
- name: MONGO_INITDB_DATABASE
value: "sdi"
endpoints:
- name: mongo-svc
targetPort: 27017
exposure: internal
protocol: tcp
volumeMounts:
- name: mongo-vol
path: /data/db
memoryRequest: 64M
memoryLimit: 768M
cpuRequest: 10m
cpuLimit: 500m
- name: mongo-vol
volume:
size: 1G
# - name: oracle
# container:
# image: 'alm-repos.sogei.it/ptt/oracle-init:1.1'
# command:
# - sleep
# - infinity
# memoryLimit: 768Mi
# mountSources: true
commands:
- id: setup-environment
exec:
label: Task automatico
component: tools
workingDir: ${PROJECTS_ROOT}
commandLine: |
# set java version
. /home/user/.sdkman/bin/sdkman-init.sh
JAVA_V=17.0.3-tem
sdk install java $JAVA_V
sdk default java $JAVA_V
sdk install quarkus 2.16.6.Final
# configure settings.xml and .npmrc
setup_configurations_files(){
MVN_SETTINGS_REMOTE="https://alm-repos.sogei.it/repository/codeready-plugins/assets/settings-https-v3.xml"
mkdir -p /home/user/.m2
wget -q --no-check-certificate $MVN_SETTINGS_REMOTE -O /home/user/.m2/settings.xml
echo registry=https://alm-repos.sogei.it/repository/npm-group/ > /home/user/.npmrc
echo cafile=/etc/pki/ca-trust/source/anchors/alm-repos.sogei.it-ca.crt >> /home/user/.npmrc
}
setup_configurations_files
# configure git credential.helper
git config --global credential.helper 'cache --timeout 36000'
- id: download-repos
exec:
label: 0.1 - Initial Environment Setup
component: tools
workingDir: ${PROJECTS_ROOT}
commandLine: curl -s https://alm-repos.sogei.it/repository/codeready-plugins/assets/scripts/sdi/setup-sdi-v2.sh | bash
# - id: setup-databases
# exec:
# label: 0.2 Initial Microservices Databases Setup
# component: oracle
# commandLine: |
# ORACLE_SYS_PASSWORD=ptt_database
# ORACLE_DB_NAME=ptt_database
#
# DB_HOST=oracle.common-ptt
# DB_USER_PREFIX=${DEVWORKSPACE_NAMESPACE//-/}
# DB_PASSWORD=changeit
#
# function configure_microservice_schema {
#
# MICROSERVICE=$1
# DB_USER=${DB_USER_PREFIX}_${MICROSERVICE//-/}
#
# /opt/oracle/createDevUser.sh ${DB_HOST} \
# ${ORACLE_SYS_PASSWORD} ${ORACLE_DB_NAME} \
# ${DB_USER} ${DB_PASSWORD}
#
# echo "Configuration successful for Microservice ${MICROSERVICE}!"
# echo "Username: ${DB_USER}"
# echo "Password: ${DB_PASSWORD}"
#
# SPRING_BOOT_TEST_FOLDER=${PROJECTS_ROOT}/${MICROSERVICE}/src/test/resources
# SPRING_BOOT_TEST_PROPERTIES_FILE=${SPRING_BOOT_TEST_FOLDER}/application-devspaces.properties
# SPRING_BOOT_MAIN_FOLDER=${PROJECTS_ROOT}/${MICROSERVICE}/src/main/resources
# SPRING_BOOT_MAIN_PROPERTIES_FILE=${SPRING_BOOT_MAIN_FOLDER}/application-devspaces.properties
# mkdir -p ${SPRING_BOOT_TEST_FOLDER} ${SPRING_BOOT_MAIN_FOLDER}
#
# cat <<EOF > ${SPRING_BOOT_TEST_PROPERTIES_FILE}
# spring.datasource.url=jdbc:oracle:thin:@${DB_HOST}:1521/${ORACLE_DB_NAME}
# spring.datasource.username=${DB_USER}
# spring.datasource.password=${DB_PASSWORD}
# spring.kafka.bootstrap-servers=localhost:9092
# EOF
#
# cp ${SPRING_BOOT_TEST_PROPERTIES_FILE} ${SPRING_BOOT_MAIN_PROPERTIES_FILE}
# }
#
# configure_microservice_schema ms-nir
# configure_microservice_schema ms-doc
- id: run-debug
exec:
label: 1 - Run Debug
component: tools
workingDir: ${PROJECT_SOURCE}
commandLine: |
echo TODO
# mvn spring-boot:run -DskipTests \
# -Dspring-boot.run.jvmArguments='-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005,quiet=y'
group:
kind: run
isDefault: true
- id: composite-initial-setup
composite:
commands:
- install-plugins
- setup-environment
- setup-databases
#events:
# postStart:
# - composite-initial-setup
## - install-plugins
## - setup-environment
## - setup-databases
events:
postStart:
- setup-environment