-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #914 from samply/release-v0.19.3
Release v0.19.3
- Loading branch information
Showing
175 changed files
with
634 additions
and
1,610 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
services: | ||
src: | ||
image: "blaze:latest" | ||
|
||
dst: | ||
image: "blaze:latest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
version: '3.7' | ||
services: | ||
keycloak: | ||
image: "jboss/keycloak:15.0.2" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash -e | ||
|
||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" | ||
. "$SCRIPT_DIR/util.sh" | ||
|
||
BASE="http://localhost:8080/fhir" | ||
EXPECTED_SIZE=$(curl -s "$BASE?_summary=count" | jq -r .total) | ||
|
||
FILE_NAME=$(uuidgen) | ||
blazectl --no-progress --server "$BASE" download -o "$FILE_NAME.ndjson" | ||
|
||
test "download size" "$(wc -l "$FILE_NAME.ndjson" | xargs | cut -d ' ' -f1)" "$EXPECTED_SIZE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#!/bin/bash -e | ||
|
||
VERSION=0.12.0 | ||
VERSION="0.13.0" | ||
|
||
curl -sLO https://github.com/samply/blazectl/releases/download/v${VERSION}/blazectl-${VERSION}-linux-amd64.tar.gz | ||
tar xzf blazectl-${VERSION}-linux-amd64.tar.gz | ||
rm blazectl-${VERSION}-linux-amd64.tar.gz | ||
curl -sLO "https://github.com/samply/blazectl/releases/download/v$VERSION/blazectl-$VERSION-linux-amd64.tar.gz" | ||
tar xzf "blazectl-$VERSION-linux-amd64.tar.gz" | ||
rm "blazectl-$VERSION-linux-amd64.tar.gz" | ||
sudo mv ./blazectl /usr/local/bin/blazectl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
version: '3.2' | ||
services: | ||
blaze: | ||
image: "samply/blaze:0.19" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
version: '3.7' | ||
services: | ||
keycloak: | ||
image: "jboss/keycloak:15.0.2" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,93 @@ | ||
# Sync Resources from Another FHIR Server to Blaze | ||
|
||
## Using Subscriptions | ||
|
||
If you want to facilitate the CQL engine or other features of Blaze, but you can't or don't like to use Blaze as your primary FHIR server, you can configure your primary FHIR server to automatically sync every change to Blaze by using the [subscription][1] mechanism. | ||
|
||
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 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: | ||
After both servers are up and running, you can create two subscriptions, one for Patient resources and one for Observations. Please run: | ||
|
||
```sh | ||
curl -H 'Content-Type: application/fhir+json' -d @subscription-bundle.json http://localhost:8090/fhir | ||
``` | ||
|
||
After you created the subscriptions, you can import or change data on the HAPI server, and it will be synced automatically to the Blaze server. | ||
|
||
One problem, you may encounter is that if you issue transactions against HAPI with resources referencing each other, HAPI will not send them in the right order to Blaze, so that Blaze is complaining about violated referential integrity. | ||
Because the subscription mechanism doesn't send the resources in the right order to satisfy referential integrity, Blaze is started with `ENFORCE_REFERENTIAL_INTEGRITY` set to `false`. | ||
|
||
|
||
## Create a Full Clone of a Blaze Server | ||
|
||
Another use-case would be to copy all data from one Blaze server to another. That can be useful to either: | ||
|
||
* remove the history from a Blaze server, | ||
* create a snapshot of all resources, | ||
* migrate from Blaze to another FHIR server or the other way around. | ||
|
||
### Setup Test Environment | ||
|
||
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 | ||
``` | ||
|
||
You should see a `src` server started at port 8080 and a `dst` server started at port 8082. | ||
|
||
### Load Data into the Source Server | ||
|
||
Next, load some data into the source server: | ||
|
||
```sh | ||
blazectl upload --server http://localhost:8080/fhir .github/test-data/synthea | ||
``` | ||
|
||
After that finishes, you can use `blazectl count-resources` to ensure that the source server has data and the destination server hasn't: | ||
|
||
```sh | ||
blazectl count-resources --server http://localhost:8080/fhir | ||
blazectl count-resources --server http://localhost:8082/fhir | ||
``` | ||
|
||
### Copy All Resources from Source to Destination | ||
|
||
The `copy-data.sh` script uses [GNU Parallel][3]. You may have to install that first. | ||
|
||
```sh | ||
scripts/copy-data.sh http://localhost:8080/fhir http://localhost:8082/fhir | ||
``` | ||
|
||
The script outputs `Successfully send transaction bundle` for each transaction bundle send to the destination server. | ||
|
||
You can use `blazectl count-resources` to see whether the resource counts of the destination server equals the resource counts of the source server: | ||
|
||
```sh | ||
blazectl count-resources --server http://localhost:8080/fhir | ||
blazectl count-resources --server http://localhost:8082/fhir | ||
``` | ||
|
||
You can also compare the resource contents between the source and the destination server by downloading all resources (of a type), removing the `Meta.versionId` and `Meta.lastUpdated` values that will be different on the destination server: | ||
|
||
```sh | ||
blazectl download --server http://localhost:8080/fhir Patient | jq -c 'del(.meta.versionId) | del(.meta.lastUpdated)' > src-patients.ndjson | ||
blazectl download --server http://localhost:8082/fhir Patient | jq -c 'del(.meta.versionId) | del(.meta.lastUpdated)' > dst-patients.ndjson | ||
diff src-patients.ndjson dst-patients.ndjson | ||
``` | ||
|
||
### Save All Resources from the Source Server | ||
|
||
If you don't like to copy the data into the destination server immediately, you can also save the transaction bundles on disk and use `blazectl upload` later to upload them to the destination server. | ||
|
||
```sh | ||
mkdir dst | ||
scripts/save-data.sh http://localhost:8080/fhir dst | ||
``` | ||
|
||
[1]: <https://www.hl7.org/fhir/subscription.html> | ||
[2]: <https://hapifhir.io> | ||
[3]: <https://www.gnu.org/software/parallel/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
services: | ||
src: | ||
image: "samply/blaze:0.19" | ||
environment: | ||
BASE_URL: "http://localhost:8080" | ||
JAVA_TOOL_OPTIONS: "-Xmx2g" | ||
LOG_LEVEL: "debug" | ||
ports: | ||
- "8080:8080" | ||
volumes: | ||
- "blaze-data-src:/app/data" | ||
|
||
dst: | ||
image: "samply/blaze:0.19" | ||
environment: | ||
BASE_URL: "http://localhost:8082" | ||
SERVER_PORT: "8082" | ||
JAVA_TOOL_OPTIONS: "-Xmx2g" | ||
ENFORCE_REFERENTIAL_INTEGRITY: "false" | ||
LOG_LEVEL: "debug" | ||
ports: | ||
- "8082:8082" | ||
volumes: | ||
- "blaze-data-dst:/app/data" | ||
|
||
volumes: | ||
blaze-data-src: | ||
blaze-data-dst: |
Oops, something went wrong.