diff --git a/.github/workflows/run-tests.sh b/.github/workflows/run-tests.sh index abe168bd..2c6a5831 100755 --- a/.github/workflows/run-tests.sh +++ b/.github/workflows/run-tests.sh @@ -31,6 +31,9 @@ elif [[ "${!changed_packages[*]}" == *"features/cluster-mode"* ]] && [[ $NODE_MO elif [[ "${!changed_packages[*]}" == *"infrastructure"* ]]; then DOCKER_HOST=ssh://ubuntu@$GITHUB_RUN_ID.jembi.cloud yarn test:"$NODE_MODE" else + # This ensures that the openhim and its mediators' tests are run only once when the openhim and its mediators have all been modified + openhimRan="false" + for folder_name in "${!changed_packages[@]}"; do echo "$folder_name was changed" @@ -40,7 +43,8 @@ else DOCKER_HOST=ssh://ubuntu@$GITHUB_RUN_ID.jembi.cloud yarn test:"$NODE_MODE":elk elif [[ $folder_name == *"kafka"* ]] || [[ $folder_name == *"monitoring"* ]]; then DOCKER_HOST=ssh://ubuntu@$GITHUB_RUN_ID.jembi.cloud yarn test:"$NODE_MODE":kafka - elif [[ $folder_name == *"openhim"* ]]; then + elif [[ $folder_name == *"openhim"* ]] && [[ $openhimRan == "false" ]]; then + openhimRan="true" DOCKER_HOST=ssh://ubuntu@$GITHUB_RUN_ID.jembi.cloud yarn test:"$NODE_MODE":openhim elif [[ $folder_name == *"reverse-proxy"* ]]; then DOCKER_HOST=ssh://ubuntu@$GITHUB_RUN_ID.jembi.cloud yarn test:"$NODE_MODE":nginx diff --git a/config.yaml b/config.yaml index bdff8925..8bd912d7 100644 --- a/config.yaml +++ b/config.yaml @@ -1,5 +1,5 @@ projectName: platform -image: jembi/platform:2.3.1 +image: jembi/platform:2.3.2 logPath: /tmp/logs packages: diff --git a/interoperability-layer-openhim/docker-compose-mongo.yml b/interoperability-layer-openhim/docker-compose-mongo.yml index a1184daa..c67589f6 100644 --- a/interoperability-layer-openhim/docker-compose-mongo.yml +++ b/interoperability-layer-openhim/docker-compose-mongo.yml @@ -3,6 +3,7 @@ version: "3.9" services: mongo-1: image: mongo:4.2 + command: ['--replSet', 'mongo-set', '--wiredTigerCacheSizeGB', '0.5'] volumes: - "openhim-mongo-01:/data/db" - "openhim-mongo-01-config:/data/configdb" diff --git a/interoperability-layer-openhim/initiate-replica-set.sh b/interoperability-layer-openhim/initiate-replica-set.sh index 3fa20ea6..3fc244b4 100755 --- a/interoperability-layer-openhim/initiate-replica-set.sh +++ b/interoperability-layer-openhim/initiate-replica-set.sh @@ -51,8 +51,8 @@ done # With docker swarm any manager can be the target but this bit of code only work if we target node-1 specifically. # Which is generally what we do, but if node-1 is down or we choose to target another node this won't work. container_name="" -if [[ "$(docker ps -f name=${STACK_NAME}_mongo-1 --format "{{.ID}}")" ]]; then - container_name="$(docker ps -f name=${STACK_NAME}_mongo-1 --format "{{.ID}}")" +if [[ "$(docker ps -f name=${STACK_NAME}_mongo --format "{{.ID}}")" ]]; then + container_name="$(docker ps -f name=${STACK_NAME}_mongo --format "{{.ID}}")" fi initiate_rep_set_response=$(docker exec -i "$container_name" mongo --eval "rs.initiate($config)") diff --git a/interoperability-layer-openhim/swarm.sh b/interoperability-layer-openhim/swarm.sh index f8b66ac1..56fb6fb5 100644 --- a/interoperability-layer-openhim/swarm.sh +++ b/interoperability-layer-openhim/swarm.sh @@ -53,6 +53,9 @@ function initialize_package() { if [[ "${CLUSTERED_MODE}" == "true" ]] && [[ "${ACTION}" == "init" ]]; then try "${COMPOSE_FILE_PATH}/initiate-replica-set.sh $STACK" throw "Fatal: Initiate Mongo replica set failed" + else + try "docker exec -i $(docker ps -q -f name=openhim_mongo) mongo --eval \"rs.initiate()\"" throw "Could not initiate replica set for the single mongo instance. Some services use \ + mongo event listeners which only work with a replica set" fi docker::deploy_service $STACK "${COMPOSE_FILE_PATH}" "docker-compose.yml" "$openhim_dev_compose_filename" diff --git a/openhim-mapping-mediator/docker-compose.yml b/openhim-mapping-mediator/docker-compose.yml index a3ec0279..3b62049d 100644 --- a/openhim-mapping-mediator/docker-compose.yml +++ b/openhim-mapping-mediator/docker-compose.yml @@ -2,16 +2,20 @@ version: '3.9' services: openhim-mapping-mediator: - image: jembi/openhim-mediator-mapping:v3.0.0 + image: jembi/openhim-mediator-mapping:v3.1.0 environment: OPENHIM_REGISTER: ${OPENHIM_REGISTER} MONGO_URL: ${OPENHIM_MONGO_URL} OPENHIM_URL: ${OPENHIM_URL} OPENHIM_USERNAME: ${OPENHIM_USERNAME} OPENHIM_PASSWORD: ${OPENHIM_PASSWORD} + KAFKA_BROKERS: ${KAFKA_BROKERS} + KAFKA_CLIENTID: ${KAFKA_CLIENTID} + KAFKA_CONSUMER_GROUPID: ${KAFKA_CONSUMER_GROUPID} networks: openhim: mongo: + kafka: networks: openhim: @@ -20,3 +24,6 @@ networks: mongo: name: openhim_mongo_public external: true + kafka: + name: kafka_public + external: true diff --git a/openhim-mapping-mediator/package-metadata.json b/openhim-mapping-mediator/package-metadata.json index 7023fcbd..353515e5 100644 --- a/openhim-mapping-mediator/package-metadata.json +++ b/openhim-mapping-mediator/package-metadata.json @@ -10,6 +10,9 @@ "OPENHIM_USERNAME": "root@openhim.org", "OPENHIM_MONGO_URL": "mongodb://mongo-1:27017/openhim", "OPENHIM_REGISTER": "true", - "OPENHIM_PASSWORD": "instant101" + "OPENHIM_PASSWORD": "instant101", + "KAFKA_BROKERS": "kafka-01:9092", + "KAFKA_CLIENTID": "mapping-mediator", + "KAFKA_CONSUMER_GROUPID": "mapping-mediator" } } diff --git a/remote-img-load.sh b/remote-img-load.sh index 9621ed37..1ccdf037 100755 --- a/remote-img-load.sh +++ b/remote-img-load.sh @@ -2,24 +2,24 @@ readonly HOST="$1" readonly USER=${2:-ubuntu} +TAG_NAME=${3:-latest} #Default to latest if version is not supplied + if [ -z "${HOST}" ]; then echo "Usage: ./remote-img-load.sh " exit 1 fi -TAG_NAME=${1:-latest} #Default to latest if no parameter supplied and no version is specified in the config.yaml file CONFIG_TAG=$(docker run --rm -v "${PWD}":/workdir mikefarah/yq:4.24.5 '.image' "config.yaml") if [ "$CONFIG_TAG" != "null" ]; then TagVersion=${CONFIG_TAG:15} if [ -n "$TagVersion" ]; then - if [[ -z "$1" ]]; then + if [[ -z "$3" ]]; then #Override the TAG_NAME with the one specified in config.yaml only if no parameter was supplied TAG_NAME=$TagVersion fi fi fi - ./build-image.sh "$TAG_NAME" echo "Transfering image to ${HOST} ..." -docker save jembi/platform:latest | bzip2 | ssh "${USER}@${HOST}" docker load +docker save jembi/platform:"$TAG_NAME" | bzip2 | ssh "${USER}@${HOST}" docker load echo "Image transfered" diff --git a/test/cucumber/features/single-mode/openhim-packages.feature b/test/cucumber/features/single-mode/openhim-packages.feature index 5c373b24..6c084aee 100644 --- a/test/cucumber/features/single-mode/openhim-packages.feature +++ b/test/cucumber/features/single-mode/openhim-packages.feature @@ -27,7 +27,7 @@ Feature: Openhim and its dependent packages? | openhim_mongo_public | openhim_public | Scenario: Destroy Openhim and its dependent packages - Given I use parameters "package destroy -n=interoperability-layer-openhim,client-registry-jempi,openhim-mapping-mediator --only --dev --env-file=.env.local" + Given I use parameters "package destroy -n=interoperability-layer-openhim,openhim-mapping-mediator --only --dev --env-file=.env.local" When I launch the platform with params Then The service "mongo-1" should be removed And The service "openhim-core" should be removed