From 469d8828ad047a9dc5293b5522b124b133bd60c0 Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Fri, 20 Sep 2024 14:58:50 -0400 Subject: [PATCH 01/25] added Makefile and updated README for contributors --- Makefile | 3 +++ mentorHub-developer-edition/README.md | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8676869 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +.PHONY: install + +install: cp ./docker-configurations/docker-compose.yaml ~/Applications/MentorHub-DE/mentorHub, cp ./mentorHub-developer-edition/mh ~/Applications/MentorHub-DE/mentorHub diff --git a/mentorHub-developer-edition/README.md b/mentorHub-developer-edition/README.md index 590bbf2..75f832b 100644 --- a/mentorHub-developer-edition/README.md +++ b/mentorHub-developer-edition/README.md @@ -73,3 +73,12 @@ sudo nano ~/.bashrc ``` This will open a terminal text editor. In the text editor you can use the arrow keys (←↑→↓) to move the cursor. Hold the down (↓) arrow key to until you get to the bottom of the file. You might see something like ![image](https://github.com/agile-learning-institute/mentorHub/assets/67389882/1d7ecdd5-1f32-44d1-9b67-a0947e1f86bd) Navigate your cursor to the line with the long comment, move the cursor to the `e` in `export`, and press `enter` to create a new line. To save and exit, press `control + x` then `y` to confirm, then hit `enter` to confirm again. After that, run `source ~/.bashrc` (or where ever your `.bashrc` file is) and try `mh` again. It should work. If not, try restarting your WSL terminal. + +# Contributing +If you are interested in contributing to the MentorHub Developer Edition you should familarize yourself with the [mh zsh script](./mh) and the [docker compose file](../docker-configurations/docker-compose.yaml). If you are editing these files and want to test your changes locally, you can use the following command + +```sh +make install +``` + +This script will copy the mh script and docker-compose file to your ~/Applications/Mentorhub/mentorhub folder, which is the default install locaiton. If you have installed in a different location you will need to manually copy the files to your install location to test things locally. From 3336881c157e39e3cfa0bf26c3922eea484c3bfe Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Wed, 6 Nov 2024 17:00:49 -0500 Subject: [PATCH 02/25] compose updates --- Makefile | 6 +- docker-configurations/docker-compose.yaml | 207 ++++++++++++++++++---- package-lock.json | 6 + 3 files changed, 179 insertions(+), 40 deletions(-) create mode 100644 package-lock.json diff --git a/Makefile b/Makefile index 8676869..b8e86b5 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,7 @@ +# Makefile + .PHONY: install -install: cp ./docker-configurations/docker-compose.yaml ~/Applications/MentorHub-DE/mentorHub, cp ./mentorHub-developer-edition/mh ~/Applications/MentorHub-DE/mentorHub +install: + cp ./docker-configurations/docker-compose.yaml ~/Applications/MentorHub-DE/mentorHub + cp ./mentorHub-developer-edition/mh ~/Applications/MentorHub-DE/mentorHub diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index 9b44e3c..58417d5 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -1,7 +1,11 @@ -# version: '3.1' +# version: '3.7' services: - mentorhub-mongodb: + ################################## + # Backing Services + ################################## + # MongoDB backing service + mongodb: image: mongo:7.0.5 environment: MONGO_INITDB_ROOT_USERNAME: root @@ -15,49 +19,140 @@ services: retries: 15 profiles: - all - - mongoonly - mongodb + - mongoonly + - kafka - curriculum - encounter - partner - person + - search - topic - curriculum-api - encounter-api - partner-api - person-api + - search-api - topic-api - msm - mentorhub-searchdb: + ################################## + # Elasticsearch backing service + elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch:8.13.2 environment: - discovery.type: single-node - cluster-name: mentorHub - ELASTIC_PASSWORD: o0=eLmmQbsrdEW89a-Id + - "discovery.type=single-node" + - "ES_JAVA_OPTS=-Xms2048m -Xmx2048m" + - "xpack.security.enabled=false" + - "action.destructive_requires_name=false" + ulimits: + memlock: + soft: -1 + hard: -1 ports: - - "9200:9200" - mem_limit: 1g - healthcheck: - test: ["CMD-SHELL", "curl -s --insecure -u elastic:o0=eLmmQbsrdEW89a-Id https://localhost:9200/_cluster/health | grep -q '\"status\":\"green\"' || exit 1"] - interval: 15s - timeout: 10s - retries: 5 - start_period: 10s + - 9200:9200 profiles: - all + - kafka + - elasticsearch - elasticonly + - search-api + - search + + ################################## + # Kibana for Elasticsearch service + kibana: + image: docker.elastic.co/kibana/kibana:8.13.2 + ports: + - 5601:5601 + depends_on: + - elasticsearch + environment: + ELASTICSEARCH_URL: http://elasticsearch:9200 + ELASTICSEARCH_HOSTS: http://elasticsearch:9200 + XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: c69548d9027afcf4d55146b1d425a9f4c69548d9027afcf4d55146b1d425a9f4 + profiles: + - all + - kafka + - elasticsearch + - elasticonly + - search-api + - search + + ################################## + # Zookeeper manager for Kafka cluster + zookeeper: + image: zookeeper:3.9.2 + ports: + - "2181:2181" + profiles: + - all + - kafka + - search-api - search - - search-db + + ################################## + # Kafka event bus + kafka: + image: confluentinc/cp-kafka:7.3.0 + ports: + - "9092:9092" + environment: + KAFKA_BROKER_ID: 1 + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092 + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + CONFLUENT_SUPPORT_METRICS_ENABLE: "false" + depends_on: + - zookeeper + profiles: + - all + - kafka - search-api + - search + ################################## + # Kafka Connector + kafka-connect: + image: confluentinc/cp-kafka-connect:7.3.10 + ports: + - "9093:9093" + environment: + CONNECT_BOOTSTRAP_SERVERS: kafka:9092 + CONNECT_REST_PORT: 9093 + CONNECT_GROUP_ID: "mongo-elastic-sync" + CONNECT_CONFIG_STORAGE_TOPIC: "connect-configs" + CONNECT_OFFSET_STORAGE_TOPIC: "connect-offsets" + CONNECT_STATUS_STORAGE_TOPIC: "connect-status" + CONNECT_KEY_CONVERTER: "org.apache.kafka.connect.storage.StringConverter" + CONNECT_VALUE_CONVERTER: "org.apache.kafka.connect.json.JsonConverter" + CONNECT_PLUGIN_PATH: "/usr/share/java" + depends_on: + kafka: + condition: service_started + mentorhub-mongodb: + condition: service_completed_successfully + mentorhub-elasticsearch: + condition: service_completed_successfully + profiles: + - all + - kafka + - search-api + - search + + ################################## + # Backing Service Configuration Utilities + ################################## + # Mongo Schema Manager utility - for testing of mentorhub-mongodb + # Not a part of the deployment code msm: image: ghcr.io/agile-learning-institute/msm:latest depends_on: - mentorhub-mongodb: + mongodb: condition: service_healthy environment: - - CONNECTION_STRING=mongodb://root:example@mentorhub-mongodb:27017 + - CONNECTION_STRING=mongodb://root:example@mongodb:27017 - LOAD_TEST_DATA=true - DB_NAME=mentorHub volumes: @@ -65,51 +160,82 @@ services: profiles: - msm - mentorhub-mongomsm: + ################################## + # Initilize MongoDB and load test data + mentorhub-mongodb: image: ghcr.io/agile-learning-institute/mentorhub-msm:latest depends_on: - mentorhub-mongodb: + mongodb: condition: service_healthy environment: - - CONNECTION_STRING=mongodb://root:example@mentorhub-mongodb:27017 + - CONNECTION_STRING=mongodb://root:example@mongodb:27017 - LOAD_TEST_DATA=true - DB_NAME=mentorHub profiles: - all + - kafka - mongodb - curriculum - encounter - partner - person + - search - topic - curriculum-api - encounter-api - partner-api - person-api + - search-api - topic-api + - msm - mentorhub-searchinit: - image: ghcr.io/agile-learning-institute/mentorhub-search-searchinit:latest - depends_on: - mentorhub-searchdb: - condition: service_healthy + ################################## + # Initilize Elasticsearch and load test data + mentorhub-elasticsearch: + image: ghcr.io/agile-learning-institute/mentorhub-elasticsearch:latest environment: - HOST: mentorhub-searchdb + ELASTICSEARCH_URL: http://elasticsearch:9200 + depends_on: + - elasticsearch profiles: - all - - search - - search-db + - kafka + - elasticsearch - search-api + - search + + ################################## + # Initilize Kafka and configure Kafka Connectors + mentorhub-kafka: + image: ghcr.io/agile-learning-institute/mentorhub-curriculum-api:latest + restart: no + environment: + ELASTIC_CONNECTION_STRING: elasticsearch:// + KAFKA_CONNECT_URL: kafka-connect:// + MONGODB_URI: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true + depends_on: + mentorhub-mongodb: + condition: service_completed_successfully + mentorhub-elasticsearch: + condition: service_completed_successfully + kafka-connect: + condition: service_started + profiles: + - all + - kafka + ################################## + # API's + ################################## mentorhub-curriculum-api: image: ghcr.io/agile-learning-institute/mentorhub-curriculum-api:latest restart: no ports: - 8088:8088 environment: - CONNECTION_STRING: mongodb://root:example@mentorhub-mongodb:27017/?tls=false&directConnection=true + CONNECTION_STRING: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true depends_on: - mentorhub-mongomsm: + mentorhub-mongodb: condition: service_completed_successfully profiles: - all @@ -122,9 +248,9 @@ services: ports: - 8090:8090 environment: - CONNECTION_STRING: mongodb://root:example@mentorhub-mongodb:27017/?tls=false&directConnection=true + CONNECTION_STRING: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true depends_on: - mentorhub-mongomsm: + mentorhub-mongodb: condition: service_completed_successfully profiles: - all @@ -137,9 +263,9 @@ services: ports: - 8084:8084 environment: - CONNECTION_STRING: mongodb://root:example@mentorhub-mongodb:27017/?tls=false&directConnection=true + CONNECTION_STRING: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true depends_on: - mentorhub-mongomsm: + mentorhub-mongodb: condition: service_completed_successfully profiles: - all @@ -152,9 +278,9 @@ services: ports: - 8082:8082 environment: - CONNECTION_STRING: mongodb://root:example@mentorhub-mongodb:27017/?tls=false&directConnection=true + CONNECTION_STRING: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true depends_on: - mentorhub-mongomsm: + mentorhub-mongodb: condition: service_completed_successfully profiles: - all @@ -181,15 +307,18 @@ services: ports: - 8086:8086 environment: - CONNECTION_STRING: mongodb://root:example@mentorhub-mongodb:27017/?tls=false&directConnection=true + CONNECTION_STRING: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true depends_on: - mentorhub-mongomsm: + mentorhub-mongodb: condition: service_completed_successfully profiles: - all - topic - topic-api + ################################## + # SPA's start here + ################################## mentorhub-curriculum-ui: image: ghcr.io/agile-learning-institute/mentorhub-curriculum-ui:latest restart: no diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..5c8bf29 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "mentorHub", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} From 2539b6b48eaa655eac211360cffcedd4a734e0af Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Thu, 7 Nov 2024 21:08:11 -0500 Subject: [PATCH 03/25] elasticsearch updates --- docker-configurations/docker-compose.yaml | 33 +++++++++++++++-------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index 58417d5..78b4c11 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -51,6 +51,12 @@ services: hard: -1 ports: - 9200:9200 + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9200"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 10s profiles: - all - kafka @@ -131,7 +137,7 @@ services: depends_on: kafka: condition: service_started - mentorhub-mongodb: + mentorhub-msm: condition: service_completed_successfully mentorhub-elasticsearch: condition: service_completed_successfully @@ -144,7 +150,7 @@ services: ################################## # Backing Service Configuration Utilities ################################## - # Mongo Schema Manager utility - for testing of mentorhub-mongodb + # Mongo Schema Manager utility - for testing of mentorhub-msm # Not a part of the deployment code msm: image: ghcr.io/agile-learning-institute/msm:latest @@ -162,7 +168,7 @@ services: ################################## # Initilize MongoDB and load test data - mentorhub-mongodb: + mentorhub-msm: image: ghcr.io/agile-learning-institute/mentorhub-msm:latest depends_on: mongodb: @@ -194,9 +200,14 @@ services: mentorhub-elasticsearch: image: ghcr.io/agile-learning-institute/mentorhub-elasticsearch:latest environment: - ELASTICSEARCH_URL: http://elasticsearch:9200 + CLIENT_OPTIONS: '{"node":"http://elasticsearch:9200"}' + MONGO_CONNECTION_STRING: mongodb://root:example@mongodb:27017 + LOAD_TEST_DATA: true depends_on: - - elasticsearch + mentorhub-msm: + condition: service_completed_successfully + elasticsearch: + condition: service_healthy profiles: - all - kafka @@ -214,7 +225,7 @@ services: KAFKA_CONNECT_URL: kafka-connect:// MONGODB_URI: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true depends_on: - mentorhub-mongodb: + mentorhub-msm: condition: service_completed_successfully mentorhub-elasticsearch: condition: service_completed_successfully @@ -235,7 +246,7 @@ services: environment: CONNECTION_STRING: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true depends_on: - mentorhub-mongodb: + mentorhub-msm: condition: service_completed_successfully profiles: - all @@ -250,7 +261,7 @@ services: environment: CONNECTION_STRING: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true depends_on: - mentorhub-mongodb: + mentorhub-msm: condition: service_completed_successfully profiles: - all @@ -265,7 +276,7 @@ services: environment: CONNECTION_STRING: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true depends_on: - mentorhub-mongodb: + mentorhub-msm: condition: service_completed_successfully profiles: - all @@ -280,7 +291,7 @@ services: environment: CONNECTION_STRING: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true depends_on: - mentorhub-mongodb: + mentorhub-msm: condition: service_completed_successfully profiles: - all @@ -309,7 +320,7 @@ services: environment: CONNECTION_STRING: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true depends_on: - mentorhub-mongodb: + mentorhub-msm: condition: service_completed_successfully profiles: - all From 738ee348c1c209672d0cf48f99082669c01fe57d Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Wed, 13 Nov 2024 16:37:40 -0500 Subject: [PATCH 04/25] housekeeping --- package-lock.json | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 5c8bf29..0000000 --- a/package-lock.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "mentorHub", - "lockfileVersion": 3, - "requires": true, - "packages": {} -} From a7eaa1014e2d9c134e8cbd8f7b214ac43f4bcd63 Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Tue, 19 Nov 2024 21:18:28 -0500 Subject: [PATCH 05/25] kafka-connect configuration fixes --- docker-configurations/docker-compose.yaml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index 78b4c11..890a72e 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -103,12 +103,16 @@ services: image: confluentinc/cp-kafka:7.3.0 ports: - "9092:9092" + - "19092:19092" environment: KAFKA_BROKER_ID: 1 KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 - KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT - KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: EXTERNAL:PLAINTEXT,INTERNAL:PLAINTEXT + KAFKA_ADVERTISED_LISTENERS: EXTERNAL://localhost:9092,INTERNAL://kafka:19092 + KAFKA_LISTENERS: EXTERNAL://0.0.0.0:9092,INTERNAL://0.0.0.0:19092 + KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 + KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true" CONFLUENT_SUPPORT_METRICS_ENABLE: "false" depends_on: - zookeeper @@ -123,14 +127,17 @@ services: kafka-connect: image: confluentinc/cp-kafka-connect:7.3.10 ports: - - "9093:9093" + - "9093:8083" environment: - CONNECT_BOOTSTRAP_SERVERS: kafka:9092 - CONNECT_REST_PORT: 9093 + CONNECT_BOOTSTRAP_SERVERS: kafka:19092 + CONNECT_REST_ADVERTISED_HOST_NAME: localhost CONNECT_GROUP_ID: "mongo-elastic-sync" CONNECT_CONFIG_STORAGE_TOPIC: "connect-configs" CONNECT_OFFSET_STORAGE_TOPIC: "connect-offsets" CONNECT_STATUS_STORAGE_TOPIC: "connect-status" + CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: 1 + CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: 1 + CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: 1 CONNECT_KEY_CONVERTER: "org.apache.kafka.connect.storage.StringConverter" CONNECT_VALUE_CONVERTER: "org.apache.kafka.connect.json.JsonConverter" CONNECT_PLUGIN_PATH: "/usr/share/java" From 9f61322452c9d754e8fb57c7b2f2c703b41619ef Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Thu, 21 Nov 2024 22:10:11 -0500 Subject: [PATCH 06/25] container name fix --- docker-configurations/docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index 890a72e..ae8e986 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -225,7 +225,7 @@ services: ################################## # Initilize Kafka and configure Kafka Connectors mentorhub-kafka: - image: ghcr.io/agile-learning-institute/mentorhub-curriculum-api:latest + image: ghcr.io/agile-learning-institute/mentorhub-kafka:latest restart: no environment: ELASTIC_CONNECTION_STRING: elasticsearch:// From cee93e020de92b4a0de2cbba0399938373d8361c Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Fri, 22 Nov 2024 19:37:10 -0500 Subject: [PATCH 07/25] added kafkaonly profile --- docker-configurations/docker-compose.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index ae8e986..3e38b22 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -22,6 +22,7 @@ services: - mongodb - mongoonly - kafka + - kafkaonly - curriculum - encounter - partner @@ -60,6 +61,7 @@ services: profiles: - all - kafka + - kafkaonly - elasticsearch - elasticonly - search-api @@ -80,6 +82,7 @@ services: profiles: - all - kafka + - kafkaonly - elasticsearch - elasticonly - search-api @@ -94,6 +97,7 @@ services: profiles: - all - kafka + - kafkaonly - search-api - search @@ -119,6 +123,7 @@ services: profiles: - all - kafka + - kafkaonly - search-api - search @@ -151,6 +156,7 @@ services: profiles: - all - kafka + - kafkaonly - search-api - search @@ -187,6 +193,7 @@ services: profiles: - all - kafka + - kafkaonly - mongodb - curriculum - encounter @@ -218,6 +225,7 @@ services: profiles: - all - kafka + - kafkaonly - elasticsearch - search-api - search @@ -241,6 +249,8 @@ services: profiles: - all - kafka + - search-api + - search ################################## # API's From 7bfcbfa48b12ec2eea123b43f369bd12b91a02ac Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Sun, 1 Dec 2024 12:36:42 -0500 Subject: [PATCH 08/25] Use connect with plugins --- docker-configurations/docker-compose.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index 3e38b22..dcc7550 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -128,9 +128,9 @@ services: - search ################################## - # Kafka Connector + # Kafka Connector (Custom connector with Mongo and Elastic plugins) kafka-connect: - image: confluentinc/cp-kafka-connect:7.3.10 + image: ghcr.io/agile-learning-institute/mentorhub-kafka-connect:latest ports: - "9093:8083" environment: @@ -145,7 +145,6 @@ services: CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: 1 CONNECT_KEY_CONVERTER: "org.apache.kafka.connect.storage.StringConverter" CONNECT_VALUE_CONVERTER: "org.apache.kafka.connect.json.JsonConverter" - CONNECT_PLUGIN_PATH: "/usr/share/java" depends_on: kafka: condition: service_started From 18f412e0df536c9bdc89992742ebc9f7a9f59a44 Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Sun, 1 Dec 2024 14:21:09 -0500 Subject: [PATCH 09/25] Implement mongodb as a single node replica set --- docker-configurations/docker-compose.yaml | 41 ++++++++++++----------- mentorHub-developer-edition/README.md | 7 ++++ 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index dcc7550..7bcf8f5 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -4,25 +4,26 @@ services: ################################## # Backing Services ################################## - # MongoDB backing service + # MongoDB backing service (single node replica set) mongodb: image: mongo:7.0.5 - environment: - MONGO_INITDB_ROOT_USERNAME: root - MONGO_INITDB_ROOT_PASSWORD: example ports: - - "27017:27017" + - 27017:27017 + extra_hosts: + - "mongodb:127.0.0.1" healthcheck: - test: ["CMD", "mongosh", "-u", "root", "-p", "example", "--authenticationDatabase", "admin", "--eval", "db.adminCommand('ping')"] - interval: 3s - timeout: 6s - retries: 15 + test: echo "try { rs.status() } catch (err) { rs.initiate({_id:'rs0',members:[{_id:0,host:'mongodb:27017'}]}) }" | mongosh --port 27017 --quiet + interval: 5s + timeout: 30s + start_period: 0s + retries: 30 + command: ["--replSet", "rs0", "--bind_ip_all", "--port", "27017"] profiles: - all - - mongodb - - mongoonly - kafka - kafkaonly + - mongodb + - mongoonly - curriculum - encounter - partner @@ -170,7 +171,7 @@ services: mongodb: condition: service_healthy environment: - - CONNECTION_STRING=mongodb://root:example@mongodb:27017 + - CONNECTION_STRING=mongodb://mongodb:27017/?replicaSet=rs0 - LOAD_TEST_DATA=true - DB_NAME=mentorHub volumes: @@ -186,7 +187,7 @@ services: mongodb: condition: service_healthy environment: - - CONNECTION_STRING=mongodb://root:example@mongodb:27017 + - CONNECTION_STRING=mongodb://mongodb:27017/?replicaSet=rs0 - LOAD_TEST_DATA=true - DB_NAME=mentorHub profiles: @@ -237,7 +238,7 @@ services: environment: ELASTIC_CONNECTION_STRING: elasticsearch:// KAFKA_CONNECT_URL: kafka-connect:// - MONGODB_URI: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true + MONGODB_URI: mongodb://mongodb:27017/?replicaSet=rs0 depends_on: mentorhub-msm: condition: service_completed_successfully @@ -260,7 +261,7 @@ services: ports: - 8088:8088 environment: - CONNECTION_STRING: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true + CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 depends_on: mentorhub-msm: condition: service_completed_successfully @@ -275,7 +276,7 @@ services: ports: - 8090:8090 environment: - CONNECTION_STRING: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true + CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 depends_on: mentorhub-msm: condition: service_completed_successfully @@ -290,7 +291,7 @@ services: ports: - 8084:8084 environment: - CONNECTION_STRING: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true + CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 depends_on: mentorhub-msm: condition: service_completed_successfully @@ -305,7 +306,7 @@ services: ports: - 8082:8082 environment: - CONNECTION_STRING: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true + CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 depends_on: mentorhub-msm: condition: service_completed_successfully @@ -334,7 +335,7 @@ services: ports: - 8086:8086 environment: - CONNECTION_STRING: mongodb://root:example@mongodb:27017/?tls=false&directConnection=true + CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 depends_on: mentorhub-msm: condition: service_completed_successfully @@ -344,7 +345,7 @@ services: - topic-api ################################## - # SPA's start here + # SPA's ################################## mentorhub-curriculum-ui: image: ghcr.io/agile-learning-institute/mentorhub-curriculum-ui:latest diff --git a/mentorHub-developer-edition/README.md b/mentorHub-developer-edition/README.md index 75f832b..c216bee 100644 --- a/mentorHub-developer-edition/README.md +++ b/mentorHub-developer-edition/README.md @@ -17,6 +17,13 @@ Execute the following command from your terminal window, and identify an install /bin/bash <(curl https://raw.githubusercontent.com/agile-learning-institute/mentorHub/main/mentorHub-developer-edition/install) ``` +## Local access to MongoDB + +Access to the MongoDB from you machine requires configuration of the mongodb host in your /etc/hosts file. You can use the following command to make this change. +```sh +echo '127.0.0.1 mongodb' | sudo tee -a /etc/hosts +``` + ## Use After installation you can use the ``mh`` command to manage the mentorHub micro-services. Here are a few examples. From 859b163a8197732de88da719c5c27aff0cc2a998 Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Sun, 1 Dec 2024 16:56:35 -0500 Subject: [PATCH 10/25] elastic container mongo connection string update --- docker-configurations/docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index 7bcf8f5..33793cd 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -215,7 +215,7 @@ services: image: ghcr.io/agile-learning-institute/mentorhub-elasticsearch:latest environment: CLIENT_OPTIONS: '{"node":"http://elasticsearch:9200"}' - MONGO_CONNECTION_STRING: mongodb://root:example@mongodb:27017 + MONGO_CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 LOAD_TEST_DATA: true depends_on: mentorhub-msm: From 0db2d83a9dc28bf4580da1f196b94a374b3f1c7c Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Tue, 3 Dec 2024 20:02:19 -0500 Subject: [PATCH 11/25] kafka-connect configuration improvements --- docker-configurations/docker-compose.yaml | 61 ++++++----------------- 1 file changed, 14 insertions(+), 47 deletions(-) diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index 33793cd..4557688 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -20,10 +20,10 @@ services: command: ["--replSet", "rs0", "--bind_ip_all", "--port", "27017"] profiles: - all - - kafka - - kafkaonly + - kafka-connect - mongodb - mongoonly + - elasticsearch - curriculum - encounter - partner @@ -58,11 +58,10 @@ services: interval: 10s timeout: 5s retries: 5 - start_period: 10s + start_period: 15s profiles: - all - - kafka - - kafkaonly + - kafka-connect - elasticsearch - elasticonly - search-api @@ -75,15 +74,15 @@ services: ports: - 5601:5601 depends_on: - - elasticsearch + elasticsearch: + condition: service_healthy environment: ELASTICSEARCH_URL: http://elasticsearch:9200 ELASTICSEARCH_HOSTS: http://elasticsearch:9200 XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: c69548d9027afcf4d55146b1d425a9f4c69548d9027afcf4d55146b1d425a9f4 profiles: - all - - kafka - - kafkaonly + - kafka-connect - elasticsearch - elasticonly - search-api @@ -97,10 +96,7 @@ services: - "2181:2181" profiles: - all - - kafka - - kafkaonly - - search-api - - search + - kafka-connect ################################## # Kafka event bus @@ -123,10 +119,7 @@ services: - zookeeper profiles: - all - - kafka - - kafkaonly - - search-api - - search + - kafka-connect ################################## # Kafka Connector (Custom connector with Mongo and Elastic plugins) @@ -155,10 +148,7 @@ services: condition: service_completed_successfully profiles: - all - - kafka - - kafkaonly - - search-api - - search + - kafka-connect ################################## # Backing Service Configuration Utilities @@ -192,8 +182,7 @@ services: - DB_NAME=mentorHub profiles: - all - - kafka - - kafkaonly + - kafka-connect - mongodb - curriculum - encounter @@ -222,33 +211,11 @@ services: condition: service_completed_successfully elasticsearch: condition: service_healthy + mongodb: + condition: service_healthy profiles: - all - - kafka - - kafkaonly - - elasticsearch - - search-api - - search - - ################################## - # Initilize Kafka and configure Kafka Connectors - mentorhub-kafka: - image: ghcr.io/agile-learning-institute/mentorhub-kafka:latest - restart: no - environment: - ELASTIC_CONNECTION_STRING: elasticsearch:// - KAFKA_CONNECT_URL: kafka-connect:// - MONGODB_URI: mongodb://mongodb:27017/?replicaSet=rs0 - depends_on: - mentorhub-msm: - condition: service_completed_successfully - mentorhub-elasticsearch: - condition: service_completed_successfully - kafka-connect: - condition: service_started - profiles: - - all - - kafka + - kafka-connect - search-api - search From af98e2dafc479d716c0c7a592ab0f58b394eb6e8 Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Tue, 3 Dec 2024 21:12:25 -0500 Subject: [PATCH 12/25] housekeeping --- docker-configurations/docker-compose.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index 4557688..a7ab89f 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -142,9 +142,9 @@ services: depends_on: kafka: condition: service_started - mentorhub-msm: + initilize-mongodb: condition: service_completed_successfully - mentorhub-elasticsearch: + initilize-elasticsearch: condition: service_completed_successfully profiles: - all @@ -153,7 +153,7 @@ services: ################################## # Backing Service Configuration Utilities ################################## - # Mongo Schema Manager utility - for testing of mentorhub-msm + # Mongo Schema Manager utility - for testing of initilize-mongodb # Not a part of the deployment code msm: image: ghcr.io/agile-learning-institute/msm:latest @@ -171,7 +171,7 @@ services: ################################## # Initilize MongoDB and load test data - mentorhub-msm: + initilize-mongodb: image: ghcr.io/agile-learning-institute/mentorhub-msm:latest depends_on: mongodb: @@ -200,14 +200,14 @@ services: ################################## # Initilize Elasticsearch and load test data - mentorhub-elasticsearch: + initilize-elasticsearch: image: ghcr.io/agile-learning-institute/mentorhub-elasticsearch:latest environment: CLIENT_OPTIONS: '{"node":"http://elasticsearch:9200"}' MONGO_CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 LOAD_TEST_DATA: true depends_on: - mentorhub-msm: + initilize-mongodb: condition: service_completed_successfully elasticsearch: condition: service_healthy @@ -230,7 +230,7 @@ services: environment: CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 depends_on: - mentorhub-msm: + initilize-mongodb: condition: service_completed_successfully profiles: - all @@ -245,7 +245,7 @@ services: environment: CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 depends_on: - mentorhub-msm: + initilize-mongodb: condition: service_completed_successfully profiles: - all @@ -260,7 +260,7 @@ services: environment: CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 depends_on: - mentorhub-msm: + initilize-mongodb: condition: service_completed_successfully profiles: - all @@ -275,7 +275,7 @@ services: environment: CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 depends_on: - mentorhub-msm: + initilize-mongodb: condition: service_completed_successfully profiles: - all @@ -304,7 +304,7 @@ services: environment: CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 depends_on: - mentorhub-msm: + initilize-mongodb: condition: service_completed_successfully profiles: - all From 9b5e6d2005f8752eb4e48f6f795df590a5d09881 Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Tue, 3 Dec 2024 23:11:02 -0500 Subject: [PATCH 13/25] fixed search-api depencency --- docker-configurations/docker-compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index a7ab89f..5bfed21 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -290,7 +290,7 @@ services: environment: HOST: mentorhub-searchdb depends_on: - mentorhub-searchinit: + initilize-elasticsearch: condition: service_completed_successfully profiles: - all From d2c6378e0bf76d6a23e63957bd0aa1b743f9cf10 Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Tue, 3 Dec 2024 23:36:05 -0500 Subject: [PATCH 14/25] Update architecture diagram for kafka-connect --- specifications/ARCHITECTURE.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/specifications/ARCHITECTURE.md b/specifications/ARCHITECTURE.md index 1b2f27f..7c3027c 100644 --- a/specifications/ARCHITECTURE.md +++ b/specifications/ARCHITECTURE.md @@ -20,18 +20,17 @@ Integration domains use request(sync)/reply(source) collections to implement asy ```mermaid flowchart LR - APIG((URL Router)) - BUS(AWS Event Stream) - --> DataLake[(Data Lake)] + APIG((API Gateway)) + BUS(Kafka Connect) + BUS --> DataLake[(Data Lake)] APIG --> SearchUI([mentorHub-search-ui]) subgraph Search SearchUI --> SearchAPI(mentorHub-search-api) - --> SearchService[(OpenSearch)] - Lambda --> SearchService + --> SearchService[(ElasticSearch)] end - Lambda <--> BUS + SearchService --> BUS APIG --> PersonUI([mentorHub-person-ui]) From 39a009fe141c8c18d232b9eef374130f23f98bc2 Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Tue, 3 Dec 2024 23:38:00 -0500 Subject: [PATCH 15/25] APIG update --- specifications/ARCHITECTURE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifications/ARCHITECTURE.md b/specifications/ARCHITECTURE.md index 7c3027c..be772ed 100644 --- a/specifications/ARCHITECTURE.md +++ b/specifications/ARCHITECTURE.md @@ -20,7 +20,7 @@ Integration domains use request(sync)/reply(source) collections to implement asy ```mermaid flowchart LR - APIG((API Gateway)) + APIG((Browser)) BUS(Kafka Connect) BUS --> DataLake[(Data Lake)] From aad10b79b221fd8cbffa78791e64ee2c3e92f559 Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Wed, 4 Dec 2024 13:37:19 -0500 Subject: [PATCH 16/25] s/initilize/initialize/g --- docker-configurations/docker-compose.yaml | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index 5bfed21..009cf29 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -142,9 +142,9 @@ services: depends_on: kafka: condition: service_started - initilize-mongodb: + initialize-mongodb: condition: service_completed_successfully - initilize-elasticsearch: + initialize-elasticsearch: condition: service_completed_successfully profiles: - all @@ -153,7 +153,7 @@ services: ################################## # Backing Service Configuration Utilities ################################## - # Mongo Schema Manager utility - for testing of initilize-mongodb + # Mongo Schema Manager utility - for testing of initialize-mongodb # Not a part of the deployment code msm: image: ghcr.io/agile-learning-institute/msm:latest @@ -170,8 +170,8 @@ services: - msm ################################## - # Initilize MongoDB and load test data - initilize-mongodb: + # Initialize MongoDB and load test data + initialize-mongodb: image: ghcr.io/agile-learning-institute/mentorhub-msm:latest depends_on: mongodb: @@ -199,15 +199,15 @@ services: - msm ################################## - # Initilize Elasticsearch and load test data - initilize-elasticsearch: + # Initialize Elasticsearch and load test data + initialize-elasticsearch: image: ghcr.io/agile-learning-institute/mentorhub-elasticsearch:latest environment: CLIENT_OPTIONS: '{"node":"http://elasticsearch:9200"}' MONGO_CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 LOAD_TEST_DATA: true depends_on: - initilize-mongodb: + initialize-mongodb: condition: service_completed_successfully elasticsearch: condition: service_healthy @@ -230,7 +230,7 @@ services: environment: CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 depends_on: - initilize-mongodb: + initialize-mongodb: condition: service_completed_successfully profiles: - all @@ -245,7 +245,7 @@ services: environment: CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 depends_on: - initilize-mongodb: + initialize-mongodb: condition: service_completed_successfully profiles: - all @@ -260,7 +260,7 @@ services: environment: CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 depends_on: - initilize-mongodb: + initialize-mongodb: condition: service_completed_successfully profiles: - all @@ -275,7 +275,7 @@ services: environment: CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 depends_on: - initilize-mongodb: + initialize-mongodb: condition: service_completed_successfully profiles: - all @@ -290,7 +290,7 @@ services: environment: HOST: mentorhub-searchdb depends_on: - initilize-elasticsearch: + initialize-elasticsearch: condition: service_completed_successfully profiles: - all @@ -304,7 +304,7 @@ services: environment: CONNECTION_STRING: mongodb://mongodb:27017/?replicaSet=rs0 depends_on: - initilize-mongodb: + initialize-mongodb: condition: service_completed_successfully profiles: - all From 3f5c16d552301f52ecc6080ffdc7f7cbb7c76f65 Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Wed, 4 Dec 2024 14:46:52 -0500 Subject: [PATCH 17/25] Repo layout updates --- specifications/CICD.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/specifications/CICD.md b/specifications/CICD.md index e7a8bde..61f08c3 100644 --- a/specifications/CICD.md +++ b/specifications/CICD.md @@ -2,13 +2,10 @@ ## Overview -Repo Structure Standards have a /src/docker folder with the following files: - -- /src/docker/docker-build.sh -- /src/docker/Dockerfile - -docker-build.sh uses docker build to create a single image targeted to the users architecture. Multi-Architecture images are created and pushed to our GitHub Container Registry by GitHub Actions CI. -These GitHub actions build and push containers with a :latest tag +Repo Structure Standards +- Each repo should use it's native dependency management tool (npm, pipenv, maven, etc.) to support automations like container creation and testing. +- The Dockerfile should be at the root of the repo, sample Dockerfiles can be found in the [docker-configurations](../docker-configurations/) folder. +- Multi-Architecture images (AMD and ARM) are created and pushed to our GitHub Container Registry by GitHub Actions CI. All Dockerfiles should support these CPU architectures. These GitHub actions build and push containers with a :latest tag ## Dockerfile Templates From f6814aba632ba96256c4800d4521a472d048988c Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Wed, 4 Dec 2024 15:04:07 -0500 Subject: [PATCH 18/25] a few principle updates --- specifications/PRINCIPLES.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/specifications/PRINCIPLES.md b/specifications/PRINCIPLES.md index 1a04d8e..d16fab1 100644 --- a/specifications/PRINCIPLES.md +++ b/specifications/PRINCIPLES.md @@ -91,16 +91,15 @@ One of the defining characteristics of a Microservice is that it is “autonomou - A Stateless, Restful API - Enforcing Access control with Bearer Tokens - Business Logic, including Advanced Computation, Neural Algorithms, etc. - - Complete validation of data - multi-field or complex validation constraints - - Some validation will be “duplicated” or auto-generated based on JSON schema constraints - - Some validation will only be done by API layer. Validation constraints at the Data layer should be relaxed relative to the constraints enforced by the API. + - Validation of data - multi-field or complex validation constraints + - Some validation will be “duplicated” in the UI + - The data layer implements well defined schemas constraints and the API can deligate enforcement of these to the database. - The Operations (SRE Guild) - - CI/CD with K8S, Helm?, Argo? - - ? Private ? Docker Container registry - - ? Private ? Dependency Registries (Pypl, npm, nuget, maven) - - Dependency Governance? - - Open Source Service Implementations - - KeyCloak Identity Service + - CI/CD with K8S, Helm, Argo + - Private/Public Docker Container registries + - Private/Public Dependency Registries (Pypl, npm, nuget, maven) if needed + - Dependency Governance - license, security, quality reporting + - Identity Services - KeyCloak or Auth0 ## Development Contracts @@ -116,18 +115,20 @@ Data Engineers frequently use service bus architectures to support publish/subsc ## Service Granularity -If a Microservice architecture divides the application into microservices one of the first questions that comes up is service granularity. In our opinion, is easy to get carried away and break an application up into dozens of services ( or serverless functions! ) when they would be better addressed with a single API on a single Model. We start by breaking an application up into services that can be independently developed, tested and deployed. We strive for services that are very simple and have 1 user interface, that communicates with 1 API, that uses 1 database. While not all solutions will use this pattern, deviations from this pattern should deserve extra consideration. +If a Microservice architecture divides the application into microservices one of the first questions that comes up is service granularity. We start by breaking an application up into services that can be independently developed, tested and deployed. We strive for services that are very simple and have 1 user interface, that communicates with 1 API, that uses 1 database. While not all solutions will use this pattern, deviations from this pattern should deserve extra consideration. When identifying bounded domains there are a number of factors that can influence service size. Isolation of subsystems that have special security or performance requirements is one driving factor. Isolating identity services that have special data protection measures, and isolation of Personally Identifiable Information (PII) from access credentials is a best practice. Isolation of search use cases is another common division based on the impact of search on database performance, and allows for optimization of data structures to support search. Integrations are a third common pattern for isolation based on avoiding run-time dependencies on external services. Another factor that will influence the granularity of services is the principle of independently developed, tested and deployed components. If a problem space is large enough to require multiple developers to work on any component of that service then that service is probably too large. +It is easy to get carried away and break an application up into dozens of services ( or serverless functions! ) when they would be better addressed with a single API on a single Model. The mentorHub architecture uses fairly fine grained microservices, both for reasons of disposability and in order to provide more members the chance to "own" a code base. + ## Service Configurability Microservices are by nature small, and should be viewed as bespoke components of the system. In general, it’s best to minimize configuration options and the development, testing and release complications associated with them. That being said, every service will have need of “secret” configuration values, or other values that describe the environment the service is running in. Our services will always look to environment variables to provide this information. Services that want to support other configuration approaches are encouraged to use this hierarchy, that is if the first is not found, move on to the second and so forth: -- Discrete environment variable values (configuration options) - Discrete configuration files (secure secrets) +- Discrete environment variable values (configuration options) Configuration options should be specified on container startup, and managed by K8S. Use of configuration options should be limited to required environmental values. Adding configuration options will require special consideration when designing, building, and running automated testing. From 1d65c1e5b7eb1441637ca9df43ad63944821acd9 Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Wed, 4 Dec 2024 15:16:29 -0500 Subject: [PATCH 19/25] fixed misspellings --- .vscode/settings.json | 7 +++++++ mentorHub-developer-edition/README.md | 10 +++++----- specifications/CICD.md | 24 ++++++++++++------------ specifications/PRINCIPLES.md | 20 ++++++++++---------- specifications/ROADMAP.md | 8 ++++---- 5 files changed, 38 insertions(+), 31 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4afa607 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "cSpell.words": [ + "Mentee", + "searchinit", + "Sree" + ] +} \ No newline at end of file diff --git a/mentorHub-developer-edition/README.md b/mentorHub-developer-edition/README.md index c216bee..035382c 100644 --- a/mentorHub-developer-edition/README.md +++ b/mentorHub-developer-edition/README.md @@ -7,11 +7,11 @@ If you are a software engineer contributing to the mentorHub platform, or a soft - [ ] MacOS or Linux. - If you are a Windows user follow the Virtual Machine, or WSL instructions from [Odin Foundations installations lesson](https://www.theodinproject.com/lessons/foundations-installations#os-installation) - [ ] [Docker Desktop](https://www.docker.com/products/docker-desktop/) -- [ ] zsh Shell, Defaut for MacOS, [install for linux users](https://phoenixnap.com/kb/install-zsh-ubuntu) +- [ ] zsh Shell. It is the Default shell for MacOS, [install for linux users](https://phoenixnap.com/kb/install-zsh-ubuntu) - you can do the basic install, it doesn't need to be your default shell or have any extra tools. So long as the ``!/bin/zsh`` shebang works correctly you should be good to go. ## Installation -Execute the following command from your terminal window, and identify an installation location when promted, and your done. +Execute the following command from your terminal window, and identify an installation location when prompted, and your done. ```bash /bin/bash <(curl https://raw.githubusercontent.com/agile-learning-institute/mentorHub/main/mentorHub-developer-edition/install) @@ -57,7 +57,7 @@ Shell Config .zshrc not found Shell Config .zshrc not found ``` -This indicates that you do not have an initilization file. Issue the following command, and then re-run the install. +This indicates that you do not have an initialization file. Issue the following command, and then re-run the install. #### Mac @@ -82,10 +82,10 @@ sudo nano ~/.bashrc This will open a terminal text editor. In the text editor you can use the arrow keys (←↑→↓) to move the cursor. Hold the down (↓) arrow key to until you get to the bottom of the file. You might see something like ![image](https://github.com/agile-learning-institute/mentorHub/assets/67389882/1d7ecdd5-1f32-44d1-9b67-a0947e1f86bd) Navigate your cursor to the line with the long comment, move the cursor to the `e` in `export`, and press `enter` to create a new line. To save and exit, press `control + x` then `y` to confirm, then hit `enter` to confirm again. After that, run `source ~/.bashrc` (or where ever your `.bashrc` file is) and try `mh` again. It should work. If not, try restarting your WSL terminal. # Contributing -If you are interested in contributing to the MentorHub Developer Edition you should familarize yourself with the [mh zsh script](./mh) and the [docker compose file](../docker-configurations/docker-compose.yaml). If you are editing these files and want to test your changes locally, you can use the following command +If you are interested in contributing to the MentorHub Developer Edition you should familiarize yourself with the [mh zsh script](./mh) and the [docker compose file](../docker-configurations/docker-compose.yaml). If you are editing these files and want to test your changes locally, you can use the following command ```sh make install ``` -This script will copy the mh script and docker-compose file to your ~/Applications/Mentorhub/mentorhub folder, which is the default install locaiton. If you have installed in a different location you will need to manually copy the files to your install location to test things locally. +This script will copy the mh script and docker-compose file to your ~/Applications/Mentorhub/mentorhub folder, which is the default install location. If you have installed in a different location you will need to manually copy the files to your install location to test things locally. diff --git a/specifications/CICD.md b/specifications/CICD.md index 61f08c3..a1e49db 100644 --- a/specifications/CICD.md +++ b/specifications/CICD.md @@ -3,25 +3,25 @@ ## Overview Repo Structure Standards -- Each repo should use it's native dependency management tool (npm, pipenv, maven, etc.) to support automations like container creation and testing. +- Each repo should use it's native dependency management tool (npm, pipenv, maven, etc.) to support automatons like container creation and testing. - The Dockerfile should be at the root of the repo, sample Dockerfiles can be found in the [docker-configurations](../docker-configurations/) folder. - Multi-Architecture images (AMD and ARM) are created and pushed to our GitHub Container Registry by GitHub Actions CI. All Dockerfiles should support these CPU architectures. These GitHub actions build and push containers with a :latest tag ## Dockerfile Templates -See the [docker-configurations](../docker-configurations/README.md) folder for our master ``docker-compose.yaml`` and tempaltes for 2-stage Dockerfiles. +See the [docker-configurations](../docker-configurations/README.md) folder for our master ``docker-compose.yaml`` and templates for 2-stage Dockerfiles. ## A note on Versioning -All of the API and UI microservices use a semantic versioning approach, with Major and Minor version numbers that are maintained by the developer. The Patch portion of a verion number is automatically genearted by the Docker Build and placed in a text file at a specific location for use by the code. All code should have observability for these version numbers to support incident response. +All of the API and UI microservices use a semantic versioning approach, with Major and Minor version numbers that are maintained by the developer. The Patch portion of a version number is automatically generated by the Docker Build and placed in a text file at a specific location for use by the code. All code should have observability for these version numbers to support incident response. ## Observability -See the [Service Observibility](./PRINCIPLES.md#service-observability) in our Architecture Principles document for observability standards. +See the [Service Observability](./PRINCIPLES.md#service-observability) in our Architecture Principles document for observability standards. ## GitHub Docker Container Registry -We are using the GitHub Docker Container Registry [this article](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry) is helpful in understandign that service. +We are using the GitHub Docker Container Registry [this article](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry) is helpful in understanding that service. We are using the [Build and push Docker images](https://github.com/marketplace/actions/build-and-push-docker-images) action, in conjunction with the /src/docker/Dockerfile of each repo. @@ -36,9 +36,9 @@ To make sure that the CI GitHub Actions have the proper access to the registry - Package Access - Make sure repository access is Read-Write or Admin in Package settings - Repository Settings, Actions, General, Workflow permissions then select Read and Write -## AWS Elastic Container Registrey ([ECR](https://aws.amazon.com/ecr/)) +## AWS Elastic Container Registry ([ECR](https://aws.amazon.com/ecr/)) -We will need to update all of the CI to leverage ECR in place of the GitHub Container Registry. This will be required to address deployment to any of the AWS mangaed container services. +We will need to update all of the CI to leverage ECR in place of the GitHub Container Registry. This will be required to address deployment to any of the AWS managed container services. ### Research @@ -49,14 +49,14 @@ We will need to update all of the CI to leverage ECR in place of the GitHub Cont - Updated docker-compose.yaml to be [ecr-compose.yaml](./ecrMigration/ecr-compose.yaml) with new image names - Tested with ``docker compose -f "ecr-compose.yaml" --profile person up --detach`` command - and looking at the person UI. -This proved out that we can push images, and all of them are multi-platform images, to ECR. I was confused for a while by the ECR terminology, but I now understand that a repositorey in ECR terms is a "container image name" with multiple taged versions of that image. Once I understood that I was able to create a smalls script to move a contaier image from ghcr to ecr. +This proved out that we can push images, and all of them are multi-platform images, to ECR. I was confused for a while by the ECR terminology, but I now understand that a repository in ECR terms is a "container image name" with multiple tagged versions of that image. Once I understood that I was able to create a smalls script to move a container image from ghcr to ecr. ### update -- Created an IAM user for programitc access in the IAM Console (NOT the IAM Identity Center) github-actions-ecr-access +- Created an IAM user for programmatic access in the IAM Console (NOT the IAM Identity Center) github-actions-ecr-access - Attach the AmazonEC2ContainerRegistryFullAccess permissions policy to the IAM user -- Generated Access Keys for programatic access -- Created GitHub Reposotory Secrets for GitHub Actions with AWS Key ID / Value +- Generated Access Keys for programmatic access +- Created GitHub Repository Secrets for GitHub Actions with AWS Key ID / Value - Read up on the [Amazon ECR Login GitHub action](https://github.com/marketplace/actions/amazon-ecr-login-action-for-github-actions#building-and-pushing-an-image), and the [configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) documentation for parameters to use - Updated the actions docker-push.yaml file to use the new AWS values, tested and successfully built and pushed person-ui image. @@ -67,7 +67,7 @@ This proved out that we can push images, and all of them are multi-platform imag ### Next Steps -- [x] Move secrets to organizatin level +- [x] Move secrets to organization level - [ ] Move to a public ECR - https://docs.aws.amazon.com/AmazonECR/latest/public/getting-started-cli.html#cli-authenticate-registry - [ ] Research best-practices and consider role based access. diff --git a/specifications/PRINCIPLES.md b/specifications/PRINCIPLES.md index d16fab1..999063c 100644 --- a/specifications/PRINCIPLES.md +++ b/specifications/PRINCIPLES.md @@ -4,7 +4,7 @@ While there is no single definition for microservices, a consensus view has evolved over time in the industry. Micro Services are small in size, messaging-enabled, bounded by contexts, autonomously developed, independently deployable, decentralized and built and released with automated processes. -The micorservice principles used by the mentorHub platform are: +The microservice principles used by the mentorHub platform are: - [The 12 Factor Application guides](#the-12-factor-app) - [Operations in Microservice Architectures](#operations-in-cloud-native-world) @@ -25,15 +25,15 @@ The book “The 12 Factor App” by Adam Wiggins has often been cited as a semin 1. Dependencies - Declarative, not implied - Use private pip, npm, nuget, maven packages to share code shared between repo' 1. Configuration - Describe “The environment” in “the Environment” - - Configuration values from environment variables: see [Service Configurabilityh](#service-configurability) + - Configuration values from environment variables: see [Service Configurability](#service-configurability) 1. Backing Services - Treat as attached by the platform - - Containerized backing services support local developement environment + - Containerized backing services support local development environment - Orchestrated infrastructure provides backing services with K8S at runtime 1. Build, release run - Simple delivery pipeline consisting of only build-release-run - CI Pipelines should be very simple and standardized by technology. - - Change management is acomplished with container image tagging. + - Change management is accomplished with container image tagging. 1. Process - Designed and deployed as “Stateless” processes - - Dockerized means stateless + - Docker containers are stateless. 1. Concurrency - Scale by adding processes - (Process) Containers are scaled by K8S 1. Port Binding @@ -44,7 +44,7 @@ The book “The 12 Factor App” by Adam Wiggins has often been cited as a semin - Disposability also has implications for service granularity 1. Parity - Dev / Test / Prod should be as similar as possible - Infrastructure as Code used to deploy infrastructure for an Environment (Dev, Test, Prod, etc.) - - Infrastructure then deployes containers based on a a matching Image tag + - Infrastructure then deploys containers based on a a matching Image tag - SRE Automation is used to add a tag to an image based on an existing tag, in this way a container can be "promoted" from one environment to the next. This can also be used to deployed the system to a new "Just in time" environment for use in Training, Sales, or other purposes. 1. Logs - Write event streams to StdOut, allow the platform to consume/manage them - We will use AWS OpenSearch as a log aggregation platform. @@ -65,7 +65,7 @@ In the book “Cloud Adoption Playbook” written by a team of IBM Distinguished - Automate Everything - If you do it twice, automate it the third time. - - Build Runbooks to standarize automation + - Build Runbooks to standardize automation - Favor Simplicity ## Separation of Concerns @@ -93,7 +93,7 @@ One of the defining characteristics of a Microservice is that it is “autonomou - Business Logic, including Advanced Computation, Neural Algorithms, etc. - Validation of data - multi-field or complex validation constraints - Some validation will be “duplicated” in the UI - - The data layer implements well defined schemas constraints and the API can deligate enforcement of these to the database. + - The data layer implements well defined schemas constraints and the API can delegate enforcement of these to the database. - The Operations (SRE Guild) - CI/CD with K8S, Helm, Argo - Private/Public Docker Container registries @@ -136,13 +136,13 @@ Configuration options should be specified on container startup, and managed by K Service disposability has two very different meanings within an architecture. The first is pretty straight forward, in an orchestrated container environment the developer should assume that the process will be stopped and started frequently. While the application and containers may in fact have rather long run life, the principle of fast start / stop operations is a key attribute of a service that can be orchestrated effectively. -The second and more esoteric aspect of disposability has to do with the size of the service. The principle is that recreating a service from scracth may be eaiser than untangling complex code written by a long-gone developer. This principle has a direct impact on the autonomous development aspects of a microservice architecture and dove-tails with the configurability principles. +The second and more esoteric aspect of disposability has to do with the size of the service. The principle is that recreating a service from scratch may be easier than untangling complex code written by a long-gone developer. This principle has a direct impact on the autonomous development aspects of a microservice architecture and dove-tails with the configurability principles. ## Service Observability While the Docker environment itself can provide visibility into container resource utilization (Memory, CPU, Network and Disk) there are typically additional pieces of information that should be observable within the system. We have adopted a standard of implementing two standard endpoints that expose this additional information. -The Health endpoint is designed to provide information about the health of the service, and follows the standard endpoint definition used by the Promethius monitoring project. This will include information about the state of backing services (Database, ServiceBus, Integration Endpoints etc.) as well as the performance of the services (Usage, Response Time, etc.) +The Health endpoint is designed to provide information about the health of the service, and follows the standard endpoint definition used by the Prometheus monitoring project. This will include information about the state of backing services (Database, ServiceBus, Integration Endpoints etc.) as well as the performance of the services (Usage, Response Time, etc.) The Config endpoint is designed to provide information about the services configuration at runtime. This includes version and release information, non-secret connection data, git hashes, dependency information, or other information that describes the API that is running. diff --git a/specifications/ROADMAP.md b/specifications/ROADMAP.md index 63c6909..fe708c3 100644 --- a/specifications/ROADMAP.md +++ b/specifications/ROADMAP.md @@ -15,12 +15,12 @@ The Roadmap below identifies that a significant portion of the "SRE First" **Now - [x] Sree the SRE opens an admin view in a SPA and then they can review Versions of different components of the system, configuration values, and other information helpful during incident response. - [x] Tonya the Tester issues a single bash command and then the solution is available for local testing. - [ ] A new container is deployed to a registry, and tagged for the DEV environment and then the development environment deploys the new container. -- [ ] Sree the SRE documents the infrastructure for an environment and runs a script and then a new cloud enviornment is provisioned and configured to deploy images with a unique tag. -- [ ] Sree the SRE runs a "promote" runbook, and then a new tag is associated with images that contain another tag. i.e. Promte all current Dev containers to Test. +- [ ] Sree the SRE documents the infrastructure for an environment and runs a script and then a new cloud environment is provisioned and configured to deploy images with a unique tag. +- [ ] Sree the SRE runs a "promote" runbook, and then a new tag is associated with images that contain another tag. i.e. Promote all current Dev containers to Test. ## Next -- [ ] Mentor colaborates with the apprentice to update their curriculum and then the system suggests content and warns if the work assigned exceeds the members committed capacity. Suggestions can be based on the following factors: +- [ ] Mentor collaborates with the apprentice to update their curriculum and then the system suggests content and warns if the work assigned exceeds the members committed capacity. Suggestions can be based on the following factors: - Current skills in the topic - Desired specialty - Member goals @@ -35,7 +35,7 @@ The Roadmap below identifies that a significant portion of the "SRE First" **Now - [ ] Sree the SRE runs a runbook script and then services from one environment are promoted into another. -- [ ] Sree the SRE reviews a Promethius/Grafana monitoring portal including health information from system APIs, and then they can view performance and throughput metrics to support incident response. +- [ ] Sree the SRE reviews a Prometheus/Grafana monitoring portal including health information from system APIs, and then they can view performance and throughput metrics to support incident response. - [ ] Sam the Software Engineer creates black-box testing for their components and then they can be more confident in the performance of their code, and they can provide a starting place for the SQA team to build automated end-to-end testing. From 7520a8dba706634f2c528d9dde28c807af2d9a3b Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Wed, 4 Dec 2024 19:09:58 -0500 Subject: [PATCH 20/25] elasticsearch profile update --- docker-configurations/docker-compose.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index 009cf29..717abe5 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -183,6 +183,7 @@ services: profiles: - all - kafka-connect + - elasticsearch - mongodb - curriculum - encounter @@ -215,6 +216,7 @@ services: condition: service_healthy profiles: - all + - elasticsearch - kafka-connect - search-api - search From c9059603eac98062df6bf78e8b4c28a4dafe3ad0 Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Wed, 4 Dec 2024 20:52:55 -0500 Subject: [PATCH 21/25] compose profile tuning --- .vscode/settings.json | 1 + docker-configurations/docker-compose.yaml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index 4afa607..202ebc7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "cSpell.words": [ + "elasticonly", "Mentee", "searchinit", "Sree" diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index 717abe5..78647db 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -24,6 +24,7 @@ services: - mongodb - mongoonly - elasticsearch + - elasticonly - curriculum - encounter - partner @@ -184,6 +185,7 @@ services: - all - kafka-connect - elasticsearch + - elasticonly - mongodb - curriculum - encounter From ea051fdae72eddf63779b4ef1057994ede835de3 Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Thu, 5 Dec 2024 12:29:02 -0500 Subject: [PATCH 22/25] search-api connect string g fixed --- docker-configurations/docker-compose.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index 78647db..78eab91 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -293,6 +293,7 @@ services: - 8081:8081 environment: HOST: mentorhub-searchdb + CONNECTION_STRING: '{"node":"http://elasticsearch:9200"}' depends_on: initialize-elasticsearch: condition: service_completed_successfully From 106e937965d32f5c0f30511a5056ba5a478c9aab Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Sat, 7 Dec 2024 13:14:27 -0500 Subject: [PATCH 23/25] networking update for elasticsearch service --- docker-configurations/docker-compose.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index 78eab91..ed061c6 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -48,6 +48,7 @@ services: - "ES_JAVA_OPTS=-Xms2048m -Xmx2048m" - "xpack.security.enabled=false" - "action.destructive_requires_name=false" + - "network.bind_host=0.0.0.0" ulimits: memlock: soft: -1 From 005061e6150690d5c3798b3f567d90f2c72087b4 Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Sat, 7 Dec 2024 13:35:15 -0500 Subject: [PATCH 24/25] ElasticSearch simplification from M Quinn --- docker-configurations/docker-compose.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docker-configurations/docker-compose.yaml b/docker-configurations/docker-compose.yaml index ed061c6..94d3836 100644 --- a/docker-configurations/docker-compose.yaml +++ b/docker-configurations/docker-compose.yaml @@ -49,10 +49,6 @@ services: - "xpack.security.enabled=false" - "action.destructive_requires_name=false" - "network.bind_host=0.0.0.0" - ulimits: - memlock: - soft: -1 - hard: -1 ports: - 9200:9200 healthcheck: From 44364481c24d4539aa7e24c360b55feb2736c723 Mon Sep 17 00:00:00 2001 From: Mike Storey Date: Sat, 7 Dec 2024 17:39:02 -0500 Subject: [PATCH 25/25] fix arrows --- specifications/ARCHITECTURE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specifications/ARCHITECTURE.md b/specifications/ARCHITECTURE.md index be772ed..c211689 100644 --- a/specifications/ARCHITECTURE.md +++ b/specifications/ARCHITECTURE.md @@ -30,7 +30,7 @@ flowchart LR --> SearchAPI(mentorHub-search-api) --> SearchService[(ElasticSearch)] end - SearchService --> BUS + SearchService <--> BUS APIG --> PersonUI([mentorHub-person-ui])