Skip to content

Commit

Permalink
e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
freddieptf committed Dec 3, 2024
1 parent 394dc0b commit bac34a5
Show file tree
Hide file tree
Showing 5 changed files with 225 additions and 3 deletions.
117 changes: 117 additions & 0 deletions docker/docker-compose.cht-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
version: '3.9'

services:
haproxy:
image: public.ecr.aws/medic/cht-haproxy:4.4.0
restart: always
hostname: haproxy
environment:
- "HAPROXY_IP=${HAPROXY_IP:-haproxy}"
- "COUCHDB_USER=${COUCHDB_USER:-admin}"
- "COUCHDB_PASSWORD=${COUCHDB_PASSWORD:-password}"
- "COUCHDB_SERVERS=${COUCHDB_SERVERS:-couchdb}"
- "HAPROXY_PORT=${HAPROXY_PORT:-5984}"
- "HEALTHCHECK_ADDR=${HEALTHCHECK_ADDR:-healthcheck}"
logging:
driver: "local"
options:
max-size: "${LOG_MAX_SIZE:-50m}"
max-file: "${LOG_MAX_FILES:-20}"
networks:
- cht-net
expose:
- ${HAPROXY_PORT:-5984}
ports:
- "5984:5984"


healthcheck:
image: public.ecr.aws/medic/cht-haproxy-healthcheck:4.4.0
restart: always
environment:
- "COUCHDB_SERVERS=${COUCHDB_SERVERS:-couchdb}"
- "COUCHDB_USER=${COUCHDB_USER:-admin}"
- "COUCHDB_PASSWORD=${COUCHDB_PASSWORD:-password}"
logging:
driver: "local"
options:
max-size: "${LOG_MAX_SIZE:-50m}"
max-file: "${LOG_MAX_FILES:-20}"
networks:
- cht-net

api:
image: public.ecr.aws/medic/cht-api:4.4.0
restart: always
depends_on:
- haproxy
expose:
- "${API_PORT:-5988}"
ports:
- "5988:5988"
environment:
- COUCH_URL=http://${COUCHDB_USER:-admin}:${COUCHDB_PASSWORD:-password}@haproxy:${HAPROXY_PORT:-5984}/medic
- BUILDS_URL=${MARKET_URL_READ:-https://staging.dev.medicmobile.org}/${BUILDS_SERVER:-_couch/builds_4}
- UPGRADE_SERVICE_URL=${UPGRADE_SERVICE_URL:-http://localhost:5100}
logging:
driver: "local"
options:
max-size: "${LOG_MAX_SIZE:-50m}"
max-file: "${LOG_MAX_FILES:-20}"
networks:
- cht-net

sentinel:
image: public.ecr.aws/medic/cht-sentinel:4.4.0
restart: always
depends_on:
- haproxy
environment:
- COUCH_URL=http://${COUCHDB_USER:-admin}:${COUCHDB_PASSWORD:-password}@haproxy:${HAPROXY_PORT:-5984}/medic
- API_HOST=api
logging:
driver: "local"
options:
max-size: "${LOG_MAX_SIZE:-50m}"
max-file: "${LOG_MAX_FILES:-20}"
networks:
- cht-net

nginx:
image: public.ecr.aws/medic/cht-nginx:4.4.0
restart: always
depends_on:
- api
- haproxy
ports:
- "${NGINX_HTTP_PORT:-80}:80"
- "${NGINX_HTTPS_PORT:-443}:443"
volumes:
- cht-ssl:${SSL_VOLUME_MOUNT_PATH:-/etc/nginx/private/}
environment:
- API_HOST=api
- API_PORT=${API_PORT:-5988}
- "CERTIFICATE_MODE=${CERTIFICATE_MODE:-SELF_SIGNED}"
- "SSL_CERT_FILE_PATH=${SSL_CERT_FILE_PATH:-/etc/nginx/private/cert.pem}"
- "SSL_KEY_FILE_PATH=${SSL_KEY_FILE_PATH:-/etc/nginx/private/key.pem}"
- "COMMON_NAME=${COMMON_NAME:-test-nginx.dev.medicmobile.org}"
- "EMAIL=${EMAIL:[email protected]}"
- "COUNTRY=${COUNTRY:-US}"
- "STATE=${STATE:-California}"
- "LOCALITY=${LOCALITY:-San_Francisco}"
- "ORGANISATION=${ORGANISATION:-medic}"
- "DEPARTMENT=${DEPARTMENT:-Information_Security}"
logging:
driver: "local"
options:
max-size: "${LOG_MAX_SIZE:-50m}"
max-file: "${LOG_MAX_FILES:-20}"
networks:
- cht-net

networks:
cht-net:
name: ${CHT_NETWORK:-cht-net}

volumes:
cht-ssl:
31 changes: 31 additions & 0 deletions docker/docker-compose.cht-couchdb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: '3.9'

services:
couchdb:
image: public.ecr.aws/medic/cht-couchdb:4.4.0
volumes:
- couchdb-data:/opt/couchdb/data
- cht-credentials:/opt/couchdb/etc/local.d/
environment:
- "COUCHDB_USER=${COUCHDB_USER:-admin}"
- "COUCHDB_PASSWORD=${COUCHDB_PASSWORD:-password}"
- "COUCHDB_SECRET=${COUCHDB_SECRET:-secret}"
- "COUCHDB_UUID=${COUCHDB_UUID:-CC0C3BA1-88EE-4AE3-BFD3-6E0EE56ED534}"
- "SVC_NAME=${SVC_NAME:-couchdb}"
- "COUCHDB_LOG_LEVEL=${COUCHDB_LOG_LEVEL:-error}"
restart: always
logging:
driver: "local"
options:
max-size: "${LOG_MAX_SIZE:-50m}"
max-file: "${LOG_MAX_FILES:-20}"
networks:
cht-net:

volumes:
cht-credentials:
couchdb-data:

networks:
cht-net:
name: ${CHT_NETWORK:-cht-net}
19 changes: 19 additions & 0 deletions docker/docker-compose.mediator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: "3"

services:
mediator:
build:
context: ../
dockerfile: ./Dockerfile
container_name: mediator
restart: always
networks:
- cht-net
ports:
- "6000:6000"
env_file:
- ../.env

networks:
cht-net:
name: ${CHT_NETWORK:-cht-net}
55 changes: 55 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: '3'

services:
mongo-db:
container_name: mongo-db
image: mongo:4.0
networks:
- cht-net
volumes:
- "mongo-data:/data/db"
restart: unless-stopped

openhim-core:
container_name: openhim-core
image: jembi/openhim-core:latest
restart: unless-stopped
environment:
- mongo_url=mongodb://mongo-db/openhim-development
- mongo_atnaUrl=mongodb://mongo-db/openhim-development
- NODE_ENV=development
- api_authenticationTypes=["token", "basic", "openid", "local"]
- authentication_enableCustomTokenAuthentication=true
- authentication_enableJWTAuthentication=true
- authentication_jwt_secretOrPublicKey=secret
- authentication_jwt_algorithms=HS256
- authentication_jwt_issuer=openhim
- openhimConsoleBaseUrl=http://localhost:9000
ports:
- "8080:8080"
- "5000:5000"
- "5001:5001"
networks:
- cht-net
healthcheck:
test: "curl -sSk https://openhim-core:8080/heartbeat || exit 1"
interval: 30s
timeout: 30s
retries: 3

openhim-console:
container_name: openhim-console
image: jembi/openhim-console:latest
restart: unless-stopped
networks:
- cht-net
ports:
- "9000:80"
healthcheck:
test: "curl -sS http://openhim-console || exit 1"
interval: 30s
timeout: 30s
retries: 3

volumes:
mongo-data:
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ app.listen(CONFIG.port, () => {

const registerMediatorCallback = (err) => {
if (err) {
//throw new Error(`${MEDIATOR_FAILURE} ${err}`);
throw new Error(`${MEDIATOR_FAILURE} ${err}`);
}
logger.information(MEDIATOR_SUCCESS);
};
Expand All @@ -74,7 +74,7 @@ const mediatorConfig = {
name: "eCHIS Mediator",
host: CHANNEL_CONFIG_ENDPOINTS_URL,
pathTransform: `s/\\/${OPENHIM.channel}/`,
port: 22000,
port: CONFIG.port,
primary: true,
type: "http",
},
Expand All @@ -89,7 +89,7 @@ const mediatorConfig = {
name: "Mediator",
host: CHANNEL_CONFIG_ENDPOINTS_URL,
path: "/",
port: "22000",
port: `${CONFIG.port}`,
primary: true,
type: "http",
},
Expand Down

0 comments on commit bac34a5

Please sign in to comment.