Skip to content

Commit

Permalink
Replace Standalone Docker Compose with Build-in One
Browse files Browse the repository at this point in the history
GitHub Actions removed docker-compose:
actions/runner-images#9692

Also did some CQL and Dev Docs.
  • Loading branch information
alexanderkiel committed Aug 1, 2024
1 parent 43f64ce commit e5aece5
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 33 deletions.
44 changes: 22 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ jobs:
if: ${{ matrix.variant == 'standalone' }}

- name: Run Kafka, Cassandra and Blaze
run: docker-compose -f .github/distributed-test/docker-compose.yml up -d
run: docker compose -f .github/distributed-test/docker-compose.yml up -d
if: ${{ matrix.variant == 'distributed' }}

- name: Wait for Blaze
Expand All @@ -597,23 +597,23 @@ jobs:
if: ${{ matrix.variant == 'standalone' }}

- name: Docker Logs Kafka
run: docker-compose -f .github/distributed-test/docker-compose.yml logs kafka
run: docker compose -f .github/distributed-test/docker-compose.yml logs kafka
if: ${{ matrix.variant == 'distributed' }}

- name: Docker Logs Cassandra 1
run: docker-compose -f .github/distributed-test/docker-compose.yml logs cassandra-1
run: docker compose -f .github/distributed-test/docker-compose.yml logs cassandra-1
if: ${{ matrix.variant == 'distributed' }}

- name: Docker Logs Cassandra 2
run: docker-compose -f .github/distributed-test/docker-compose.yml logs cassandra-2
run: docker compose -f .github/distributed-test/docker-compose.yml logs cassandra-2
if: ${{ matrix.variant == 'distributed' }}

- name: Docker Logs Blaze 1
run: docker-compose -f .github/distributed-test/docker-compose.yml logs blaze-1
run: docker compose -f .github/distributed-test/docker-compose.yml logs blaze-1
if: ${{ matrix.variant == 'distributed' }}

- name: Docker Logs Blaze 2
run: docker-compose -f .github/distributed-test/docker-compose.yml logs blaze-2
run: docker compose -f .github/distributed-test/docker-compose.yml logs blaze-2
if: ${{ matrix.variant == 'distributed' }}

- name: Docker Stats
Expand Down Expand Up @@ -1496,22 +1496,22 @@ jobs:
run: docker load --input /tmp/blaze.tar

- name: Run Keycloak
run: docker-compose -f .github/openid-auth-test/docker-compose.yml up -d keycloak
run: docker compose -f .github/openid-auth-test/docker-compose.yml up -d keycloak

- name: Wait for Keycloak
run: .github/scripts/wait-for-url.sh http://localhost:8090/health/ready

- name: Run Blaze
run: docker-compose -f .github/openid-auth-test/docker-compose.yml up -d blaze
run: docker compose -f .github/openid-auth-test/docker-compose.yml up -d blaze

- name: Wait for Blaze
run: .github/scripts/wait-for-url.sh http://localhost:8080/health

- name: Docker Logs Keycloak
run: docker-compose -f .github/openid-auth-test/docker-compose.yml logs keycloak
run: docker compose -f .github/openid-auth-test/docker-compose.yml logs keycloak

- name: Docker Logs Blaze
run: docker-compose -f .github/openid-auth-test/docker-compose.yml logs blaze
run: docker compose -f .github/openid-auth-test/docker-compose.yml logs blaze

- name: Unauthenticated Request
run: test "MSG_AUTH_REQUIRED" = "$(curl -s http://localhost:8080/fhir | jq -r .issue[0].details.coding[0].code)"
Expand All @@ -1537,13 +1537,13 @@ jobs:
run: docker load --input /tmp/blaze.tar

- name: Run Keycloak and Blaze
run: docker-compose -f .github/custom-search-parameters-test/docker-compose.yml up -d
run: docker compose -f .github/custom-search-parameters-test/docker-compose.yml up -d

- name: Wait for Blaze
run: .github/scripts/wait-for-url.sh http://localhost:8080/health

- name: Docker Logs Blaze
run: docker-compose -f .github/custom-search-parameters-test/docker-compose.yml logs blaze
run: docker compose -f .github/custom-search-parameters-test/docker-compose.yml logs blaze

- name: Create Patient
run: .github/custom-search-parameters-test/create-patient.sh
Expand Down Expand Up @@ -1572,7 +1572,7 @@ jobs:
run: docker load --input /tmp/blaze.tar

- name: Run Test Setup
run: docker-compose -f docs/data-sync/copy/docker-compose.yml -f .github/doc-copy-data-test/docker-compose.override.yml up -d
run: docker compose -f docs/data-sync/copy/docker-compose.yml -f .github/doc-copy-data-test/docker-compose.override.yml up -d

- name: Wait for Source Blaze
run: .github/scripts/wait-for-url.sh http://localhost:8080/health
Expand Down Expand Up @@ -1677,19 +1677,19 @@ jobs:
run: make build-ingress

- name: Run Keycloak
run: docker-compose -f modules/frontend-e2e/docker-compose.yml up -d keycloak
run: docker compose -f modules/frontend-e2e/docker-compose.yml up -d keycloak

- name: Sleep 20 Seconds
run: sleep 20

- name: Run Everything Else
run: docker-compose -f modules/frontend-e2e/docker-compose.yml up -d
run: docker compose -f modules/frontend-e2e/docker-compose.yml up -d

- name: Sleep 30 Seconds
run: sleep 30

- name: Docker Logs
run: docker-compose -f modules/frontend-e2e/docker-compose.yml logs
run: docker compose -f modules/frontend-e2e/docker-compose.yml logs

- name: Load Data
run: modules/frontend-e2e/upload.sh
Expand Down Expand Up @@ -1851,7 +1851,7 @@ jobs:
run: docker load --input /tmp/blaze.tar

- name: Run Kafka, Cassandra and Blaze
run: docker-compose -f .github/distributed-test/docker-compose.yml up -d
run: docker compose -f .github/distributed-test/docker-compose.yml up -d

- name: Wait for Blaze 1
run: .github/scripts/wait-for-url.sh http://localhost:8081/metrics
Expand All @@ -1860,19 +1860,19 @@ jobs:
run: .github/scripts/wait-for-url.sh http://localhost:8082/metrics

- name: Docker Logs Kafka
run: docker-compose -f .github/distributed-test/docker-compose.yml logs kafka
run: docker compose -f .github/distributed-test/docker-compose.yml logs kafka

- name: Docker Logs Cassandra 1
run: docker-compose -f .github/distributed-test/docker-compose.yml logs cassandra-1
run: docker compose -f .github/distributed-test/docker-compose.yml logs cassandra-1

- name: Docker Logs Cassandra 2
run: docker-compose -f .github/distributed-test/docker-compose.yml logs cassandra-2
run: docker compose -f .github/distributed-test/docker-compose.yml logs cassandra-2

- name: Docker Logs Blaze 1
run: docker-compose -f .github/distributed-test/docker-compose.yml logs blaze-1
run: docker compose -f .github/distributed-test/docker-compose.yml logs blaze-1

- name: Docker Logs Blaze 2
run: docker-compose -f .github/distributed-test/docker-compose.yml logs blaze-2
run: docker compose -f .github/distributed-test/docker-compose.yml logs blaze-2

- name: Docker Stats
run: docker stats --no-stream
Expand Down
5 changes: 3 additions & 2 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ The most reliable way to build Blaze is to use GitHub CI. If you create a PR, a

### Using a Local Build Environment

* install Java 17
* install Java 21
* install nodejs v18
* install Clojure by following this [guide](https://clojure.org/guides/install_clojure)
* install Make
* install cljfmt: `clj -Ttools install io.github.weavejester/cljfmt '{:git/tag "0.11.2"}' :as cljfmt`
* run `make -C job-ig build` to create the FHIR profiles
* run `make uberjar` to create the uberjar that will be available under the `target` directory
* run `docker build .` to build the Docker image
* run `docker build -t blaze:latest .` to build the Docker image

## Working with IntelliJ

Expand Down
4 changes: 2 additions & 2 deletions docs/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ If this feature is activated, all FHIR Endpoints will require a valid [JWT][2] i
In order to test the authentication feature, please start first [Keycloak][4] and then Blaze as defined in the Docker Compose file in the `docs/authentication` directory:

```sh
docker-compose up keycloak
docker compose up keycloak
```

wait until keycloak is started

```sh
docker-compose up blaze
docker compose up blaze
```

after both services are up, please run:
Expand Down
4 changes: 2 additions & 2 deletions docs/data-sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ If you want to facilitate the CQL engine or other features of Blaze, but you can
In this example we use [HAPI][2] as our primary FHIR server. In the `docs/data-sync` directory, you can find a Docker Compose file with a setup of a HAPI and a Blaze server. Please start the containers by running:

```sh
docker-compose -f docs/data-sync/subscription/docker-compose.yml up
docker compose -f docs/data-sync/subscription/docker-compose.yml up
```

After both servers are up and running, you can create two subscriptions, one for Patient resources and one for Observations. Please run:
Expand All @@ -34,7 +34,7 @@ Another use-case would be to copy all data from one Blaze server to another. Tha
In order to test copying all data from one Blaze server to another, start the following Docker Compose project:

```sh
docker-compose -f docs/data-sync/copy/docker-compose.yml up
docker compose -f docs/data-sync/copy/docker-compose.yml up
```

You should see a `src` server started at port 8080 and a `dst` server started at port 8082.
Expand Down
2 changes: 1 addition & 1 deletion docs/deployment/distributed-backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Please be aware that we **don't recommend** to run Blaze on a single server usin
You will need about 32 GB of RAM to be able to run the example smoothly. You can start it by going into the `docs/deployment/distributed` directory and run:

```sh
docker-compose up -d
docker compose up -d
```

Currently, Blaze uses [Kafka][1] for the Transaction Log and [Cassandra][4] for the Resource Store, so the example uses the same. A walk-through of the components follows:
Expand Down
6 changes: 3 additions & 3 deletions docs/deployment/full-standalone.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ Two certificates and one trust store should be generated in the `modules/ingress
After you have created the certificates, you can start the system by going into the `docs/deployment/full-standalone` directory and run:

```sh
docker-compose up -d keycloak
docker compose up -d keycloak
```

first, because it needs to be fully started before the Blaze components can start to avoid waiting an additional minute for Blaze fetching the Keycloak config again. After Keycloak runs, start the rest of the components:

```sh
docker-compose up -d
docker compose up -d
```

Watch all components to start completely by looking into the log output:

```sh
docker-compose logs -f
docker compose logs -f
```

In your browser, please go to `https://blaze.localhost/fhir`.
Expand Down
51 changes: 51 additions & 0 deletions docs/implementation/cql.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,54 @@
# CQL

## Compilation and Evaluation Pipeline

```
╭───────────────────────╮
│ CQL → ELM Translation │
╰───────────┬───────────╯
╭───────────┴───────────╮
│ ELM Compilation │
╰───────────┬───────────╯
╭───────────┴───────────╮
│ Unfiltered Context │
│ Evaluation │
╰───────────┬───────────╯
╭───────────┴───────────╮
│ Reference Resolution │
╰───────────┬───────────╯
╭───────────┴───────────╮
│ Optimization │
╰───────────┬───────────╯
╭───────────┴───────────╮
│ Bloom filter attach │
╰───────────┬───────────╯
╭───────────┴───────────╮
│ Parallel Patient │
│ Context Evaluation │
╰───────────────────────╯
```

```
╭──────────────╮ ╭───────────────────────────────╮ ╭────────────────────────╮
│ Patient │ │ MedicationAdministration │ │ Medciation: ATC 1234 │
╰──────────────╯ ╰───────────────────────────────╯ ╰────────────────────────╯
╭──────────────╮ ╭───────────────────────────────╮
│ Patient │ │ Observation: loinc 788-7 │
╰──────────────╯ ╰───────────────────────────────╯
```

### CQL → ELM Translation

The Expression Logical Model (ELM) is the abstract syntax tree (AST) form of CQL. Blaze uses the CQL → ELM translator from the [Clinical Quality Framework][1] project. After that translation, the ELM expressions are available in JSON form and are parsed into Clojure data structures. The function doing this is `blaze.cql-translator/translate`.

### ELM Compilation

The ELM expression are compiled into instances of the `blaze.elm.compiler.core/Expression` protocol. During this compilation a first optimization of static values and compilation of database queries is done. The database node is used during that compilation. The function used is `blaze.elm.compiler.library/compile-library`.

### Unfiltered Context Evaluation

## Expression Cache

* bloom filter
Expand Down Expand Up @@ -86,3 +135,5 @@ O C E S
| | ^
S E C O
```

[1]: <https://github.com/cqframework>
6 changes: 6 additions & 0 deletions modules/cache-collector/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ test: prep
test-coverage: prep
clojure -M:test:coverage

cloc-prod:
cloc src

cloc-test:
cloc test

deps-tree:
clojure -X:deps tree

Expand Down
2 changes: 1 addition & 1 deletion modules/frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ First run `make clean build` to install all NPM dependencies and build the front
Second, start Keycloak:

```sh
docker-compose up
docker compose up
```

Third, run the frontend in dev mode:
Expand Down

0 comments on commit e5aece5

Please sign in to comment.