From 86917602f038664ddd6acf792a35a56c72b7c526 Mon Sep 17 00:00:00 2001 From: "A.M. Smith" Date: Wed, 20 Mar 2024 11:00:04 -0700 Subject: [PATCH] feat: add svc-itest and svc-contact --- .cspell.project-words.txt | 4 ++ local-dev/.env-example | 18 ++++++ local-dev/demo.sh | 118 +++++++++++++++++++++++++++++++++++ local-dev/docker-compose.yml | 38 ++++++++++- 4 files changed, 176 insertions(+), 2 deletions(-) create mode 100755 local-dev/demo.sh diff --git a/.cspell.project-words.txt b/.cspell.project-words.txt index 838d8f8..34d535c 100644 --- a/.cspell.project-words.txt +++ b/.cspell.project-words.txt @@ -90,3 +90,7 @@ Vertiports vertiports extname extrelocatable +aeth +hoorn +wadden +itest diff --git a/local-dev/.env-example b/local-dev/.env-example index f2fb670..c953306 100644 --- a/local-dev/.env-example +++ b/local-dev/.env-example @@ -121,3 +121,21 @@ DISCOVERY_TAG=latest-develop DISCOVERY_HOST_PORT_GRPC=50013 DISCOVERY_HOST_PORT_REST=8013 DISCOVERY_HOST_GRPC=svc-discovery + +# ----------------------------------------------------------- +# svc-contact +# ----------------------------------------------------------- +CONTACT_IMAGE=ghcr.io/arrow-air/svc-contact +CONTACT_TAG=latest-develop +CONTACT_HOST_PORT_GRPC=50014 +CONTACT_HOST_PORT_REST=8014 +CONTACT_HOST_GRPC=svc-contact + +# ----------------------------------------------------------- +# svc-itest +# ----------------------------------------------------------- +ITEST_IMAGE=ghcr.io/arrow-air/svc-itest +ITEST_TAG=latest-develop +ITEST_HOST_PORT_GRPC=50014 +ITEST_HOST_PORT_REST=8099 +ITEST_HOST_GRPC=svc-itest diff --git a/local-dev/demo.sh b/local-dev/demo.sh new file mode 100755 index 0000000..1d2729e --- /dev/null +++ b/local-dev/demo.sh @@ -0,0 +1,118 @@ +#!/bin/bash +source .env +BASE_URL="http://0.0.0.0:8014" +# echo "Running Population for $BASE_URL..." + +VERTIPORT_ID=$(curl \ + --request PUT \ + -H "Content-Type: application/json" \ + -d '{ + "label": "Hoorn Hangar #1", + "vertices": [ + [52.6387406, 5.1693605], + [52.6391572, 5.1751138], + [52.6366050, 5.1759725], + [52.6357195, 5.1696181], + [52.6387406, 5.1693605] + ] + }' \ + $BASE_URL/demo/vertiport +) + +if [ -z "$VERTIPORT_ID" ]; then + echo "Failed to create vertiport" + exit 1 +fi + +echo "Vertiport ID: $VERTIPORT_ID" + +AIRCRAFT=("Marauder" "Mantis" "Ghost" "RazorCrest") + +echo "nickname,uuid,registration_number" > aircraft.csv +for i in "${!AIRCRAFT[@]}"; do + a=${AIRCRAFT[$i]} + REGISTRATION="AETH-CRAFT-$i" + + VERTIPAD_ID=$(curl \ + --request PUT \ + -H "Content-Type: application/json" \ + -d '{ + "vertiport_id": '"$VERTIPORT_ID"', + "latitude": 52.6379593, + "longitude": 5.1716790, + "label": "pad-'"$i"'" + }' \ + $BASE_URL/demo/vertipad + ) + + AIRCRAFT_ID=$(curl \ + -q \ + -X PUT -H "Content-Type: application/json" \ + -d '{ + "nickname": "'"$a"'", + "registration_number": "'"$REGISTRATION"'", + "hangar_id": '"$VERTIPORT_ID"', + "hangar_bay_id": '"$VERTIPAD_ID"' + }' \ + http://0.0.0.0:$ITEST_HOST_PORT_REST/demo/aircraft) + + echo "$a,$AIRCRAFT_ID,$REGISTRATION" >> aircraft.csv +done + +# +# HOORN +# +HOORN_ID=$(curl \ +--request PUT \ +-H "Content-Type: application/json" \ +-d '{ + "label": "Hoorn Private #1", + "vertices": [ + [52.6487268, 4.9891228], + [52.6480889, 4.9892300], + [52.6481410, 4.9901310], + [52.6487528, 4.9900881], + [52.6487268, 4.9891228] + ] +}' \ +$BASE_URL/demo/vertiport) + +curl \ +--request PUT \ +-H "Content-Type: application/json" \ +-d '{ + "vertiport_id": '"$HOORN_ID"', + "latitude": 52.6484013, + "longitude": 4.9897020, + "label": "pad-1" +}' \ +$BASE_URL/demo/vertipad + +# +# MARKER WADDEN +# +WADDEN_ID=$(curl \ +--request PUT \ +-H "Content-Type: application/json" \ +-d '{ + "label": "Marker Wadden Private #1", + "vertices": [ + [52.5841430, 5.3645049], + [52.5840615, 5.3645062], + [52.5840607, 5.3646658], + [52.5841463, 5.3646684], + [52.5841430, 5.3645049] + ] +}' \ +$BASE_URL/demo/vertiport) + +curl \ +--request PUT \ +-H "Content-Type: application/json" \ +-d '{ + "vertiport_id": '"$WADDEN_ID"', + "latitude": 52.5841015, + "longitude": 5.3645814, + "label": "pad-1" +}' \ +$BASE_URL/demo/vertipad diff --git a/local-dev/docker-compose.yml b/local-dev/docker-compose.yml index a534049..0aa479a 100644 --- a/local-dev/docker-compose.yml +++ b/local-dev/docker-compose.yml @@ -135,8 +135,6 @@ services: condition: service_healthy svc-storage: condition: service_healthy - svc-compliance: - condition: service_healthy svc-pricing: image: ${PRICING_IMAGE}:${PRICING_TAG} @@ -151,6 +149,8 @@ services: extends: file: docker-compose/arrow-svc.yml service: server + ports: + - ${CARGO_HOST_PORT_REST}:8000 depends_on: svc-storage: condition: service_healthy @@ -158,6 +158,8 @@ services: condition: service_healthy svc-pricing: condition: service_healthy + svc-contact: + condition: service_healthy environment: - REQUEST_LIMIT_PER_SECOND=$REST_REQUEST_LIMIT_PER_SECOND @@ -171,6 +173,18 @@ services: svc-storage: condition: service_healthy + svc-contact: + image: ${CONTACT_IMAGE}:${CONTACT_TAG} + container_name: arrow-svc-contact + ports: + - ${CONTACT_HOST_PORT_REST}:8000 + extends: + file: docker-compose/arrow-svc.yml + service: server + depends_on: + svc-storage: + condition: service_healthy + svc-atc: image: ${ATC_IMAGE}:${ATC_TAG} container_name: arrow-svc-atc @@ -214,3 +228,23 @@ services: condition: service_healthy svc-telemetry: condition: service_healthy + + svc-itest: + image: ${ITEST_IMAGE}:${ITEST_TAG} + container_name: arrow-svc-itest + ports: + - ${ITEST_HOST_PORT_REST}:8000 + extends: + file: docker-compose/arrow-svc.yml + service: server + depends_on: + svc-telemetry: + condition: service_healthy + svc-cargo: + condition: service_healthy + svc-gis: + condition: service_healthy + svc-storage: + condition: service_healthy + svc-compliance: + condition: service_healthy