-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsuperheroes.yaml
620 lines (575 loc) · 26 KB
/
superheroes.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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
# fights-db: podman run --replace -d -p 27017:27017 --name fights-db -e MONGO_INITDB_DATABASE=fights -e MONGO_INITDB_ROOT_USERNAME=super -e MONGO_INITDB_ROOT_PASSWORD=super -v ./rest-fights/deploy/db-init/initialize-database.js:/docker-entrypoint-initdb.d/1-init-db.js mongo:7.0
# heroes-db: podman run -d -p 5432:5432 --name heroes-db -e POSTGRES_USER=superman -e POSTGRES_PASSWORD=superman -e POSTGRES_DB=heroes_database -v ./rest-heroes/deploy/db-init/initialize-tables.sql:/docker-entrypoint-initdb.d/1-init-tables.sql --replace mirror.gcr.io/library/postgres:16
# villains-db: podman run -d -p 5433:5432 --name villains-db -e POSTGRES_USER=superbad -e POSTGRES_PASSWORD=superbad -e POSTGRES_DB=villains_database -v ./rest-villains/deploy/db-init/initialize-tables.sql:/docker-entrypoint-initdb.d/1-init-tables.sql --replace mirror.gcr.io/library/postgres:16
# apicurio: podman run -d -p 8086:8086 --name apicurio -e REGISTRY_AUTH_ANONYMOUS_READ_ACCESS_ENABLED="true" -e QUARKUS_HTTP_PORT=8086 --replace quay.io/apicurio/apicurio-registry-mem:2.6.5.Final
# locations-db: podman run -d -p 3306:3306 --name locations-db -e MARIADB_USER=locations -e MARIADB_PASSWORD=locations -e MARIADB_DATABASE=locations_database -e MARIADB_ROOT_PASSWORD=locations -e MARIADB_SKIP_TEST_DB=yes --replace mariadb:11.5
# fights-kafka(deps: apicurio): podman run -d -p 9092:9092 --name fights-kafka -e LOG_DIR=/tmp/logs -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092 --replace --entrypoint sh quay.io/strimzi/kafka:0.43.0-kafka-3.8.0 -c 'export CLUSTER_ID=$(bin/kafka-storage.sh random-uuid) && bin/kafka-storage.sh format -t ${CLUSTER_ID} -c config/kraft/server.properties && bin/kafka-server-start.sh config/kraft/server.properties --override advertised.listeners=${KAFKA_ADVERTISED_LISTENERS}'
# rest-heroes-native(deps: heroes-db): podman run -d -p 8083:8083 --name rest-heroes-native -e QUARKUS_DATASOURCE_REACTIVE_URL=postgresql://localhost:5432/heroes_database -e QUARKUS_HIBERNATE_ORM_DATABASE_GENERATION=validate -e QUARKUS_DATASOURCE_USERNAME=superman -e QUARKUS_DATASOURCE_PASSWORD=superman -e QUARKUS_HIBERNATE_ORM_SQL_LOAD_SCRIPT=no-file -e QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="http://otel-collector:4317" --network host --replace quay.io/quarkus-super-heroes/rest-heroes:native-latest
# rest-villains-native(deps: villains-db): podman run -d -p 8084:8084 --name rest-villains-native -e QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://localhost:5433/villains_database -e QUARKUS_HIBERNATE_ORM_DATABASE_GENERATION=validate -e QUARKUS_DATASOURCE_USERNAME=superbad -e QUARKUS_DATASOURCE_PASSWORD=superbad -e QUARKUS_HIBERNATE_ORM_SQL_LOAD_SCRIPT=no-file -e QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="http://otel-collector:4317" --network host --replace quay.io/quarkus-super-heroes/rest-villains:native-latest
# rest-fights-native(): podman run -d -p 8084:8084 --name rest-fights-native -e QUARKUS_MONGODB_HOSTS=localhost:27017 -e QUARKUS_LIQUIBASE_MONGODB_MIGRATE_AT_START="false" -e QUARKUS_MONGODB_CREDENTIALS_USERNAME=superfight -e QUARKUS_MONGODB_CREDENTIALS_PASSWORD=superfight -e QUARKUS_STORK_HERO_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST=localhost:8083 -e QUARKUS_STORK_VILLAIN_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST=localhost:8084 -e MP_MESSAGING_CONNECTOR_SMALLRYE_KAFKA_APICURIO_REGISTRY_URL="http://localhost:8086/apis/registry/v2" -e KAFKA_BOOTSTRAP_SERVERS=PLAINTEXT://localhost:9092 --network host --replace quay.io/quarkus-super-heroes/rest-fights:native-latest
# (optional) ui: podman run -d -p 8080:8080 --name ui-super-heroes -e API_BASE_URL=http://localhost:8082 --network host --replace quay.io/quarkus-super-heroes/ui-super-heroes:native-latest
scripts:
infer-datastouce-hostnames:
# infer the hostnames based on the provided host servers
- set-state: HEROES_DB_HOSTNAME ${{= getHostname( '${{DS_SERVER}}' )}}
- set-state: VILLAINS_DB_HOSTNAME ${{= getHostname( '${{DS_SERVER}}' )}}
- set-state: LOCATIONS_DB_HOSTNAME ${{= getHostname( '${{DS_SERVER}}' )}}
- set-state: FIGHTS_DB_HOSTNAME ${{= getHostname( '${{DS_SERVER}}' )}}
- set-state: APICURIO_HOSTNAME ${{= getHostname( '${{DS_SERVER}}' )}}
- set-state: KAFKA_HOSTNAME ${{= getHostname( '${{DS_SERVER}}' )}}
- set-state: OTEL_HOSTNAME ${{= getHostname( '${{DS_SERVER}}' )}}
infer-services-hostnames:
# infer the hostnames based on the provided host servers
- set-state: HEROES_REST_HOSTNAME "${{= getHostname( '${{SUT_SERVER}}' )}}"
- set-state: VILLAINS_REST_HOSTNAME "${{= getHostname( '${{SUT_SERVER}}' )}}"
- set-state: LOCATIONS_GRPC_HOSTNAME "${{= getHostname( '${{SUT_SERVER}}' )}}"
- set-state: FIGHTS_REST_HOSTNAME "${{= getHostname( '${{SUT_SERVER}}' )}}"
prepare-superheroes:
# clone the repository and checkout the proper commit/branch
- sh: if [ -d ${{SUPERHEROES_FOLDER}} ]; then rm -rf ${{SUPERHEROES_FOLDER}}; fi
- sh: git clone --depth 1 ${{SUPERHEROES_REPO}} ${{SUPERHEROES_FOLDER}}
- sh: cd ${{SUPERHEROES_FOLDER}} && git fetch --depth 1 origin ${{SUPERHEROES_COMMIT:main}} && git checkout ${{SUPERHEROES_COMMIT:main}}
###### OPENTELEMETRY ######
start-jaeger:
- log: starting Jaeger...
- sh: >
${{CONTAINER_RUNTIME}} run -d
--name jaeger
-p 16686:16686
-p 14268:14268
-p 14250:14250
-p ${{OTEL_RECEIVER_PORT}}
${{JAEGER_IMAGE:'mirror.gcr.io/jaegertracing/all-in-one:1'}}
then:
- regex: (?<HOST.JAEGER_POD_ID>[a-f0-9]{64}$)
else:
- abort: failed to capture pod id for Jaeger
- sh: ${{CONTAINER_RUNTIME}} logs -f ${{HOST.JAEGER_POD_ID}}
silent: true # prevent logs to be printed in the terminal
watch:
- regex: ListenSocket created
then:
- countdown: jaeger_ready 3
then:
- ctrlC
timer:
1m: # max wait time
- abort: Jaeger has not been ready in 1 min
- signal: JAEGER_READY
start-otel:
- wait-for: JAEGER_READY
- log: starting Opentelemetry...
- upload: ${{ENV.SCRIPT_DIR}}/monitoring/otel-collector-config.yaml /tmp/
- sh: sed -i 's|\$OTEL_HOSTNAME\$|${{OTEL_HOSTNAME}}|g' /tmp/otel-collector-config.yaml
- sh: >
${{CONTAINER_RUNTIME}} run -d
--name otel
-p 13133:13133
-p ${{OTEL_RECEIVER_PORT}}:4317
-v /tmp/otel-collector-config.yaml:/conf/otel-collector-config.yml
${{OTEL_IMAGE:'mirror.gcr.io/otel/opentelemetry-collector:0.112.0'}} --config=/conf/otel-collector-config.yml
then:
- regex: (?<HOST.OTEL_POD_ID>[a-f0-9]{64}$)
else:
- abort: failed to capture pod id for Opentelemetry
- sh: ${{CONTAINER_RUNTIME}} logs -f ${{HOST.OTEL_POD_ID}}
silent: true # prevent logs to be printed in the terminal
watch:
- regex: Begin running and processing data
then:
- ctrlC
timer:
1m: # max wait time
- abort: Opentelemetry has not been ready in 1 min
- signal: OTEL_READY
###### HEROES ######
start-heroes-db:
- js: ${{HEROES_ENABLED}}
then:
- log: starting Heroes database...
- sh: >
${{CONTAINER_RUNTIME}} run -d
--name heroes-db
-p ${{HEROES_DB_PORT}}:5432
-e POSTGRES_USER=superman
-e POSTGRES_PASSWORD=superman
-e POSTGRES_DB=heroes_database
-v ${{SUPERHEROES_FOLDER}}/rest-heroes/deploy/db-init/initialize-tables.sql:/docker-entrypoint-initdb.d/1-init-tables.sql
${{HEROES_DB_IMAGE:'mirror.gcr.io/library/postgres:16'}}
then:
- regex: (?<HOST.HEROES_DB_POD_ID>[a-f0-9]{64}$)
else:
- abort: failed to capture pod id for Heroes database
- sh: ${{CONTAINER_RUNTIME}} logs -f ${{HOST.HEROES_DB_POD_ID}}
silent: true # prevent logs to be printed in the terminal
watch:
- regex: database system is ready to accept connections
then:
- countdown: db_heroes_ready 2
then:
- ctrlC
timer:
1m: # max wait time
- abort: Heroes db has not been ready in 1 min
- signal: HEROES_DB_READY
start-heroes-rest:
- js: ${{HEROES_ENABLED}}
then:
- wait-for: HEROES_DB_READY
- wait-for: OTEL_READY
- log: starting Heroes service...
- sh: >
${{CONTAINER_RUNTIME}} run -d
--name rest-heroes
${{ CONTAINER_RUNTIME_PARAMS }}
--memory ${{HEROES_REST_MEMORY}}
--cpus ${{HEROES_REST_CPU}}
-p ${{HEROES_REST_PORT}}:8083
-e QUARKUS_DATASOURCE_REACTIVE_URL=postgresql://${{HEROES_DB_HOSTNAME}}:${{HEROES_DB_PORT}}/heroes_database
-e QUARKUS_HIBERNATE_ORM_DATABASE_GENERATION=validate
-e QUARKUS_DATASOURCE_USERNAME=superman
-e QUARKUS_DATASOURCE_PASSWORD=superman
-e QUARKUS_HIBERNATE_ORM_SQL_LOAD_SCRIPT=no-file
-e QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="${{OTEL_PROTOCOL}}://${{OTEL_HOSTNAME}}:${{OTEL_RECEIVER_PORT}}"
${{= getNetwork( '${{SUT_SERVER}}' ) }}
${{HEROES_REST_IMAGE:'quay.io/quarkus-super-heroes/rest-heroes:native-latest'}}
then:
- regex: (?<HOST.HEROES_REST_POD_ID>[a-f0-9]{64}$)
else:
- abort: failed to capture pod id for Heroes rest service
- sh: ${{CONTAINER_RUNTIME}} logs -f ${{HOST.HEROES_REST_POD_ID}}
silent: true # prevent logs to be printed in the terminal
watch:
- regex: started in.*Listening on
then:
- ctrlC
timer:
1m: # max wait time
- abort: Heroes rest has not been ready in 1 min
- signal: HEROES_REST_READY
###### VILLAINS ######
start-villains-db:
- js: ${{VILLAINS_ENABLED}}
then:
- log: starting Villains database...
- sh: >
${{CONTAINER_RUNTIME}} run -d
--name villains-db
-p ${{VILLAINS_DB_PORT}}:5432
-e POSTGRES_USER=superbad
-e POSTGRES_PASSWORD=superbad
-e POSTGRES_DB=villains_database
-v ${{SUPERHEROES_FOLDER}}/rest-villains/deploy/db-init/initialize-tables.sql:/docker-entrypoint-initdb.d/1-init-tables.sql
${{VILLAINS_DB_IMAGE:'mirror.gcr.io/library/postgres:16'}}
then:
- regex: (?<HOST.VILLAINS_DB_POD_ID>[a-f0-9]{64}$)
else:
- abort: failed to capture pod id for Villains database
- sh: ${{CONTAINER_RUNTIME}} logs -f ${{HOST.VILLAINS_DB_POD_ID}}
silent: true # prevent logs to be printed in the terminal
watch:
- regex: database system is ready to accept connections
then:
- countdown: db_villains_ready 2
then:
- ctrlC
timer:
1m: # max wait time
- abort: Villains db has not been ready in 1 min
- signal: VILLAINS_DB_READY
start-villains-rest:
- js: ${{VILLAINS_ENABLED}}
then:
- wait-for: VILLAINS_DB_READY
- wait-for: OTEL_READY
- log: starting Villains service...
- sh: >
${{CONTAINER_RUNTIME}} run -d
--name rest-villains
${{ CONTAINER_RUNTIME_PARAMS }}
--memory ${{VILLAINS_REST_MEMORY}}
--cpus ${{VILLAINS_REST_CPU}}
-p ${{VILLAINS_REST_PORT}}:8084
-e QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://${{VILLAINS_DB_HOSTNAME}}:${{VILLAINS_DB_PORT}}/villains_database
-e QUARKUS_HIBERNATE_ORM_DATABASE_GENERATION=validate
-e QUARKUS_DATASOURCE_USERNAME=superbad
-e QUARKUS_DATASOURCE_PASSWORD=superbad
-e QUARKUS_HIBERNATE_ORM_SQL_LOAD_SCRIPT=no-file
-e QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="${{OTEL_PROTOCOL}}://${{OTEL_HOSTNAME}}:${{OTEL_RECEIVER_PORT}}"
${{= getNetwork( '${{SUT_SERVER}}' ) }}
${{VILLAINS_REST_IMAGE:'quay.io/quarkus-super-heroes/rest-villains:native-latest'}}
then:
- regex: (?<HOST.VILLAINS_REST_POD_ID>[a-f0-9]{64}$)
else:
- abort: failed to capture pod id for Villains rest service
- sh: ${{CONTAINER_RUNTIME}} logs -f ${{HOST.VILLAINS_REST_POD_ID}}
silent: true # prevent logs to be printed in the terminal
watch:
- regex: started in.*Listening on
then:
- ctrlC
timer:
1m: # max wait time
- abort: Villains rest has not been ready in 1 min
- signal: VILLAINS_REST_READY
###### LOCATIONS ######
start-locations-db:
- js: ${{LOCATIONS_ENABLED}}
then:
- log: starting Locations database...
- sh: >
${{CONTAINER_RUNTIME}} run -d
--name locations-db
-p ${{LOCATIONS_DB_PORT}}:3306
-e MARIADB_USER=locations
-e MARIADB_PASSWORD=locations
-e MARIADB_DATABASE=locations_database
-e MARIADB_ROOT_PASSWORD=locations
-e MARIADB_SKIP_TEST_DB=yes
-v ${{SUPERHEROES_FOLDER}}/grpc-locations/deploy/db-init/initialize-tables.sql:/docker-entrypoint-initdb.d/1-init-tables.sql
${{LOCATIONS_DB_IMAGE:'mirror.gcr.io/library/mariadb:11.5'}}
then:
- regex: (?<HOST.LOCATIONS_DB_POD_ID>[a-f0-9]{64}$)
else:
- abort: failed to capture pod id for Locations database
- sh: ${{CONTAINER_RUNTIME}} logs -f ${{HOST.LOCATIONS_DB_POD_ID}}
silent: true # prevent logs to be printed in the terminal
watch:
- regex: ready for connections
then:
- countdown: db_locations_ready 2
then:
- ctrlC
timer:
1m: # max wait time
- abort: Locations db has not been ready in 1 min
- signal: LOCATIONS_DB_READY
start-locations-grpc:
- js: ${{LOCATIONS_ENABLED}}
then:
- wait-for: LOCATIONS_DB_READY
- log: starting Locations service...
- sh: >
${{CONTAINER_RUNTIME}} run -d
--name grpc-locations
${{ CONTAINER_RUNTIME_PARAMS }}
--memory ${{LOCATIONS_GRPC_MEMORY}}
--cpus ${{LOCATIONS_GRPC_CPU}}
-p ${{LOCATIONS_GRPC_PORT}}:8089
-e QUARKUS_DATASOURCE_JDBC_URL=jdbc:mariadb://${{LOCATIONS_DB_HOSTNAME}}:${{LOCATIONS_DB_PORT}}/locations_database
-e QUARKUS_HIBERNATE_ORM_DATABASE_GENERATION=validate
-e QUARKUS_DATASOURCE_USERNAME=locations
-e QUARKUS_DATASOURCE_PASSWORD=locations
-e QUARKUS_HIBERNATE_ORM_SQL_LOAD_SCRIPT=no-file
-e QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="${{OTEL_PROTOCOL}}://${{OTEL_HOSTNAME}}:${{OTEL_RECEIVER_PORT}}"
${{= getNetwork( '${{SUT_SERVER}}' ) }}
${{LOCATIONS_GRPC_IMAGE:'quay.io/quarkus-super-heroes/grpc-locations:native-latest'}}
then:
- regex: (?<HOST.LOCATIONS_GRPC_POD_ID>[a-f0-9]{64}$)
else:
- abort: failed to capture pod id for Locations grpc service
- sh: ${{CONTAINER_RUNTIME}} logs -f ${{HOST.LOCATIONS_GRPC_POD_ID}}
silent: true # prevent logs to be printed in the terminal
watch:
- regex: started in.*Listening on
then:
- ctrlC
timer:
1m: # max wait time
- abort: Locations grpc has not been ready in 1 min
- signal: LOCATIONS_REST_READY
###### FIGHTS ######
start-fights-db:
- js: ${{FIGHTS_ENABLED}}
then:
- log: starting Fights database...
- sh: >
${{CONTAINER_RUNTIME}} run -d
--name fights-db
-p ${{FIGHTS_DB_PORT}}:27017
--memory 1G
--cpus 1
-e MONGO_INITDB_DATABASE=fights
-e MONGO_INITDB_ROOT_USERNAME=super
-e MONGO_INITDB_ROOT_PASSWORD=super
-v ${{SUPERHEROES_FOLDER}}/rest-fights/deploy/db-init/initialize-database.js:/docker-entrypoint-initdb.d/1-init-db.js
${{FIGHTS_DB_IMAGE:'mongo:7.0'}}
then:
- regex: (?<HOST.FIGHTS_DB_POD_ID>[a-f0-9]{64}$)
else:
- abort: failed to capture pod id for Figths database
- sh: ${{CONTAINER_RUNTIME}} logs -f ${{HOST.FIGHTS_DB_POD_ID}}
silent: true # prevent logs to be printed in the terminal
watch:
- regex: mongod startup complete
then:
- countdown: db_fights_ready 2
then:
- ctrlC
timer:
1m: # max wait time
- abort: Fights db has not been ready in 1 min
- signal: FIGHTS_DB_READY
start-apicurio:
- js: ${{FIGHTS_ENABLED}}
then:
- log: starting apicurio registry...
- sh: >
${{CONTAINER_RUNTIME}} run -d
--name apicurio
-p ${{APICURIO_PORT}}:8086
-e REGISTRY_AUTH_ANONYMOUS_READ_ACCESS_ENABLED="true"
-e QUARKUS_HTTP_PORT=8086
${{APICURIO_IMAGE:'quay.io/apicurio/apicurio-registry-mem:2.6.5.Final'}}
then:
- regex: (?<HOST.APICURIO_POD_ID>[a-f0-9]{64}$)
else:
- abort: failed to capture pod id for Apicurio registry
- sh: ${{CONTAINER_RUNTIME}} logs -f ${{HOST.APICURIO_POD_ID}}
silent: true # prevent logs to be printed in the terminal
watch:
- regex: started in.*Listening on
then:
- ctrlC
timer:
1m: # max wait time
- abort: Apicurio registry has not been ready in 1 min
- signal: APICURIO_READY
start-kafka:
- js: ${{FIGHTS_ENABLED}}
then:
- wait-for: APICURIO_READY
- log: starting kafka registry...
- sh: >
${{CONTAINER_RUNTIME}} run -d
--name fights-kafka
-p ${{KAFKA_PORT}}:9092
-e LOG_DIR=/tmp/logs
-e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://localhost:9092
--entrypoint sh
${{KAFKA_IMAGE:'quay.io/strimzi/kafka:0.43.0-kafka-3.8.0'}} -c 'export CLUSTER_ID=$(bin/kafka-storage.sh random-uuid) && bin/kafka-storage.sh format -t ${CLUSTER_ID} -c config/kraft/server.properties && bin/kafka-server-start.sh config/kraft/server.properties --override advertised.listeners=${KAFKA_ADVERTISED_LISTENERS}'
then:
- regex: (?<HOST.KAFKA_POD_ID>[a-f0-9]{64}$)
else:
- abort: failed to capture pod id for Kafka broker
- sh: ${{CONTAINER_RUNTIME}} logs -f ${{HOST.KAFKA_POD_ID}}
silent: true # prevent logs to be printed in the terminal
watch:
- regex: Transition from STARTING to STARTED
then:
- ctrlC
timer:
1m: # max wait time
- abort: Kafka broker has not been ready in 1 min
- signal: KAFKA_READY
start-fights-rest:
- js: ${{FIGHTS_ENABLED}}
then:
- wait-for: FIGHTS_DB_READY
- wait-for: KAFKA_READY
- wait-for: OTEL_READY
- log: starting Fights rest service...
- sh: >
${{CONTAINER_RUNTIME}} run -d
--name rest-fights
${{ CONTAINER_RUNTIME_PARAMS }}
-p ${{FIGHTS_REST_PORT}}:8082
--memory ${{FIGHTS_REST_MEMORY}}
--cpus ${{FIGHTS_REST_CPU}}
-e QUARKUS_MONGODB_HOSTS=${{FIGHTS_DB_HOSTNAME}}:${{FIGHTS_DB_PORT}}
-e QUARKUS_LIQUIBASE_MONGODB_MIGRATE_AT_START="false"
-e QUARKUS_MONGODB_CREDENTIALS_USERNAME=superfight
-e QUARKUS_MONGODB_CREDENTIALS_PASSWORD=superfight
-e QUARKUS_STORK_HERO_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST=${{HEROES_REST_HOSTNAME}}:${{HEROES_REST_PORT}}
-e QUARKUS_STORK_VILLAIN_SERVICE_SERVICE_DISCOVERY_ADDRESS_LIST=${{VILLAINS_REST_HOSTNAME}}:${{VILLAINS_REST_PORT}}
-e MP_MESSAGING_CONNECTOR_SMALLRYE_KAFKA_APICURIO_REGISTRY_URL="http://${{APICURIO_HOSTNAME}}:${{APICURIO_PORT}}/apis/registry/v2"
-e KAFKA_BOOTSTRAP_SERVERS=PLAINTEXT://${{KAFKA_HOSTNAME}}:${{KAFKA_PORT}}
-e QUARKUS_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="${{OTEL_PROTOCOL}}://${{OTEL_HOSTNAME}}:${{OTEL_RECEIVER_PORT}}"
${{= getNetwork( '${{SUT_SERVER}}' ) }}
${{FIGHTS_REST_IMAGE:'quay.io/quarkus-super-heroes/rest-fights:native-latest'}}
then:
- regex: (?<HOST.FIGHTS_REST_POD_ID>[a-f0-9]{64}$)
else:
- abort: failed to capture pod id for Fights rest service
- sh: ${{CONTAINER_RUNTIME}} logs -f ${{HOST.FIGHTS_REST_POD_ID}}
silent: true # prevent logs to be printed in the terminal
watch:
- regex: started in.*Listening on
then:
- ctrlC
timer:
1m: # max wait time
- abort: Fights rest service has not been ready in 1 min
- signal: FIGHTS_REST_READY
start-fights-ui:
- js: ${{UI_ENABLED}}
then:
- wait-for: FIGHTS_REST_READY
- log: starting Fights ui...
- sh: >
${{CONTAINER_RUNTIME}} run -d
--name ui-super-heroes
-p ${{FIGHTS_UI_PORT}}:8080
-e API_BASE_URL=http://${{FIGHTS_REST_HOSTNAME}}:${{FIGHTS_REST_PORT}}
${{= getNetwork( '${{SUT_SERVER}}' ) }}
${{FIGHTS_UI_IMAGE:'quay.io/quarkus-super-heroes/ui-super-heroes:native-latest'}}
then:
- regex: (?<HOST.FIGHTS_REST_UI_ID>[a-f0-9]{64}$)
else:
- abort: failed to capture pod id for Fights ui
cleanup-superheroes-repo:
- sh:
command: rm -Rf ${{SUPERHEROES_FOLDER:/tmp/quarkus-super-heroes}}
ignore-exit-code: true
cleanup-datasources:
- script: cleanup-superheroes-repo
- read-state: ${{HOST.OTEL_POD_ID}}
then:
- queue-download: ${{OTEL_LOGS_FILE}}
- sh: ${{CONTAINER_RUNTIME}} logs ${{HOST.OTEL_POD_ID}} > ${{OTEL_LOGS_FILE}}
silent: true
- read-state: ${{HOST.JAEGER_POD_ID}}
then:
- queue-download: ${{JAEGER_LOGS_FILE}}
- sh: ${{CONTAINER_RUNTIME}} logs ${{HOST.JAEGER_POD_ID}} > ${{JAEGER_LOGS_FILE}}
silent: true
- js: ${{FIGHTS_ENABLED}}
then:
- read-state: ${{HOST.APICURIO_POD_ID}}
then:
- queue-download: ${{APICURIO_LOGS_FILE}}
- sh: ${{CONTAINER_RUNTIME}} logs ${{HOST.APICURIO_POD_ID}} > ${{APICURIO_LOGS_FILE}}
silent: true
- read-state: ${{HOST.KAFKA_POD_ID}}
then:
- queue-download: ${{KAFKA_LOGS_FILE}}
- sh: ${{CONTAINER_RUNTIME}} logs ${{HOST.KAFKA_POD_ID}} > ${{KAFKA_LOGS_FILE}}
silent: true
- read-state: ${{HOST.FIGHTS_DB_POD_ID}}
then:
- queue-download: ${{FIGHTS_DB_LOGS_FILE}}
- sh: ${{CONTAINER_RUNTIME}} logs ${{HOST.FIGHTS_DB_POD_ID}} > ${{FIGHTS_DB_LOGS_FILE}}
silent: true
- js: ${{HEROES_ENABLED}}
then:
- read-state: ${{HOST.HEROES_DB_POD_ID}}
then:
- queue-download: ${{HEROES_DB_LOGS_FILE}}
- sh: ${{CONTAINER_RUNTIME}} logs ${{HOST.HEROES_DB_POD_ID}} > ${{HEROES_DB_LOGS_FILE}}
silent: true
- js: ${{VILLAINS_ENABLED}}
then:
- read-state: ${{HOST.VILLAINS_DB_POD_ID}}
then:
- queue-download: ${{VILLAINS_DB_LOGS_FILE}}
- sh: ${{CONTAINER_RUNTIME}} logs ${{HOST.VILLAINS_DB_POD_ID}} > ${{VILLAINS_DB_LOGS_FILE}}
silent: true
- js: ${{LOCATIONS_ENABLED}}
then:
- read-state: ${{HOST.LOCATIONS_DB_POD_ID}}
then:
- queue-download: ${{LOCATIONS_DB_LOGS_FILE}}
- sh: ${{CONTAINER_RUNTIME}} logs ${{HOST.LOCATIONS_DB_POD_ID}} > ${{LOCATIONS_DB_LOGS_FILE}}
silent: true
# remove all pods
- sh: ${{CONTAINER_RUNTIME}} rm -f ${{HOST.KAFKA_POD_ID:}} ${{HOST.APICURIO_POD_ID:}} ${{HOST.FIGHTS_DB_POD_ID:}} ${{HOST.VILLAINS_DB_POD_ID:}} ${{HOST.HEROES_DB_POD_ID:}} ${{HOST.LOCATIONS_DB_POD_ID:}} ${{HOST.JAEGER_POD_ID:}} ${{HOST.OTEL_POD_ID:}}
cleanup-superheroes:
- js: ${{FIGHTS_ENABLED}}
then:
- read-state: ${{HOST.FIGHTS_REST_POD_ID}}
then:
- queue-download: ${{FIGHTS_REST_LOGS_FILE}}
- sh: ${{CONTAINER_RUNTIME}} logs ${{HOST.FIGHTS_REST_POD_ID}} > ${{FIGHTS_REST_LOGS_FILE}}
- js: ${{LOCATIONS_ENABLED}}
then:
- read-state: ${{HOST.LOCATIONS_GRPC_POD_ID}}
then:
- queue-download: ${{LOCATIONS_GRPC_LOGS_FILE}}
- sh: ${{CONTAINER_RUNTIME}} logs ${{HOST.LOCATIONS_GRPC_POD_ID}} > ${{LOCATIONS_GRPC_LOGS_FILE}}
- js: ${{VILLAINS_ENABLED}}
then:
- read-state: ${{HOST.VILLAINS_REST_POD_ID}}
then:
- queue-download: ${{VILLAINS_REST_LOGS_FILE}}
- sh: ${{CONTAINER_RUNTIME}} logs ${{HOST.VILLAINS_REST_POD_ID}} > ${{VILLAINS_REST_LOGS_FILE}}
- js: ${{HEROES_ENABLED}}
then:
- read-state: ${{HOST.HEROES_REST_POD_ID}}
then:
- queue-download: ${{HEROES_REST_LOGS_FILE}}
- sh: ${{CONTAINER_RUNTIME}} logs ${{HOST.HEROES_REST_POD_ID}} > ${{HEROES_REST_LOGS_FILE}}
# remove all pods
- sh: ${{CONTAINER_RUNTIME}} rm -f ${{HOST.FIGHTS_REST_UI_ID:}} ${{HOST.FIGHTS_REST_POD_ID:}} ${{HOST.VILLAINS_REST_POD_ID:}} ${{HOST.HEROES_REST_POD_ID:}} ${{HOST.LOCATIONS_GRPC_POD_ID:}}
states:
# container exec
CONTAINER_RUNTIME: docker
SUPERHEROES_REPO: https://github.com/quarkusio/quarkus-super-heroes.git
SUPERHEROES_COMMIT: main
SUPERHEROES_FOLDER: /tmp/quarkus-super-heroes
# Opentelemetry
JAEGER_IMAGE: "mirror.gcr.io/jaegertracing/all-in-one:1"
JAEGER_LOGS_FILE: /tmp/jaeger.logs
OTEL_IMAGE: "mirror.gcr.io/otel/opentelemetry-collector:0.112.0"
OTEL_PROTOCOL: "http"
OTEL_HOSTNAME:
OTEL_RECEIVER_PORT: 4317
OTEL_LOGS_FILE: /tmp/otel.logs
# Heroes
HEROES_ENABLED: true
HEROES_DB_IMAGE: "mirror.gcr.io/library/postgres:16"
HEROES_DB_HOSTNAME:
HEROES_DB_PORT: 5432
HEROES_DB_LOGS_FILE: /tmp/heroes_db.logs
HEROES_REST_IMAGE: "quay.io/quarkus-super-heroes/rest-heroes:native-latest"
HEROES_REST_HOSTNAME:
HEROES_REST_PORT: 8083
HEROES_REST_LOGS_FILE: /tmp/heroes.logs
HEROES_REST_MEMORY: 1G
HEROES_REST_CPU: 1
# Villains
VILLAINS_ENABLED: true
VILLAINS_DB_IMAGE: "mirror.gcr.io/library/postgres:16"
VILLAINS_DB_HOSTNAME:
VILLAINS_DB_PORT: 5433
VILLAINS_DB_LOGS_FILE: /tmp/villains_db.logs
VILLAINS_REST_IMAGE: "quay.io/quarkus-super-heroes/rest-villains:native-latest"
VILLAINS_REST_HOSTNAME:
VILLAINS_REST_PORT: 8084
VILLAINS_REST_LOGS_FILE: /tmp/villains.logs
VILLAINS_REST_MEMORY: 1G
VILLAINS_REST_CPU: 1
# Locations
LOCATIONS_ENABLED: true
LOCATIONS_DB_IMAGE: "mirror.gcr.io/library/mariadb:11.5"
LOCATIONS_DB_HOSTNAME:
LOCATIONS_DB_PORT: 3306
LOCATIONS_DB_LOGS_FILE: /tmp/locations_db.logs
LOCATIONS_GRPC_IMAGE: "quay.io/quarkus-super-heroes/grpc-locations:native-latest"
LOCATIONS_GRPC_HOSTNAME:
LOCATIONS_GRPC_PORT: 8089
LOCATIONS_GRPC_LOGS_FILE: /tmp/locations.logs
LOCATIONS_GRPC_MEMORY: 1G
LOCATIONS_GRPC_CPU: 1
# Fights
FIGHTS_ENABLED: true
FIGHTS_DB_IMAGE: "mirror.gcr.io/library/mongo:7.0"
FIGHTS_DB_HOSTNAME:
FIGHTS_DB_PORT: 27017
FIGHTS_DB_LOGS_FILE: /tmp/fights_db.logs
APICURIO_IMAGE: "quay.io/apicurio/apicurio-registry-mem:2.6.5.Final"
APICURIO_HOSTNAME:
APICURIO_PORT: 8086
APICURIO_LOGS_FILE: /tmp/apicurio.logs
KAFKA_IMAGE: "quay.io/strimzi/kafka:0.43.0-kafka-3.8.0"
KAFKA_HOSTNAME:
KAFKA_PORT: 9092
KAFKA_LOGS_FILE: /tmp/kafka.logs
FIGHTS_REST_IMAGE: "quay.io/quarkus-super-heroes/rest-fights:native-latest"
FIGHTS_REST_HOSTNAME:
FIGHTS_REST_PORT: 8082
FIGHTS_REST_LOGS_FILE: /tmp/fights.logs
FIGHTS_REST_MEMORY: 1G
FIGHTS_REST_CPU: 1
UI_ENABLED: true
FIGHTS_UI_IMAGE: "quay.io/quarkus-super-heroes/ui-super-heroes:native-latest"
FIGHTS_UI_PORT: 8080