Lab Setup

Lab Setup and Verification

Checklist

Artefact Verification

  1. Go to <CS595 Lab Folder>/labs/ccd

  2. Make sure the folder contains:

    1. 📂 Samples : Folder containing sample patient notes for the lab exercises

    2. 📂 fhir : Folder containing application.yaml , HAPIFHIR config file

    3. 📂 postgres_data : Folder containing the base DB for launching CCD

    4. CCD Scripts

      1. Unix/MacOS

        1. start-ao-ccd-service.sh : Script to launch CCD on Unix/MacOS

        2. stop-ao-ccd-service.sh : Script to stop CCD on Unix/MacOS

      2. Windows

        1. start-ao-ccd-service.bat : Script to launch CCD on Windows

        2. stop-ao-ccd-service.bat : Script to stop CCD on Windows

Dependency Verification

Docker

  1. Verify docker is running by running docker --version command

  2. If docker is not running launch Docker Desktop

Note: If you have any issues installing or running docker, please take the help of ChatGPT to find the alternate steps you can follow.

PostgreSQL

Make sure no other instances on PostgreSQL running on port 5432

  • MacOs/Unix Command

    • Command to check lsof -i :5432 If PostgreSQL is running, you will see output indicating that port 5432 is in use, along with the process ID (PID)

    • Command to stop kill <PID>

  • Windows Command

    • Command to check netstat -ano | findstr :5432 If PostgreSQL is running, you will see output indicating that port 5432 is in use, along with the process ID (PID)

    • Command to stop taskkill /PID /F

Note: If you are not able to stop the PgSQL, please take the help of ChatGPT to find the alternate steps you can follow.

Configuring CCD with LoF Service Credentials

  1. Go to <CS595 Lab Folder>/labs/ccd

  2. Updating Start Scripts

    1. For Unix/macOS : start-ao-ccd-service.sh

      1. For AO Service

            -e lof_service_client_id="include_client_id_here" \
            -e lof_service_client_secret="include_client_secret_here" \
      2. For CCD Service

          -e client_id="include_client_id_here" \
          -e client_secret="include_client_secret_here" \
    2. For Windows : start-ao-ccd-service.bat

      1. For AO Service

            -e lof_service_client_id="include_client_id_here" ^
            -e lof_service_client_secret="include_client_secret_here" ^
      2. For CCD Service

          -e client_id="include_client_id_here" ^
          -e client_secret="include_client_secret_here" ^

Starting CCD

  1. Go to <CS595 Lab Folder>/labs/ccd

  2. Run the start script

    1. MacOS/Unix : ./start-ao-ccd-service.sh or sh start-ao-ccd-service.sh

    2. Windows : ./start-ao-ccd-service.bat

Note: The first launch will take few minutes for the docker containers to download. Subsequent launches should be fast.

At the end you should see all 4 services running:

  • aodb - Docker Service for PgSQL16

  • fhirservice - HAPIFHIR Docker Service

  • aoservice - AO Backend Service

  • ccdservice - CCD UI Service

Services Running
CONTAINER ID   IMAGE                          COMMAND                  CREATED                  STATUS                  PORTS                    NAMES
0c0c13b27104   rcpu/lof-services:ccdservice   "/usr/local/bin/entr…"   Less than a second ago   Up Less than a second   0.0.0.0:4200->80/tcp     ccdservice
3a9d9fbf4e2e   rcpu/lof-services:aoservice    "bash /start /start"     22 seconds ago           Up 20 seconds           0.0.0.0:8000->8000/tcp   aoservice
4062e5106a35   hapiproject/hapi:latest        "java --class-path /…"   2 minutes ago            Up 2 minutes            0.0.0.0:8080->8080/tcp   fhirservice
39fe3fc8db7e   postgres:16                    "docker-entrypoint.s…"   2 minutes ago            Up 2 minutes            0.0.0.0:5432->5432/tcp   aodb

Verification

You can check the status of services by running command docker ps -a. You should see all 4 services up and running. If you don't see the status as up for any services, check the Debugging CCD section for issue identification and resolution.

(base) cpu@Chandans-MacBook-Pro ccd % docker ps -a
CONTAINER ID   IMAGE                          COMMAND                  CREATED              STATUS              PORTS                    NAMES
ea8f78235844   rcpu/lof-services:ccdservice   "/usr/local/bin/entr…"   About a minute ago   Up About a minute   0.0.0.0:4200->80/tcp     ccdservice
dda972539591   rcpu/lof-services:aoservice    "bash /start /start"     2 minutes ago        Up 2 minutes        0.0.0.0:8000->8000/tcp   aoservice
a45d2d19878c   hapiproject/hapi:latest        "java --class-path /…"   2 minutes ago        Up 2 minutes        0.0.0.0:8080->8080/tcp   fhirservice
36fd62719f34   postgres:16                    "docker-entrypoint.s…"   2 minutes ago        Up 2 minutes        0.0.0.0:5432->5432/tcp   aodb

Debugging CCD

General

1. Docker Desktop blocked on Mac

Indications:

https://www.bleepingcomputer.com/news/security/docker-desktop-blocked-on-macs-due-to-false-malware-alert/

Resolution:

https://docs.docker.com/desktop/cert-revoke-solution/

2. Docker Host Networking Not enabled

Indications:

Run docker inspect <container_id> and check for getway info. The Gateway will not have any IP assigned

AO Service and FHIR service logs indicate they connection to DB, over docker gateway IP, could not be established.

Resolution:

  • Go to Docker Desktop --> Settings --> Resources --> Network

  • If you see the option Enable host networking

    • Make sure to select/enable it

    • Click Apply and Restart

3. Invalid Reference format error

Indications:

Starting AODB docker: invalid reference format. See 'docker run --help'. 
Starting FHIRService docker: invalid reference format. See 'docker run --help'.

Resolution:

This happens when your <FULL_PATH_TO_PROJECT_ROOT> contains space or not acceptable special characters. Make sure your root folder path has only letters and underscore.

AO DB Service

  1. Port 5432 is already in use and not available Indications:

    Error log during CCD launch

    Starting AODB
    008872843a20002556dbf2099546b5aef4ddea9fc45b3c6bc2bb9e1d3d288a52
    docker: Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:5432 -> 0.0.0.0:0: listen tcp 0.0.0.0:5432: bind: address already in use.

    The aodb docker service status not UP

    (base) cpu@Chandans-MacBook-Pro ccd % docker ps -a                
    CONTAINER ID   IMAGE                          COMMAND                  CREATED              STATUS                          PORTS                  NAMES
    008872843a20   postgres:16                    "docker-entrypoint.s…"   2 minutes ago        Created                                                aodb

    Resolution: Follow PostgreSQLChecklist to make sure no other PGSql instance is running on 5432 Once the existing PgSQL instances are stopped, rerun the CCD start script.

  2. Postgres DB Folder not present Indications: fhirservice and aoservice not running. Use docker ps -a command to verify running services.

    (base) cpu@Chandans-MacBook-Pro ccd % docker ps -a               
    CONTAINER ID   IMAGE                          COMMAND                  CREATED         STATUS                     PORTS                    NAMES
    49595a9a4d33   rcpu/lof-services:ccdservice   "/usr/local/bin/entr…"   6 minutes ago   Up 6 minutes               0.0.0.0:4200->80/tcp     ccdservice
    ec8b5bccd715   rcpu/lof-services:aoservice    "bash /start /start"     7 minutes ago   Exited (1) 6 minutes ago                            aoservice
    38ba0f76b71e   hapiproject/hapi:latest        "java --class-path /…"   7 minutes ago   Exited (1) 6 minutes ago                            fhirservice
    b7ee35d96a6d   postgres:16                    "docker-entrypoint.s…"   7 minutes ago   Up 7 minutes               0.0.0.0:5432->5432/tcp   aodb

    Check the logs using docker logs -f <aodb_container_id> aodb docker service logs indicating aodb and fhirdb are not present

    (base) cpu@Chandans-MacBook-Pro ccd % docker logs -f b7ee35d96a6d
    
    PostgreSQL Database directory appears to contain a database; Skipping initialization
    
    2025-01-08 08:09:31.033 UTC [1] LOG:  starting PostgreSQL 16.6 (Debian 16.6-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
    2025-01-08 08:09:31.033 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
    2025-01-08 08:09:31.033 UTC [1] LOG:  listening on IPv6 address "::", port 5432
    2025-01-08 08:09:31.036 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
    2025-01-08 08:09:31.047 UTC [29] LOG:  database system was shut down at 2025-01-08 08:09:28 UTC
    2025-01-08 08:09:31.065 UTC [1] LOG:  database system is ready to accept connections
    2025-01-08 08:09:35.012 UTC [33] FATAL:  database "aodb" does not exist
    2025-01-08 08:09:41.892 UTC [34] FATAL:  database "fhirdb" does not exist
    2025-01-08 08:09:45.758 UTC [35] FATAL:  database "fhirdb" does not exist
    2025-01-08 08:14:31.933 UTC [27] LOG:  checkpoint starting: time
    2025-01-08 08:14:35.251 UTC [27] LOG:  checkpoint complete: wrote 35 buffers (0.2%); 0 WAL file(s) added, 0 removed, 0 recycled; write=3.302 s, sync=0.003 s, total=3.318 s; sync files=10, longest=0.002 s, average=0.001 s; distance=170 kB, estimate=170 kB; lsn=0/1514F50, redo lsn=0/1514F18

    Resolution: 1. Go to <CS595 Lab Folder>/labs/ccd 2. Delete postgres_data folder if exists 3. Follow CCD PostgreSQL DB and extract the DB backup to ccd folder

FHIR Service

FHIR Service not running

Indications: fhirservice not running. Use docker ps -a command to verify running services.

(base) cpu@Chandans-MacBook-Pro ccd % docker ps -a
CONTAINER ID   IMAGE                          COMMAND                  CREATED          STATUS                              PORTS                    NAMES
0623179a7ba1   rcpu/lof-services:ccdservice   "/usr/local/bin/entr…"   7 seconds ago    Up 6 seconds                        0.0.0.0:4200->80/tcp     ccdservice
51a460b56290   rcpu/lof-services:aoservice    "bash /start /start"     18 seconds ago   Up 17 seconds                       0.0.0.0:8000->8000/tcp   aoservice
88fdd39712a7   hapiproject/hapi:latest        "java --class-path /…"   18 seconds ago   Exited (1) Less than a second ago                            fhirservice
f909d70ba17d   postgres:16                    "docker-entrypoint.s…"   19 seconds ago   Up 18 seconds                       0.0.0.0:5432->5432/tcp   aodb

If fhirserivce is not running check the logs using docker logs -f <fhirservice_container_id>

(base) cpu@Chandans-MacBook-Pro ccd % docker logs -f 88fdd39712a7

Logs:

org.postgresql.util.PSQLException: FATAL: password authentication failed for user "postgres"
org.postgresql.util.PSQLException: FATAL: database "fhirdb" does not exist

Resolution:

  1. Stop the CCD services.

  2. Follow PostgreSQL section to stop other instances running

  3. Follow CCD PostgreSQL DB place the backup in the right folder

  4. Start the CCD services

AO Service

  1. LoF Credentials not configured or Incorrect credentials used Indications:

    (base) cpu@Chandans-MacBook-Pro ccd % docker ps -a
    CONTAINER ID   IMAGE                          COMMAND                  CREATED              STATUS                          PORTS                    NAMES
    64c0bf4bd70c   rcpu/lof-services:ccdservice   "/usr/local/bin/entr…"   About a minute ago   Exited (1) About a minute ago                            ccdservice
    cc6998dc901e   rcpu/lof-services:aoservice    "bash /start /start"     About a minute ago   Exited (1) About a minute ago                            aoservice
    a55ad28fe2bd   hapiproject/hapi:latest        "java --class-path /…"   About a minute ago   Up About a minute               0.0.0.0:8080->8080/tcp   fhirservice
    a05c823405cb   postgres:16                    "docker-entrypoint.s…"   About a minute ago   Up About a minute               0.0.0.0:5432->5432/tcp   aodb
    
    (base) cpu@Chandans-MacBook-Pro ccd % docker logs -f cc6998dc901e
    
    
    Failed to fetch access token: 400 {"error":"Invalid client ID"}

    Resolution: Please follow Configuring CCD with LoF Service Credentials and update the credentials

  2. LoF Credentials with restrictive permission Indications:

    (base) cpu@Chandans-MacBook-Pro ccd % docker ps -a
    CONTAINER ID   IMAGE                          COMMAND                  CREATED              STATUS                          PORTS                    NAMES
    3d4164628ec4   rcpu/lof-services:ccdservice   "/usr/local/bin/entr…"   About a minute ago   Exited (1) About a minute ago                            ccdservice
    304214a2945a   rcpu/lof-services:aoservice    "bash /start /start"     About a minute ago   Exited (1) About a minute ago                            aoservice
    943e2163b1ab   hapiproject/hapi:latest        "java --class-path /…"   About a minute ago   Up About a minute               0.0.0.0:8080->8080/tcp   fhirservice
    33941f0893ef   postgres:16                    "docker-entrypoint.s…"   About a minute ago   Up About a minute               0.0.0.0:5432->5432/tcp   aodb
    (base) cpu@Chandans-MacBook-Pro ccd % docker logs -f 304214a2945a
    7LtEsdppWpSUdfdbcbex_2ID2DbcbpxxFp8
    Required access {'AO_ENVIRONMENT_ACCESS', 'AO_DOCKER'} not found in: IMO-NLP IMO-NORMALIZE IMO-CORE-SEARCH IMO-IPL-CATEGORIZE IMO-IPL-CLEAN FDB-CONTENT FDB-SEARCH IMO-IPL-ITEM IMO-IPL-DETAIL AZURE-RESPONSE
    (base) cpu@Chandans-MacBook-Pro ccd % 

    Resolution: Please reach out to CS595-2025@lofllc.com Provide your email id and provide docker logs to update the missing scopes.

CCD Service

  1. LoF Credentials not configured or Incorrect credentials used Indications:

    (base) cpu@Chandans-MacBook-Pro ccd % docker ps -a
    CONTAINER ID   IMAGE                          COMMAND                  CREATED         STATUS                     PORTS                    NAMES
    64c0bf4bd70c   rcpu/lof-services:ccdservice   "/usr/local/bin/entr…"   4 minutes ago   Exited (1) 4 minutes ago                            ccdservice
    cc6998dc901e   rcpu/lof-services:aoservice    "bash /start /start"     4 minutes ago   Exited (1) 4 minutes ago                            aoservice
    a55ad28fe2bd   hapiproject/hapi:latest        "java --class-path /…"   4 minutes ago   Up 4 minutes               0.0.0.0:8080->8080/tcp   fhirservice
    a05c823405cb   postgres:16                    "docker-entrypoint.s…"   4 minutes ago   Up 4 minutes               0.0.0.0:5432->5432/tcp   aodb
    (base) cpu@Chandans-MacBook-Pro ccd % docker logs -f 64c0bf4bd70c
    Error: Missing required environment variables client_id or client_secret.
    (base) cpu@Chandans-MacBook-Pro ccd %

    (base) cpu@Chandans-MacBook-Pro ccd % docker ps -a               
    CONTAINER ID   IMAGE                          COMMAND                  CREATED              STATUS                          PORTS                    NAMES
    934b9b6fe28b   rcpu/lof-services:ccdservice   "/usr/local/bin/entr…"   54 seconds ago       Exited (1) 53 seconds ago                                ccdservice
    0e43afd42ab0   rcpu/lof-services:aoservice    "bash /start /start"     About a minute ago   Exited (1) About a minute ago                            aoservice
    b08fa3a8878c   hapiproject/hapi:latest        "java --class-path /…"   About a minute ago   Up About a minute               0.0.0.0:8080->8080/tcp   fhirservice
    f3daba48e9f7   postgres:16                    "docker-entrypoint.s…"   About a minute ago   Up About a minute               0.0.0.0:5432->5432/tcp   aodb
    (base) cpu@Chandans-MacBook-Pro ccd % docker logs -f 934b9b6fe28b
    Requesting token with client_id: 7LtEsdppWpSUfeHcAgjD9fdbcbex_2ID2DbcbpxxFp81
    Response: {"error":"Invalid client ID"}
    Scope CCD_DOCKER is missing. Exiting container.
    (base) cpu@Chandans-MacBook-Pro ccd % 

    Resolution: Please follow Configuring CCD with LoF Service Credentials and update the credentials

  2. LoF Credentials with restrictive permission Indications:

    (base) cpu@Chandans-MacBook-Pro ccd % docker ps -a  
    CONTAINER ID   IMAGE                          COMMAND                  CREATED         STATUS                     PORTS                    NAMES
    3d4164628ec4   rcpu/lof-services:ccdservice   "/usr/local/bin/entr…"   2 minutes ago   Exited (1) 2 minutes ago                            ccdservice
    304214a2945a   rcpu/lof-services:aoservice    "bash /start /start"     2 minutes ago   Exited (1) 2 minutes ago                            aoservice
    943e2163b1ab   hapiproject/hapi:latest        "java --class-path /…"   2 minutes ago   Up 2 minutes               0.0.0.0:8080->8080/tcp   fhirservice
    33941f0893ef   postgres:16                    "docker-entrypoint.s…"   2 minutes ago   Up 2 minutes               0.0.0.0:5432->5432/tcp   aodb
    (base) cpu@Chandans-MacBook-Pro ccd % docker logs -f 3d4164628ec4
    Requesting token with client_id: 7LtEsdppWpSUdfdbcbex_2ID2DbcbpxxFp8
    Response: {"access_token":"","expires_in":3600,"token_type":"Bearer","scope":"IMO-NLP IMO-NORMALIZE IMO-CORE-SEARCH IMO-IPL-CATEGORIZE IMO-IPL-CLEAN FDB-CONTENT FDB-SEARCH IMO-IPL-ITEM IMO-IPL-DETAIL AZURE-RESPONSE"}
    Scope CCD_DOCKER is missing. Exiting container.
    (base) cpu@Chandans-MacBook-Pro ccd % 

    Resolution: Please reach out to CS595-2025@lofllc.com Provide your email id and provide docker logs to update the missing scopes.

Last updated