Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/deploy-server-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Deploy API to Development

on:
push:
branches: ["infoway"]
workflow_dispatch: # Allows manual triggering

jobs:
call-template:
name: Development Environment
uses: deploy-server-template.yml
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.GLOBAL_DEV_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.GLOBAL_DEV_AWS_SECRET_ACCESS_KEY }}
AWS_ACCOUNT_ID: ${{ secrets.GLOBAL_DEV_AWS_ACCOUNT_ID }}
with:
environment: dev
AWS_REGION: ${{ vars.GLOBAL_DEV_AWS_REGION }}
16 changes: 16 additions & 0 deletions .github/workflows/deploy-server-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Deploy API to Production

on:
workflow_dispatch: # Allows manual triggering

jobs:
call-template:
name: Production Environment
uses: deploy-server-template.yml
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.GLOBAL_PROD_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.GLOBAL_PROD_AWS_SECRET_ACCESS_KEY }}
AWS_ACCOUNT_ID: ${{ secrets.GLOBAL_PROD_AWS_ACCOUNT_ID }}
with:
environment: prod
AWS_REGION: ${{ vars.GLOBAL_PROD_AWS_REGION }}
145 changes: 145 additions & 0 deletions .github/workflows/deploy-server-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: Deployment Template

on:
workflow_call:
inputs:
environment:
required: true
type: string
description: 'Deployment to Environment?'
default: dev
AWS_REGION:
required: true
type: string
default: "ca-central-1"
secrets:
AWS_ACCOUNT_ID:
required: true
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true

jobs:
Deploy:
name: Deploy ${{ inputs.environment }}
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
env:
EB_APP_NAME: matchbox
EB_ENV_NAME: matchbox-server-${{ inputs.environment }}-env
ECR_REPOSITORY: infoway/matchbox-server
# AWS_ACCESS_KEY_ID: ${{ secrets.GLOBAL_DEV_AWS_ACCESS_KEY_ID }}
# AWS_REGION: ca-central-1
# AWS_SECRET_ACCESS_KEY: ${{ secrets.GLOBAL_DEV_AWS_SECRET_ACCESS_KEY }}
BUCKET_NAME: infoway-${{ inputs.environment }}-github-deployment
ECR_URL: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION }}.amazonaws.com
MAVEN_CACHE_FOLDER: ~/.m2/repository

steps:
- name: Print environment variable
run: |
echo "EB_APP_NAME is $EB_APP_NAME"
echo "EB_ENV_NAME is $EB_ENV_NAME"
echo "ECR_REPOSITORY is $ECR_REPOSITORY"
echo "AWS_REGION is $AWS_REGION"
echo "ECR_URL is $ECR_URL"

- name: Checkout Code
uses: actions/checkout@v5
with:
fetch-depth: 1

- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: "21"
distribution: "temurin"

- name: Generate Today's Date
run: |
echo "TIMESTAMP=$(date -u +'%Y-%m-%dT%H:%M:%S.%3NZ')" >> $GITHUB_ENV

- name: Get GIT Short Hash
run: |
echo "SHORT_HASH=${GITHUB_SHA:0:8}" >> $GITHUB_ENV

- name: Set short commit hash
run: echo "Short Hash ${{ env.SHORT_HASH }}"

- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ${{ env.MAVEN_CACHE_FOLDER }}
key: maven-${{ runner.os }}-${{ env.EB_ENV_NAME }}
restore-keys: |
maven-${{ runner.os }}-${{ env.EB_ENV_NAME }}

- name: Build EB Version
run: |
echo "EB_APP_VERSION=${{ env.EB_APP_NAME }}-${{ env.SHORT_HASH }}" >> $GITHUB_ENV

- name: Generate Dockerrun.aws.json
run: |
echo '{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "${{ env.ECR_URL }}/${{ env.ECR_REPOSITORY }}:${{ env.SHORT_HASH }}",
"Update": "true"
},
"Ports": [
{ "ContainerPort": 8080 }
]
}' > Dockerrun.aws.json

- name: Build ZIP Filename
run: |
echo "ZIP_FILE=${{ env.EB_APP_VERSION }}.zip" >> $GITHUB_ENV

- name: Zip deployment bundle
run: |
cat Dockerrun.aws.json
zip -r "${{ env.ZIP_FILE }}" Dockerrun.aws.json

- name: Build with Maven without tests
run: mvn package -DskipTests -Dmaven.repo.local="${{ env.MAVEN_CACHE_FOLDER }}"

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ inputs.AWS_REGION }}

- name: Login to Amazon ECR
run: |
aws ecr get-login-password | docker login --username AWS --password-stdin "${{ env.ECR_URL }}"

- name: Build Docker image
run: |
docker build --build-arg ENVIRONMENT=${{ inputs.environment }} --build-arg VERSION=${{ env.SHORT_HASH }} --build-arg TIMESTAMP=${{ env.TIMESTAMP }} -t ${{ env.ECR_REPOSITORY }}:latest .
docker tag ${{ env.ECR_REPOSITORY }}:latest "${{ env.ECR_URL }}/${{ env.ECR_REPOSITORY }}:${{ inputs.environment }}"
docker tag ${{ env.ECR_REPOSITORY }}:latest "${{ env.ECR_URL }}/${{ env.ECR_REPOSITORY }}:${{ env.SHORT_HASH }}"

- name: Push to Amazon ECR
run: |
docker push "${{ env.ECR_URL }}/${{ env.ECR_REPOSITORY }}:${{ inputs.environment }}"
docker push "${{ env.ECR_URL }}/${{ env.ECR_REPOSITORY }}:${{ env.SHORT_HASH }}"

- name: Upload deploy.zip to S3
run: |
aws s3 cp "${{ env.ZIP_FILE }}" "s3://${{ env.BUCKET_NAME }}/${{ env.ZIP_FILE }}"

- name: Create EB application version
continue-on-error: true
run: |
aws elasticbeanstalk create-application-version \
--application-name ${{ env.EB_APP_NAME }} \
--version-label ${{ env.EB_APP_VERSION }} \
--source-bundle S3Bucket="${{ env.BUCKET_NAME }}",S3Key="${{ env.ZIP_FILE }}"

- name: Update EB environment
run: |
aws elasticbeanstalk update-environment \
--environment-name ${{ env.EB_ENV_NAME }} \
--version-label ${{ env.EB_APP_VERSION }}
2 changes: 1 addition & 1 deletion matchbox-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>matchbox</artifactId>
<groupId>health.matchbox</groupId>
<version>4.0.15</version>
<version>4.0.15-Infoway</version>
</parent>

<artifactId>matchbox-engine</artifactId>
Expand Down
11 changes: 3 additions & 8 deletions matchbox-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>matchbox</artifactId>
<groupId>health.matchbox</groupId>
<version>4.0.15</version>
<version>4.0.15-Infoway</version>
</parent>

<artifactId>matchbox-server</artifactId>
Expand All @@ -28,11 +28,6 @@
<artifactId>postgresql</artifactId>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>

<!-- This dependency includes the core HAPI-FHIR classes -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
Expand All @@ -46,7 +41,7 @@
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</exclusions>
</dependency>

<!-- This dependency includes the JPA server itself, which is packaged separately from the rest of HAPI FHIR -->
Expand Down Expand Up @@ -240,7 +235,7 @@
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-anthropic</artifactId>
<version>1.0.0-beta1</version>
</dependency>
</dependency>
<dependency>
<groupId>dev.langchain4j</groupId>
<artifactId>langchain4j-google-ai-gemini</artifactId>
Expand Down
1 change: 1 addition & 0 deletions matchbox-server/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java -Xms1024m -Xmx24576m -Dspring.config.additional-location=file:with-ca/application.yaml -jar target/matchbox.jar
48 changes: 48 additions & 0 deletions matchbox-server/with-ca-conformance/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
server:
servlet:
context-path: /matchboxv3
spring:
datasource:
url: ""
username:
password:
driverClassName: org.postgresql.Driver

# database connection pool size
hikari:
maximum-pool-size: 10
jpa:
properties:
hibernate.dialect: org.hibernate.dialect.PostgreSQLDialect
matchbox:
fhir:
context:
fhirVersion: 4.0.1
txServer: http://tx.fhir.org
onlyOneEngine: false
httpReadOnly: true
hapi:
fhir:
# server_address: https://matchbox.apibox.ca/matchboxv3/fhir
implementationguides:
fhir_r4_core:
name: hl7.fhir.r4.core
version: 4.0.1
fhir_terminology:
name: hl7.terminology
version: 5.4.0
fhir_extensions:
name: hl7.fhir.uv.extensions.r4
version: 1.0.0
fhir-baseline-1-1-8:
name: hl7.fhir.ca.baseline
version: 1.1.8
hl7-fhir-extension-r4:
name: hl7.fhir.uv.extensions.r4
version: 5.1.0
hl7-terminology-r4:
name: hl7.terminology.r4
version: 6.0.2
psca-2-0-0-DFT-Ballot:
name: ca.infoway.io.psca
version: 2.0.0-DFT-Ballot
10 changes: 10 additions & 0 deletions matchbox-server/with-ca-conformance/fhir-settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"servers": [
{
"url": "https://terminologystandardsservice.ca/tx/fhir",
"type": "fhir",
"authenticationType": "apikey",
"apikey": "request from https://infocentral.infoway-inforoute.ca/en/system-account-requisition-process"
}
]
}
1 change: 1 addition & 0 deletions matchbox-server/with-ca/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: java -Dspring.config.additional-location=file:with-ca/application.yaml -jar matchbox.jar
18 changes: 18 additions & 0 deletions matchbox-server/with-ca/application-shared.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
server:
servlet:
context-path: /matchboxv3
matchbox:
fhir:
context:
fhirVersion: 4.0.1
txServer: http://tx.fhir.org
onlyOneEngine: false
httpReadOnly: true
hapi:
fhir:
server_address: https://matchbox.apibox.ca/matchboxv3/fhir
implementationguides:
psca:
name: ca.infoway.io.psca
version: 2.0.1-DFT-Ballot
url: file:///home/echiu/Downloads/package.tgz
Loading
Loading