- MVN
- https://maven.apache.org/install.html (official install, top download link will take you to the artefacts)
- https://github.com/rajivkanaujia/alphaworks/wiki/Installing-Maven (brew install)
- Postgres (optional)
- You can use postgres docker container if you would like to. There will be instructions about how to do it.
- Intellij
- Rider (for c# - HIP)
- VS Code
- Android Studio (only for app development)
- Java 11
- https://docs.oracle.com/en/java/javase/11/install/installation-jdk-macos.html#GUID-F575EB4A-70D3-4AB4-A20E-DBE95171AB5F (Official steps to install Java 11)
- https://www.oracle.com/java/technologies/javase-jdk11-downloads.html (JDK can be downloaded here)
- Docker
- https://docs.docker.com/docker-for-mac/install/ (Official docker install)
- .Net core (v3.1.100)
- Postman (optional)
- Rabbitmq
- Postgres
- Keycloak
- Orthanc *
- Elastic **
- Kibana **
- Redis **
(*) - Needed only for HIU when dicom image transferred from HIP (**) - Optional for local setup
- Run following commands to clean up your local system, before running any infra setup
docker-compose -f docker-compose-infra-lite.yml down
docker system prune -a -f
docker volume rm $(docker volume ls -qf dangling=true)
-
Clone the consent-manager repository
-
In the root directory, you should see the docker-compose-infra-lite.yml
-
In the command line, run the following
docker pull projecteka/monitor-db-initializer docker pull projecteka/gateway-db-initializer docker pull projecteka/cm-db-initializer docker pull projecteka/hiu-db-initializer docker pull projecteka/user-db-initializer docker pull projecteka/dataflow-db-initializer docker pull projecteka/data-notification-db-initializer docker-compose -f docker-compose-infra-lite.yml up -d docker logs $(docker ps -aqf "name=^cm-db-setup$") docker logs $(docker ps -aqf "name=^hiu-db-setup$") docker logs $(docker ps -aqf "name=^keycloak-setup$") docker logs $(docker ps -aqf "name=^user-db-setup$") docker logs $(docker ps -aqf "name=^dataflow-db-setup$") docker logs $(docker ps -aqf "name=^data-notification-db-setup$") # if you see any errors, run the docker-compose again docker exec -it $(docker ps -aqf "name=^postgres$") /bin/bash psql -U postgres consent_manager \d # should list all the tables \c health_information_user \d # should list all the tables \c user_service \d # should list all the tables \c dataflow_service \d # should list all the tables \c data_notification_subscription; \d # should list all the tables exit # twice
-
On gateway-db-initializer repo, bridge_service table has been restructured on Dec 11, 2020. Post this date, when you run the commands specified in step 3, you should be able to see both bridge_service_old and bridge_service tables.
-
In order to have route table for bridges and CM, run the following commands.
docker cp path-to-file-on-host/db-init-local.sh postgres:/tmp/db-init-local.sh (db-init-local.sh can be found on gateway repository) docker exec -it postgres bash cd tmp chmod +x db-init-local.sh ./db-init-local.sh
-
In order to migrate the data from bridge_service_old to bridge_service, run the following commands (Only applicable for existing installations, prior to Dec 11, 2020).
docker cp path-to-file-on-host/flatten_bridge_service.sh postgres:/tmp/flatten_bridge_service.sh (flatten_bridge_service.sh can be found on gateway repository) docker exec -it postgres bash cd tmp chmod +x flatten_bridge_service.sh ./flatten_bridge_service.sh
-
Note: In case, you want to run Kibana, elastic, use docker-compose-backend.yml
-
Keycloak runs at http://localhost:9001
- Login with user-name: admin, password: welcome
- There are two realms
Consent-Manager
andCentral-Registry
Consent-Manager
is only for activities with consent-manager service (consent-manager internal service calls and user-management)Central-Registry
is only for intra-service authentication and authorisation, and being used by Gateway service. For example if consent-manager wants to call to gateway, then consent-manager needs to get a token from Gateway using the client-id and client-secret of its own, and it should have a role ofCM
assigned. Note: All the clients needed for local development added into the keycloak automatically. Need to assign the role manually.- 10000002 with role
HIU
andHIP
- 10000005 with role
HIU
andHIP
- gateway with a role
gateway
- ncg with a role 'CM'
- 10000002 with role
- To be able to manipulate bridge & hip/hiu services entries, you need to add admin role to gateway client and create admin-user in
Central-Registry
realm.
- Click on
Clients
- Click on
Create
button in the top right corner of the clients table. - Enter the client id, i.e.
10000002
- Click on
Create
- On the clients page make the following the changes
- Change
Access Type
to Confidential. - Turn on
Service Accounts Enabled
flag. - Turn on
Authorization
flag too. - Enter some random url in the
Valid Redirect URIs
. for example http://localhost:8080. - Click
save
(tip: FromCredentials
you can copy theSecret
always)
- Change
- On the left-hand menu, click on
Roles
- Click on
Add Role
- Enter Role Name, for example
HIU
- Click
Save
- Repeat the same steps for the roles (HIP, HIU, Gateway, CM) you want to add.
- Click on
Clients
- Go to the client (for example: ncg) which you want to add role
- Click on
Service Account Roles
tab - On the
Available Roles
you should see the roles you just created, select the role you want to assign, and then clickAdd Selected
- Repeat the same steps for all the clients.
- Click on
Clients
- Go to the
gateway
client - Click on
Roles
tab - Click on
Add Role
- Enter Role Name as
admin
- Click
Save
- Click on
Users
- Click on
Add user
- Enter Username as
admin-user
- Click
Save
- Click on
Credentials
tab - Set Temporary check to
OFF
- Enter Password and Password Confirmation as
welcome
- Click on
Set Password
- Click on
Role Mappings
tab - Click on
Client Roles - Select a client
search box - Type
gateway
and click enter - On the
Available Roles
you should seeadmin
role, select that to assign, and then clickAdd Selected
- Type
realm-management
and click enter - On the
Available Roles
you should seemanage-clients
andmanage-users
roles, select those to assign, and then clickAdd Selected
-
Setup RabbitMQ
-
Clone infrastructure repo
-
Run the following commands
docker-compose -f docker-compose-rabbitmq.yml up -d ./rabbitmqDeploy.sh docker exec -it $(docker ps -aqf "name=^rabbitmq$") /bin/bash rabbitmqctl list_queues # should see all the queues exit
-
-
Clone central-registry
-
Run through command line
cd client-registry ./gradlew bootRun
Note: In case, if default values specified in the application.properties are not you use, you can change them accordingly and run.
-
Clone otp-service
-
Run through command line
cd otp-service dotnet run --project src/In.ProjectEKA.OtpService/In.ProjectEKA.OtpService.csproj --environment "local"
-
Clone gateway
-
Copy the client-secret http://localhost:9001/auth/admin/master/console/#/realms/central-registry/clients of
gateway
undercredentials
tab, and use it for a CLIENT_SECRET (client under central-registry realm) -
Run through command line
cd gateway CLIENT_SECRET=${CLIENT_SECRET} ./gradlew bootRunLocal
It's a mono-repo contains, consent, data flow, and user services, there are following common things across services. Those are exposed through HAProxy.
- Clone Consent-Manager
- You need to get client secret from keycloak
- Copy the client-secret http://localhost:9001/auth/admin/master/console/#/realms/consent-manager/clients of
consent-manager
undercredentials
tab, and use it for KEYCLOAK_CLIENTSECRET (client under consent-manager realm) - Copy the client-secret http://localhost:9001/auth/admin/master/console/#/realms/central-registry/clients of
ncg
undercredentials
tab, and use it for GATEWAY_CLIENTSECRET (client under central-registry realm)
-
Run through command line
cd consent-manager GATEWAY_CLIENTSECRET=${GATEWAY_CLIENTSECRET} KEYCLOAK_CLIENTSECRET=${KEYCLOAK_CLIENTSECRET} ./gradlew :consent:bootRunLocal
-
Run through command line
cd consent-manager GATEWAY_CLIENTSECRET=${GATEWAY_CLIENTSECRET} KEYCLOAK_CLIENTSECRET=${KEYCLOAK_CLIENTSECRET} ./gradlew :user:bootRunLocal
-
Run through command line
cd consent-manager GATEWAY_CLIENTSECRET=${GATEWAY_CLIENTSECRET} KEYCLOAK_CLIENTSECRET=${KEYCLOAK_CLIENTSECRET} ./gradlew :dataflow:bootRunLocal
-
Since there are two services to form a consent-manager application, we need proxy to route the request.
-
Hence, haproxy is part of the project to route the request between consent and user service.
-
Run the following command
cd consent-manager ./gradlew composeUp
-
In case if you want to bring down,
./gradlew composeDown
-
In order to access consent manager, you can use http://localhost:8081
-
Copy the client-secret http://localhost:9001/auth/admin/master/console/#/realms/central-registry/clients of
10000011
undercredentials
tab, and use it for CLIENT_SECRET (client under central-registry realm) -
Run through command line
cd data-notification-subscription GATEWAY_CLIENTSECRET=${GATEWAY_CLIENTSECRET} ./gradlew bootRunLocal
- Clone hip-service
- Copy the client-secret http://localhost:9001/auth/admin/master/console/#/realms/central-registry/clients of
10000005
undercredentials
tab, and use it for CLIENT_SECRET (client under central-registry realm) - Run through command line
cd hip-service cp src/In.ProjectEKA.DefaultHip/Resources/*.json src/In.ProjectEKA.HipService/ export Gateway__clientSecret=${CLIENT_SECRET} dotnet run --project src/In.ProjectEKA.HipService/In.ProjectEKA.HipService.csproj --environment="local"
-
Clone hiu-service
-
Do the one time user setup, before proceeding further.
docker exec -it $(docker ps -aqf "name=^postgres$") /bin/bash psql -U postgres health_information_user insert into "user" (username, password, role, verified) values ('admin', '$2a$04$WW.a3wKaiL2/7xWJc4jUmu4/55aJnwBJscZ.o18X.zLZcOdpwQGQa', 'ADMIN', true); insert into "user" (username, password, role, verified) values ('lakshmi', '$2a$04$WW.a3wKaiL2/7xWJc4jUmu4/55aJnwBJscZ.o18X.zLZcOdpwQGQa', 'DOCTOR', true);
-
Copy the client-secret http://localhost:9001/auth/admin/master/console/#/realms/central-registry/clients of
10000002
undercredentials
tab, and use it for CLIENT_SECRET (client under central-registry realm) -
Run through command line
CLIENT_SECRET=${CLIENT_SECRET} ./gradlew bootRunLocal
-
Run the following command
Note: This is with an assumption that hiu-service is running on port 8003
docker pull projecteka/hiu-ui:local # to pull latest `local` image docker run -d -p 5002:5000 projecteka/hiu-ui:local
-
Since hiu-service is running on different port, same-origin-policy will prevent you to access the UI by default. In order to avoid, run the following command to get an independent instance of chrome without same-origin-policy
open -na Google\ Chrome --args --disable-web-security --user-data-dir=$HOME/profile-folder-name
-
Later versions of Safari allow you to Disable Cross-Origin Restrictions. Just enable the developer menu from Preferences >> Advanced, and select "Disable Cross-Origin Restrictions" from the develop menu. If you want local only, then you only need to enable the developer menu, and select "Disable local file restrictions" from the develop menu.