Skip to content

Commit

Permalink
AWS updates (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmanko authored Mar 24, 2022
1 parent d5eb773 commit da2e70f
Show file tree
Hide file tree
Showing 5 changed files with 196 additions and 7 deletions.
87 changes: 87 additions & 0 deletions configs/omang/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"Logger": {
"MaxLogSize": "10MB",
"MaxNumofLogs": 10
},
"Auth": {
"AllowedKeys": "T01BTkcuT1BFTkhJTS4yNWMyZGJkNi1lYzgxLTRlZTYtODI5NS0zNDI3MTIwNzNiZGU=;T01BTkcuSElFLmEyMjQzNzkwLTI5MzctNDM3NS04ZmJhLWZhMDZmNThkODVhZQ=="
},
"SafeList": {
"IP": "::1;127.0.0.1"
},
"Oracle": {
"Omang": {
"ConnectionDesc": "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oracle-db)(PORT = 1521))(CONNECT_DATA = (SID = XE)))",
"ConnectionString": "User id=omang; Password=some-password; enlist=false; pooling=false",
"TimeoutSecs": 60,
"ViewName": "OMANG_CITIZEN",
"InstanceID": "XE"
},
"Births": {
"ConnectionDesc": "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oracle-db)(PORT = 1521))(CONNECT_DATA = (SID = XE)))",
"ConnectionString": "User id=omang; Password=some-password; enlist=false; pooling=false",
"TimeoutSecs": 60,
"ViewName": "V_BIRTH",
"InstanceID": "XE"
},
"Deaths": {
"ConnectionDesc": "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oracle-db)(PORT = 1521))(CONNECT_DATA = (SID = XE)))",
"ConnectionString": "User id=omang; Password=some-password; enlist=false; pooling=false",
"TimeoutSecs": 60,
"ViewName": "V_DEATH",
"InstanceID": "XE"
}
},
"mediatorConfig": {
"openHimAuth": {
"username": "root@openhim.org",
"password": "openhim",
"trustSelfSigned": true
},
"mediatorCore": {
"openHimCoreHost": "https://openhim-core:8080",
"openHimCoreAuthPath": "authenticate",
"openHimRegisterMediatorPath": "mediators",
"openHimheartbeatpath": "heartbeat",
"heartbeatInterval": 10,
"isHeartbeatDisabled": false
},
"mediatorSetup": {
"urn": "urn:uuid:3332e057-2ef5-4586-a437-105c9916147f",
"version": "0.0.1",
"name": "dotnet Core Health Mediator",
"description": "dotnet Core Health Mediator",
"defaultChannelConfig": [
{
"name": "Health Mediator",
"urlPattern": "^/healthMediator$",
"type": "http",
"routes": [
{
"name": "Health Mediator Route",
"host": "omang-api",
"port": "5000",
"primary": true,
"type": "http",
"path": "api/health"
}
],
"allow": [
"admin",
"mobenzi"
]
}
],
"endpoints": [
{
"name": "healthRoute",
"host": "localhost",
"path": "/api/health",
"port": "5000",
"primary": true,
"type": "http"
}
]
}
}
}
66 changes: 66 additions & 0 deletions configs/omang/db/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
-- ALTER SESSION SET CONTAINER = ORCLPDB1;

CREATE USER omang IDENTIFIED BY "some-password";

-- ALTER SESSION SET CONTAINER = ORCLPDB1;

GRANT CONNECT TO omang;
GRANT CREATE SESSION TO omang;
GRANT RESOURCE TO omang;

ALTER USER omang QUOTA 100M ON USERS;

-- ALTER SESSION SET CONTAINER = ORCLPDB1;
-- ALTER SESSION SET CURRENT_SCHEMA = omang;

USE OMANG

--Create table
CREATE TABLE omang.OMANG_CITIZEN(
DECEASED_DTE timestamp NULL,
FIRST_NME VARCHAR2(50) NOT NULL,
BIRTH_DTE_UNKNOWN VARCHAR2(50) NOT NULL,
DISTRICT_NME VARCHAR2(50) NOT NULL,
OCCUPATION_DESCR VARCHAR2(50) NOT NULL,
BIRTH_PLACE_NME VARCHAR2(50) NOT NULL,
CHANGE_DTE timestamp NOT NULL,
DISTRICT_CDE VARCHAR2(50) NOT NULL,
SEX VARCHAR2(50) NOT NULL,
SPOUSE_NME VARCHAR2(50) NULL,
CITIZEN_STATUS_CDE VARCHAR2(50) NOT NULL,
DEATH_CERT_NO VARCHAR2(50) NULL,
BIRTH_DTE timestamp NOT NULL,
DECEASED_DTE_UNKNOWN VARCHAR2(50) NULL,
CITIZEN_STATUS_DTE timestamp NOT NULL,
SURNME VARCHAR2(50) NOT NULL,
OCCUPATION_CDE VARCHAR2(50) NOT NULL,
MARITAL_STATUS_CDE VARCHAR2(50) NOT NULL,
EXPIRY_DTE timestamp NOT NULL,
PERSON_STATUS VARCHAR2(50) NOT NULL,
MARITAL_STATUS_DESCR VARCHAR2(50) NOT NULL,
ID_NO VARCHAR2(50) NOT NULL
)
--Insert into table

INSERT INTO omang.OMANG_CITIZEN (DECEASED_DTE, FIRST_NME, BIRTH_DTE_UNKNOWN, DISTRICT_NME, OCCUPATION_DESCR, BIRTH_PLACE_NME, CHANGE_DTE, DISTRICT_CDE, SEX, SPOUSE_NME, CITIZEN_STATUS_CDE, DEATH_CERT_NO, BIRTH_DTE, DECEASED_DTE_UNKNOWN, CITIZEN_STATUS_DTE, SURNME, OCCUPATION_CDE, MARITAL_STATUS_CDE, EXPIRY_DTE, PERSON_STATUS, MARITAL_STATUS_DESCR, ID_NO) VALUES (NULL, 'OLEBILE', '', 'CENTRAL-TUTUME', 'NOT IN THE LABOUR FORCE (STUDENT)', 'FRANCISTOW', TO_TIMESTAMP('2009-06-18', 'YYYY-MM-DD'), '18', 'M', NULL, 'CITZ', NULL, TO_TIMESTAMP('1992-08-27','YYYY-MM-DD'), NULL, TO_TIMESTAMP('2009-06-18','YYYY-MM-DD'), 'SURNAME3', '28', 'SGL', TO_TIMESTAMP('2019-05-27','YYYY-MM-DD'), 'LIVE', 'Single', '210711926');

-- INSERT omang.OMANG_CITIZEN (DECEASED_DTE, FIRST_NME, BIRTH_DTE_UNKNOWN, DISTRICT_NME, OCCUPATION_DESCR, BIRTH_PLACE_NME, CHANGE_DTE, DISTRICT_CDE, SEX, SPOUSE_NME, CITIZEN_STATUS_CDE, DEATH_CERT_NO, BIRTH_DTE, DECEASED_DTE_UNKNOWN, CITIZEN_STATUS_DTE, SURNME, OCCUPATION_CDE, MARITAL_STATUS_CDE, EXPIRY_DTE, PERSON_STATUS, MARITAL_STATUS_DESCR, ID_NO) VALUES (NULL, N'OLEBILE', N'N', N'CENTRAL-TUTUME', N'NOT IN THE LABOUR FORCE (STUDENT)', N'FRANCISTOWN', CAST(N'2009-06-18T09:00:32.000' AS DateTime), N'18', N'M', NULL, N'CITZ', NULL, CAST(N'1992-08-27T00:00:00.000' AS DateTime), NULL, CAST(N'2009-06-18T09:00:32.000' AS DateTime), N'SURNAME3', N'28', N'SGL', CAST(N'2019-05-27T00:00:00.000' AS DateTime), N'LIVE', N'Single', N'210711926')

-- INSERT omang.OMANG_CITIZEN (DECEASED_DTE, FIRST_NME, BIRTH_DTE_UNKNOWN, DISTRICT_NME, OCCUPATION_DESCR, BIRTH_PLACE_NME, CHANGE_DTE, DISTRICT_CDE, SEX, SPOUSE_NME, CITIZEN_STATUS_CDE, DEATH_CERT_NO, BIRTH_DTE, DECEASED_DTE_UNKNOWN, CITIZEN_STATUS_DTE, SURNME, OCCUPATION_CDE, MARITAL_STATUS_CDE, EXPIRY_DTE, PERSON_STATUS, MARITAL_STATUS_DESCR, ID_NO) VALUES (NULL, N'ARABANG', N'N', N'NORTH-EAST', N'NOT IN THE LABOUR FORCE (STUDENT)', N'FRANCISTOWN', CAST(N'2015-05-20T08:03:52.000' AS DateTime), N'19', N'M', NULL, N'CITZ', NULL, CAST(N'1999-05-02T00:00:00.000' AS DateTime), NULL, CAST(N'2015-05-20T08:03:52.000' AS DateTime), N'SURNAME1', N'28', N'SGL', CAST(N'2025-05-18T00:00:00.000' AS DateTime), N'LIVE', N'Single', N'237718130')

-- INSERT omang.OMANG_CITIZEN (DECEASED_DTE, FIRST_NME, BIRTH_DTE_UNKNOWN, DISTRICT_NME, OCCUPATION_DESCR, BIRTH_PLACE_NME, CHANGE_DTE, DISTRICT_CDE, SEX, SPOUSE_NME, CITIZEN_STATUS_CDE, DEATH_CERT_NO, BIRTH_DTE, DECEASED_DTE_UNKNOWN, CITIZEN_STATUS_DTE, SURNME, OCCUPATION_CDE, MARITAL_STATUS_CDE, EXPIRY_DTE, PERSON_STATUS, MARITAL_STATUS_DESCR, ID_NO) VALUES (NULL, N'EMMANUEL', N'N', N'CENTRAL-TUTUME', N'NOT IN THE LABOUR FORCE (STUDENT)', N'FRANCISTOWN', CAST(N'2011-01-25T10:05:15.000' AS DateTime), N'18', N'M', NULL, N'CITZ', NULL, CAST(N'1994-11-30T00:00:00.000' AS DateTime), NULL, CAST(N'2011-01-25T10:05:15.000' AS DateTime), N'SURNAME5', N'28', N'SGL', CAST(N'2020-12-22T00:00:00.000' AS DateTime), N'LIVE', N'Single', N'249716717')

-- INSERT omang.OMANG_CITIZEN (DECEASED_DTE, FIRST_NME, BIRTH_DTE_UNKNOWN, DISTRICT_NME, OCCUPATION_DESCR, BIRTH_PLACE_NME, CHANGE_DTE, DISTRICT_CDE, SEX, SPOUSE_NME, CITIZEN_STATUS_CDE, DEATH_CERT_NO, BIRTH_DTE, DECEASED_DTE_UNKNOWN, CITIZEN_STATUS_DTE, SURNME, OCCUPATION_CDE, MARITAL_STATUS_CDE, EXPIRY_DTE, PERSON_STATUS, MARITAL_STATUS_DESCR, ID_NO) VALUES (NULL, N'IPONENG', N'N', N'NORTH-EAST', N'NOT IN THE LABOUR FORCE (STUDENT)', N'FRANCISTOWN', CAST(N'2012-10-05T12:44:34.000' AS DateTime), N'19', N'M', NULL, N'CITZ', NULL, CAST(N'1995-01-29T00:00:00.000' AS DateTime), NULL, CAST(N'2012-10-05T12:44:34.000' AS DateTime), N'SURNAME2', N'28', N'SGL', CAST(N'2022-10-04T00:00:00.000' AS DateTime), N'LIVE', N'Single', N'255715019')

-- INSERT omang.OMANG_CITIZEN (DECEASED_DTE, FIRST_NME, BIRTH_DTE_UNKNOWN, DISTRICT_NME, OCCUPATION_DESCR, BIRTH_PLACE_NME, CHANGE_DTE, DISTRICT_CDE, SEX, SPOUSE_NME, CITIZEN_STATUS_CDE, DEATH_CERT_NO, BIRTH_DTE, DECEASED_DTE_UNKNOWN, CITIZEN_STATUS_DTE, SURNME, OCCUPATION_CDE, MARITAL_STATUS_CDE, EXPIRY_DTE, PERSON_STATUS, MARITAL_STATUS_DESCR, ID_NO) VALUES (NULL, N'CAROLINE', N'N', N'FRANCISTOWN', N'NOT IN THE LABOUR FORCE (STUDENT)', N'FRANCISTOWN', CAST(N'2017-01-13T11:33:23.000' AS DateTime), N'02', N'F', NULL, N'CITZ', NULL, CAST(N'1987-01-13T00:00:00.000' AS DateTime), NULL, CAST(N'2017-01-13T11:33:23.000' AS DateTime), N'SURNAME10', N'28', N'SGL', CAST(N'2027-01-10T00:00:00.000' AS DateTime), N'LIVE', N'Single', N'258628219')

-- INSERT omang.OMANG_CITIZEN (DECEASED_DTE, FIRST_NME, BIRTH_DTE_UNKNOWN, DISTRICT_NME, OCCUPATION_DESCR, BIRTH_PLACE_NME, CHANGE_DTE, DISTRICT_CDE, SEX, SPOUSE_NME, CITIZEN_STATUS_CDE, DEATH_CERT_NO, BIRTH_DTE, DECEASED_DTE_UNKNOWN, CITIZEN_STATUS_DTE, SURNME, OCCUPATION_CDE, MARITAL_STATUS_CDE, EXPIRY_DTE, PERSON_STATUS, MARITAL_STATUS_DESCR, ID_NO) VALUES (NULL, N'JAMES', N'N', N'NORTH-EAST', N'NOT IN THE LABOUR FORCE (STUDENT)', N'FRANCISTOWN', CAST(N'2011-02-17T18:14:15.000' AS DateTime), N'19', N'F', NULL, N'CITZ', NULL, CAST(N'1993-01-21T00:00:00.000' AS DateTime), NULL, CAST(N'2011-02-17T18:14:15.000' AS DateTime), N'SURNAME4', N'28', N'SGL', CAST(N'2021-02-16T00:00:00.000' AS DateTime), N'LIVE', N'Single', N'259573715')

-- INSERT omang.OMANG_CITIZEN (DECEASED_DTE, FIRST_NME, BIRTH_DTE_UNKNOWN, DISTRICT_NME, OCCUPATION_DESCR, BIRTH_PLACE_NME, CHANGE_DTE, DISTRICT_CDE, SEX, SPOUSE_NME, CITIZEN_STATUS_CDE, DEATH_CERT_NO, BIRTH_DTE, DECEASED_DTE_UNKNOWN, CITIZEN_STATUS_DTE, SURNME, OCCUPATION_CDE, MARITAL_STATUS_CDE, EXPIRY_DTE, PERSON_STATUS, MARITAL_STATUS_DESCR, ID_NO) VALUES (NULL, N'OLORATO', N'N', N'CENTRAL-SEROWE', N'BOOK-KEEPERS, CASHIERS AND RELATED WORKERS', N'FRANCISTOWN', CAST(N'2016-04-26T15:00:38.000' AS DateTime), N'14', N'F', NULL, N'CITZ', NULL, CAST(N'1988-09-16T00:00:00.000' AS DateTime), NULL, CAST(N'2016-04-26T15:00:38.000' AS DateTime), N'SURNAME7', N'33', N'SGL', CAST(N'2026-04-25T00:00:00.000' AS DateTime), N'LIVE', N'Single', N'264520419')

-- INSERT omang.OMANG_CITIZEN (DECEASED_DTE, FIRST_NME, BIRTH_DTE_UNKNOWN, DISTRICT_NME, OCCUPATION_DESCR, BIRTH_PLACE_NME, CHANGE_DTE, DISTRICT_CDE, SEX, SPOUSE_NME, CITIZEN_STATUS_CDE, DEATH_CERT_NO, BIRTH_DTE, DECEASED_DTE_UNKNOWN, CITIZEN_STATUS_DTE, SURNME, OCCUPATION_CDE, MARITAL_STATUS_CDE, EXPIRY_DTE, PERSON_STATUS, MARITAL_STATUS_DESCR, ID_NO) VALUES (NULL, N'THATO', N'N', N'CENTRAL-TUTUME', N'TRANSPORT CONDUCTORS', N'FRANCISTOWN', CAST(N'2016-10-24T09:00:50.000' AS DateTime), N'18', N'M', NULL, N'CITZ', NULL, CAST(N'1988-03-14T00:00:00.000' AS DateTime), NULL, CAST(N'2016-10-24T09:00:50.000' AS DateTime), N'SURNAME8', N'36', N'SGL', CAST(N'2026-10-18T00:00:00.000' AS DateTime), N'LIVE', N'Single', N'272116516')

-- INSERT omang.OMANG_CITIZEN (DECEASED_DTE, FIRST_NME, BIRTH_DTE_UNKNOWN, DISTRICT_NME, OCCUPATION_DESCR, BIRTH_PLACE_NME, CHANGE_DTE, DISTRICT_CDE, SEX, SPOUSE_NME, CITIZEN_STATUS_CDE, DEATH_CERT_NO, BIRTH_DTE, DECEASED_DTE_UNKNOWN, CITIZEN_STATUS_DTE, SURNME, OCCUPATION_CDE, MARITAL_STATUS_CDE, EXPIRY_DTE, PERSON_STATUS, MARITAL_STATUS_DESCR, ID_NO) VALUES (NULL, N'MONTY', N'N', N'NORTH-EAST', N'NOT IN THE LABOUR FORCE (STUDENT)', N'FRANCISTOWN', CAST(N'2009-08-12T09:53:30.000' AS DateTime), N'19', N'M', NULL, N'CITZ', NULL, CAST(N'1990-07-13T00:00:00.000' AS DateTime), NULL, CAST(N'2009-08-12T09:53:30.000' AS DateTime), N'SURNAME6', N'28', N'SGL', CAST(N'2017-01-05T00:00:00.000' AS DateTime), N'LIVE', N'Single', N'286815515')

-- INSERT omang.OMANG_CITIZEN (DECEASED_DTE, FIRST_NME, BIRTH_DTE_UNKNOWN, DISTRICT_NME, OCCUPATION_DESCR, BIRTH_PLACE_NME, CHANGE_DTE, DISTRICT_CDE, SEX, SPOUSE_NME, CITIZEN_STATUS_CDE, DEATH_CERT_NO, BIRTH_DTE, DECEASED_DTE_UNKNOWN, CITIZEN_STATUS_DTE, SURNME, OCCUPATION_CDE, MARITAL_STATUS_CDE, EXPIRY_DTE, PERSON_STATUS, MARITAL_STATUS_DESCR, ID_NO) VALUES (NULL, N'KA', N'N', N'NORTH-EAST', N'WORKERS REPORTING UNIDENTIFIABLE OCCUPATIONS', N'FRANCISTOWN', CAST(N'2015-09-22T11:45:34.000' AS DateTime), N'19', N'F', NULL, N'CITZ', NULL, CAST(N'1988-09-11T00:00:00.000' AS DateTime), NULL, CAST(N'2015-09-22T11:45:34.000' AS DateTime), N'SURNAME9', N'25', N'SGL', CAST(N'2025-09-21T00:00:00.000' AS DateTime), N'LIVE', N'Single', N'373821113')

2 changes: 1 addition & 1 deletion configs/opencr/config_port.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
}
},
"sync": {
"lastFHIR2ESSync": "2022-03-21T20:29:07"
"lastFHIR2ESSync": "2022-03-24T18:31:29"
},
"__comments": {
"matching.tool": "this tells if the app should use mediator algorithms or elasticsearch algorithms for matching, two options mediator and elasticsearch"
Expand Down
2 changes: 1 addition & 1 deletion configs/traefik/certs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tls:
certificates:
- certFile: /etc/certs/live/moh.org.bw/fullchain.pem
- certFile: /etc/certs/live/moh.org.bw/cert.pem
keyFile: /etc/certs/live/moh.org.bw/privkey.pem
46 changes: 41 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ version: '3.8'

services:
###
# nginx reverse proxy
# TODO: set up to use non-root user. See https://www.rockyourcode.com/run-docker-nginx-as-non-root-user/
# TODO: Run letsencrypt as docker container: https://hub.docker.com/r/certbot/certbot/
# reverse proxy
###
traefik:
image: traefik:v2.6.1
Expand All @@ -37,6 +35,7 @@ services:
- AWS_SECRET_ACCESS_KEY
- AWS_HOSTED_ZONE_ID

## TODO: Set up Traefik for AWS DNS properly and remove
certbot:
image: certbot/dns-route53
container_name: certbot
Expand Down Expand Up @@ -206,7 +205,16 @@ services:
- 'traefik.http.routers.openhim-console.entrypoints=web-secure'
networks:
- hie


# Loads Default OpenHIM Config
openhim-config:
container_name: openhim-config
image: ghcr.io/i-tech-uw/openhim-config:v0.0.0
volumes:
- ./configs/openhim/test-openhim-config.json:/app/test-openhim-config.json
networks:
- hie

mongo-db:
container_name: mongo-db
image: mongo:3.4
Expand All @@ -232,7 +240,6 @@ services:
- 'traefik.http.routers.converter.rule=Host(`converter.moh.org.bw`)'
- 'traefik.http.routers.converter.tls=true'
- 'traefik.http.routers.converter.entrypoints=web-secure'
- 'traefik.http.services.converter.loadbalancer.server.port=2019'

# Kafka
zookeeper:
Expand Down Expand Up @@ -263,6 +270,35 @@ services:
- hie
entrypoint: sh -c 'sleep 30 && /opt/bitnami/scripts/kafka/entrypoint.sh /opt/bitnami/scripts/kafka/run.sh' # prevent zookeeper conflict error

omang-api:
image: ghcr.io/b-techbw/omangsvc:latest
hostname: omang-api
container_name: omang-api
restart: unless-stopped
volumes:
- ./configs/omang/appsettings.json:/app/appsettings.json
networks:
- hie
labels:
- 'traefik.enable=true'
- 'traefik.docker.network=hie-botswana_hie'
- 'traefik.http.routers.omang.rule=Host(`omang.moh.org.bw`)'
- 'traefik.http.routers.omang.tls=true'
- 'traefik.http.routers.omang.entrypoints=web-secure'
ports:
- "8085:80"
oracle-db:
hostname: oracle-db
container_name: oracle-db
image: wnameless/oracle-xe-11g-r2
environment:
- ORACLE_ALLOW_REMOTE=true
ports:
- 1521:1521
volumes:
- ./configs/omang/db:/docker-entrypoint-initdb.d
networks:
- hie
volumes:
es:
driver: local
Expand Down

0 comments on commit da2e70f

Please sign in to comment.