Skip to content

Commit

Permalink
Merge pull request #238 from jembi/PLAT-718-update-mapping-mediator
Browse files Browse the repository at this point in the history
Plat 718 update mapping mediator package
  • Loading branch information
bradsawadye committed Jul 25, 2023
2 parents 716978f + 3e9d9d2 commit b31a3b1
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 11 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
projectName: platform
image: jembi/platform:2.3.1
image: jembi/platform:2.3.2
logPath: /tmp/logs

packages:
Expand Down
1 change: 1 addition & 0 deletions interoperability-layer-openhim/docker-compose-mongo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions interoperability-layer-openhim/initiate-replica-set.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down
3 changes: 3 additions & 0 deletions interoperability-layer-openhim/swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 8 additions & 1 deletion openhim-mapping-mediator/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -20,3 +24,6 @@ networks:
mongo:
name: openhim_mongo_public
external: true
kafka:
name: kafka_public
external: true
5 changes: 4 additions & 1 deletion openhim-mapping-mediator/package-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"OPENHIM_USERNAME": "[email protected]",
"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"
}
}
8 changes: 4 additions & 4 deletions remote-img-load.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <host>"
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"
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b31a3b1

Please sign in to comment.