This guide shows how to install the IDEA4RC AI Platform
- Files retrieval procedure
- HTTPS
- Standalone Keycloak server installation
- Keycloak server first configuration
- Docker compose file configuration
- Execution of the docker compose file
- Temporary services
Go to the Docker files GitHub repo and clone the project.
This project contains only docker files and, eventually, configuration files necessary to correctly execute the provided docker containers.
The AI Platform is executed in an HTTPS environment and it is provided with a self sined certificate that could raise some warning messages in your browser.
When this message will be shown to you, you can get forward cliccking on advanced
or Help me to understand
(it depends on your browser) and accept the self signed certificate.
You can provide your certificates by putting them into the folders certs
that you can find in the docker project; please pay attention to the file names and, if they are different, change consequently the file names into the volume sections of the docker-compose files.
Exclusively for the AI-API and DATA EXTRACTOR services to provide different certificates you have to pass them through the corrispective volume section, overriding the original files that are provided within the images. In this case you have to respect the original name of the certificate file and the relative key name because the images are immutable and, the services have not yet structured to read different named files.
The same is valid for the proxy container, you can provide your certificate without changing the destination file name.
AI API Container
volumes:
- <path to your certificate>:/idea4rc-ai-api/src/certs/idea4rcaigui-self-signed.crt
- <path to your key>:/idea4rc-ai-api/src/certs/idea4rcaigui-self-signed.key
DATA EXTRACTION JOB Container
volumes:
- <path to your certificate>:/idea4rc-ai-dataextractionjobs/src/certs/idea4rcaigui-self-signed.crt
- <path to your key>:/idea4rc-ai-dataextractionjobs/src/certs/idea4rcaigui-self-signed.key
Go into the security folder and look into the docker-compose.yml file. Here you can use the environment
sections, in fact within these sections you can customize the keycloak's database properties and the properties related to the keycloak server. In any case, all the properties are already set for a correct execution.
After the customization you have to execute the following command
docker-compose up -d
Waiting for the server to start the process, after that (using the default environment values) you can direct your browser to the following URL and reach the keycloak server:
https://keycloak:8080
Use the eng_admin
string for user and password input boxes. If you have changed the KEYCLOAK_ADMIN
and the KEYCLOAK_ADMIN_PASSWORD
environment properties, you have to use the new values set.
Once you have entered into the keycloak's administration portal, you have to configure the following objects:
- one keycloak client named as
idea4rc-ai-gui
- an application client role named as
ai_admin
related to the client created at the point 1 - an application client role named as
ai_researcher
related to the client created at the point 1 - an application client role named as
ai_doctor
related to the client created at the point 1 - make the
ai_admin
role as composite adding theai_researcher
role
Using the Clients
section, click on Create client
Use the string idea4rc-ai-gui
as Client ID
and click on Next
Set the client authentication properties as shown in the above figure, then click on Next
Set the Root URL
, Valid redirect URIs
and Web origins
values as shown in the above figure, then click on Save
. Please pay attention to the URL and use the https protocol.
From the Clients section, you can click on the name of the created client and look into the client detail section.
Go to the Roles
section and proceed with the roles' creation clicking on the Create role
button.
Here, write into the Role name
input box the value ai_admin
, then click on Save
as shown in the figure below.
Repeat this process with the ai_researcher
role, then: from the section Role, look into the ai_admin role's properties section and click on the Action
select button as shown in the figure below
From the panel that will be opened, select the ai_researcher
role, then click on Assign
Create one last role named ai_doctor
as you have already done with the previous roles
Once the roles are created, you have to configure a valid client mapper to make the client able to send them to the web application. To do this:
- go to the
Client scopes
section and click on the dedicated client scope, the one that was created automatically - from the client mappers section, click on
Add mappers
and selectFrom predefined mappers
- check the
client roles
mapper and click onAdd
- be sure to modify the new mapper to make it aligned with the one in the figure below
Now the configurations are done, but it is necessary to collect some codes that will be useful next in the guide.
Open the idearc-ai-gui properties section as you would apply some changes, and look into the browser's navigation bar. Here you can find the section's URL, in this URL you can notice an alphanumeric sequence of characters, you have to copy this sequence because it will be used next as the KEYCLOAK_CLIENT_ID
environment property.
Proceeding as the same you can take the other codes KEYCLOAK_CLIENT_ADMINROLE_ID
, KEYCLOAK_CLIENT_RESEARCHROLE_ID
and KEYCLOAK_CLIENT_DOCTORROLE_ID
from the respective detail sections. Pay attention to the URL: in this case, you will notice the presence of two alphanumeric codes. You must copy the last one in the URL!
The last code is the KEYCLOAK_SECRET_KEY
, you can find it in the Realm settings
section. Clicking on the Keys
tab you must copy the code that you will find clicking on the RS256
's Public key
button.
Here is a detail about this panel:
In the docker compose file, at the root level, there are six services:
- api_db: a Postgres database that will contain all the data necessary to execute the ai-platform correctly
- aiapi: the service that is accounted to execute the majority of the ai-platform processes
- dataextractionjobs_db: a Postgres database that will contain all the data necessary to execute the data extraction jobs correctly
- dataextractionjobs: the service that is accounted to execute the extraction of the data from the FHIR server when requested by the aiapi service
- idea4rcaigui: the web application thanks to is possible to use all the platform functionalities
- proxy: a useful tool that avoids all the CORS problems in a local environment
Bear in mind that you need two external services, the security keycloak server (introduced in the previous chapters) and the FHIR Server as temporary services that will be introduced in the next chapter.
To have further insight about the docker compose file, you can look into the official Docker Compose Quickstart guide.
Every service in the docker compose file has an environment
section (a collection of service properties) that represents how an administrator can customize the service to make the platform able to work in his/her deployment environment.
Following, we introduce every property that is possible to use:
POSTGRES_SSL_CERT_FILE
the ssl certificate that will be injected into the database (valid exclusively for keycloak server database)POSTGRES_SSL_KEY_FILE
the key of the ssl certificate that will be injected into the database (valid exclusively for keycloak server database)KC_HTTPS_CERTIFICATE_FILE
the ssl certificate that will be injected into the keycloak serverKC_HTTPS_CERTIFICATE_KEY_FILE
the key of the ssl certificate that will be injected into the keycloak serverPOSTGRES_USER
the user of the database, the one that is able to operate over itPOSTGRES_PASSWORD
the password used by the userPOSTGRES_DB
the name of the databasePOSTGRES_HOST
is the net host that is used to individuate the db service through the docker local network, you must use the value chosen for thecontainer_name
POSTGRES_PORT
the database port, even if you must use a different port as anexternal port
for every service, you must set this property to the internal portDROP_DB
if you have to reset the service database, you must set this property to "True", the capital letter in "True" is necessary due to the presence of Python.DOCKER_REGISTRY_USERNAME
the docker registry usernameDOCKER_REGISTRY_PASSWORD
the docker registry passwordDOCKER_REGISTRY_URL
the docker registry URLDOCKER_REGISTRY_DOMAIN
the registry domain, plus the portSWAGGER_URL
swagger url of the service, it depends on the container name and the exposed portIDEA4RCAI_DATA_FOLDER
the data folder used by the service to archive the service data. It is necessary to set up a volume linked to the declared folder to make the data persistentIDEA4RCAI_HOST
the net host of the aiapi servicesKEYCLOAK_URL
see the previous chaptersKEYCLOAK_SECRET_KEY
see the previous chaptersKEYCLOAK_ADMIN_USERNAME
see the previous chaptersKEYCLOAK_ADMIN_PASSWORD
see the previous chaptersKEYCLOAK_CLIENT_ID
see the previous chaptersKEYCLOAK_CLIENT_ADMINROLE_ID
see the previous chaptersKEYCLOAK_CLIENT_RESEARCHROLE_ID
see the previous chaptersKEYCLOAK_CLIENT_DOCTORROLE_ID
see the previous chaptersDATA_EXTRACTOR_HOST
the net host of the data extraction job containerADMIN_USERNAME
the administrator username used by the ai platform that will be created during the server start up process using the keycloak REST API.ADMIN_EMAIL
the administrator e-mail used by the ai platform that will be created during the server start up process using the keycloak REST API.ADMIN_PASSWORD
the administrator password used by the ai platform that will be created during the server start up process using the keycloak REST API.PROJECT_NAME
the name of the project, usually is equal to the container name propertyENVIRONMENT_NETWORK
the name of the network in which the container is includedDATAEXTRACTOR_NETWORK
the name of the network in which the container is includedCAPSULEFHIR_URL
the FHIR server URLTZ
the timezone of the containerGUI_IP
the gui ip or associated DNS (the default value is 0.0.0.0)
Following, we introduce every network used by the services included in the docker-compose file.
proxy
the network in which the proxy is includedbackend
the network used by all the backend servicesenvironment
the network in which all the executed environment are includeddataextractor_backend
the network in which the data extractor service is includedsecurity_keycloak
the network in which the keycloak service is included, this is an external defined networkregistry_net
the network in which the docker registry is included, this is an external defined network and it is necessary only if the registry is a local oneeng-fhir-server_fhircapsule
the network in which the FHIR server is included, this is an external defined network. Both, this network and the relative container should be not present if there is a FHIR server already up and running wherever in the CoE's IDEA environment
base_config
it is the base configuration file for the proxyproxy_config
it is the file that contains all the VirtualHost created to manage the CORS-impacted routes
The following are the volumes used by the entire ai-platform to store all the generated data useful for its correct execution:
idea4rc_data_dir
pg_data_aiapi
dataextractionjobs_db
dataextractionjobs
further these volumes, each time the user generates a new environment, the system will create dynamically two new volumes related to the new environment container.
From the root folder, you must use the following command to execute the docker compose file related to the ai-platform:
docker-compose up -d
To enable the data extraction process managed by the data extractor job service, it is mandatory to have a reachable FHIR server used for data extraction jobs.
If you already have one, you can omit this passage. If not, you have to start a temporary FHIR server to arrange some tests and proceed with AI models production.
To do that, you must execute from within the folder ENG-FHIR-SERVER
the following command:
docker-compose up -d
You can also configure the FHIR server using the environment section of the local docker compose file and the application.yml's properties. To have further insight about the FHIR server, you can look into the official Hapi FHIR Portal.
In order to run the example described in the GETTING STARTED guide (available from the ai gui), it is needed to upload some demo data. This is possible by executing the following instructions:
- Linux like system:
.\init_fhir_local_with_example_data.sh
- Windows like system:
.\init_fhir_local_with_example_data.ps1