Skip to content

Commit

Permalink
Merge branch 'master' into rel_7_1_tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
dotasek committed Apr 29, 2024
2 parents 70da0dc + 9a9cc8b commit 1d3342d
Show file tree
Hide file tree
Showing 11 changed files with 132 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/chart-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install helm-docs
working-directory: /tmp
env:
HELM_DOCS_URL: https://github.com/norwoodj/helm-docs/releases/download/v1.11.3/helm-docs_1.11.3_Linux_x86_64.tar.gz
HELM_DOCS_URL: https://github.com/norwoodj/helm-docs/releases/download/v1.13.0/helm-docs_1.13.0_Linux_x86_64.tar.gz
run: |
curl -LSs $HELM_DOCS_URL | tar xz && \
mv ./helm-docs /usr/local/bin/helm-docs && \
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 1 * * *'

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
stale-issue-message: 'This issue is stale because it has been open 730 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.'
days-before-issue-stale: 730
days-before-pr-stale: 45
days-before-issue-close: 5
days-before-pr-close: 10
31 changes: 21 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,21 +189,32 @@ public class YourInterceptor

## Running locally

The easiest way to run this server entirely depends on your environment requirements. At least, the following 4 ways are supported:
The easiest way to run this server entirely depends on your environment requirements. The following ways are supported:

### Using jetty
```bash
mvn -Pjetty jetty:run
mvn -Pjetty spring-boot:run
```

The Server will then be accessible at http:https://localhost:8080/fhir and the CapabilityStatement will be found at http:https://localhost:8080/fhir/metadata.

If you need to run this server on a different port (using Maven), you can change the port in the run command as follows:

### Using Spring Boot
```bash
mvn -Pjetty -Djetty.port=8888 jetty:run
mvn spring-boot:run
```

The Server will then be accessible at http:https://localhost:8080/fhir and the CapabilityStatement will be found at http:https://localhost:8080/fhir/metadata.

If you want to run this server on a different port, you can change the port in the `src/main/resources/application.yaml` file as follows:

```yaml
server:
# servlet:
# context-path: /example/path
port: 8888
```

Server will then be accessible at http:https://localhost:8888/ and eg. http:https://localhost:8888/fhir/metadata. Remember to adjust you overlay configuration in the application.yaml to eg.
The Server will then be accessible at http:https://localhost:8888/fhir and the CapabilityStatement will be found at http:https://localhost:8888/fhir/metadata. Remember to adjust your overlay configuration in the `application.yaml` file to the following:

```yaml
tester:
Expand All @@ -219,7 +230,7 @@ Server will then be accessible at http:https://localhost:8888/ and eg. http:https://localhos
```bash
mvn clean spring-boot:run -Pboot
```
Server will then be accessible at http:https://localhost:8080/ and eg. http:https://localhost:8080/fhir/metadata. Remember to adjust you overlay configuration in the application.yaml to eg.
Server will then be accessible at http:https://localhost:8080/ and eg. http:https://localhost:8080/fhir/metadata. Remember to adjust you overlay configuration in the application.yaml to the following:

```yaml
tester:
Expand All @@ -235,7 +246,7 @@ Server will then be accessible at http:https://localhost:8080/ and eg. http:https://localhos
```bash
mvn clean package spring-boot:repackage -Pboot && java -jar target/ROOT.war
```
Server will then be accessible at http:https://localhost:8080/ and eg. http:https://localhost:8080/fhir/metadata. Remember to adjust your overlay configuration in the application.yaml to eg.
Server will then be accessible at http:https://localhost:8080/ and eg. http:https://localhost:8080/fhir/metadata. Remember to adjust your overlay configuration in the application.yaml to the following:

```yaml
tester:
Expand All @@ -250,7 +261,7 @@ Server will then be accessible at http:https://localhost:8080/ and eg. http:https://localhos
```bash
mvn clean package com.google.cloud.tools:jib-maven-plugin:dockerBuild -Dimage=distroless-hapi && docker run -p 8080:8080 distroless-hapi
```
Server will then be accessible at http:https://localhost:8080/ and eg. http:https://localhost:8080/fhir/metadata. Remember to adjust your overlay configuration in the application.yaml to eg.
Server will then be accessible at http:https://localhost:8080/ and eg. http:https://localhost:8080/fhir/metadata. Remember to adjust your overlay configuration in the application.yaml to the following:

```yaml
tester:
Expand All @@ -266,7 +277,7 @@ Server will then be accessible at http:https://localhost:8080/ and eg. http:https://localhos
```bash
./build-docker-image.sh && docker run -p 8080:8080 hapi-fhir/hapi-fhir-jpaserver-starter:latest
```
Server will then be accessible at http:https://localhost:8080/ and eg. http:https://localhost:8080/fhir/metadata. Remember to adjust your overlay configuration in the application.yaml to eg.
Server will then be accessible at http:https://localhost:8080/ and eg. http:https://localhost:8080/fhir/metadata. Remember to adjust your overlay configuration in the application.yaml to the following:

```yaml
tester:
Expand Down
6 changes: 3 additions & 3 deletions charts/hapi-fhir-jpaserver/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: postgresql
repository: oci:https://registry-1.docker.io/bitnamicharts
version: 13.2.27
digest: sha256:6374f6f32d32adbe6763c48e2d817d85ec20a1784b2aea1fb0312c658f8e58e9
generated: "2024-01-10T17:56:36.521957926+01:00"
version: 14.3.1
digest: sha256:fb1d56a00b544bb2ad5691553cadf6384f499652acb9ff5ad625ef36a1b8979e
generated: "2024-03-10T14:43:22.395381351+01:00"
12 changes: 6 additions & 6 deletions charts/hapi-fhir-jpaserver/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ sources:
- https://github.com/hapifhir/hapi-fhir-jpaserver-starter
dependencies:
- name: postgresql
version: 13.2.27
version: 14.3.1
repository: oci:https://registry-1.docker.io/bitnamicharts
condition: postgresql.enabled
appVersion: 6.10.1
version: 0.15.0
appVersion: 7.0.3
version: 0.16.0
annotations:
artifacthub.io/license: Apache-2.0
artifacthub.io/containsSecurityUpdates: "false"
Expand All @@ -24,8 +24,8 @@ annotations:
# When using the list of objects option the valid supported kinds are
# added, changed, deprecated, removed, fixed, and security.
- kind: changed
description: updated starter image to 6.10.1
description: updated starter image to v7.0.3
- kind: changed
description: updated curlimages/curl to 8.5.0
description: updated curlimages/curl to 8.6.0
- kind: changed
description: "updated postgresql sub-chart to 13.2.27. ⚠️: this updates the used PostgreSQL image from v15 to v16."
description: "updated postgresql sub-chart to 14.3.1."
9 changes: 5 additions & 4 deletions charts/hapi-fhir-jpaserver/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# HAPI FHIR JPA Server Starter Helm Chart

![Version: 0.15.0](https://img.shields.io/badge/Version-0.15.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 6.10.1](https://img.shields.io/badge/AppVersion-6.10.1-informational?style=flat-square)
![Version: 0.16.0](https://img.shields.io/badge/Version-0.16.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 7.0.3](https://img.shields.io/badge/AppVersion-7.0.3-informational?style=flat-square)

This helm chart will help you install the HAPI FHIR JPA Server in a Kubernetes environment.

Expand All @@ -15,7 +15,7 @@ helm install hapi-fhir-jpaserver hapifhir/hapi-fhir-jpaserver

| Repository | Name | Version |
|------------|------|---------|
| oci:https://registry-1.docker.io/bitnamicharts | postgresql | 13.2.27 |
| oci:https://registry-1.docker.io/bitnamicharts | postgresql | 14.3.1 |

## Values

Expand All @@ -36,7 +36,7 @@ helm install hapi-fhir-jpaserver hapifhir/hapi-fhir-jpaserver
| image.pullPolicy | string | `"IfNotPresent"` | image pullPolicy to use |
| image.registry | string | `"docker.io"` | registry where the HAPI FHIR server image is hosted |
| image.repository | string | `"hapiproject/hapi"` | the path inside the repository |
| image.tag | string | `"v6.10.1@sha256:4eac1b3481180b028616d1fab7e657e368538063d75f7ed3be2032e34c657dd4"` | the image tag. As of v5.7.0, this is the `distroless` flavor by default, add `-tomcat` to use the Tomcat-based image. |
| image.tag | string | `"v7.0.3@sha256:73ff82fec42e5cbb7e66338d47af09ba91c140e98beeaee41a5459572d5ae1ce"` | the image tag. As of v5.7.0, this is the `distroless` flavor by default, add `-tomcat` to use the Tomcat-based image. |
| imagePullSecrets | list | `[]` | image pull secrets to use when pulling the image |
| ingress.annotations | object | `{}` | provide any additional annotations which may be required. Evaluated as a template. |
| ingress.enabled | bool | `false` | whether to create an Ingress to expose the FHIR server HTTP endpoint |
Expand All @@ -57,6 +57,7 @@ helm install hapi-fhir-jpaserver hapifhir/hapi-fhir-jpaserver
| postgresql.auth.database | string | `"fhir"` | name for a custom database to create |
| postgresql.auth.existingSecret | string | `""` | Name of existing secret to use for PostgreSQL credentials `auth.postgresPassword`, `auth.password`, and `auth.replicationPassword` will be ignored and picked up from this secret The secret must contain the keys `postgres-password` (which is the password for "postgres" admin user), `password` (which is the password for the custom user to create when `auth.username` is set), and `replication-password` (which is the password for replication user). The secret might also contains the key `ldap-password` if LDAP is enabled. `ldap.bind_password` will be ignored and picked from this secret in this case. The value is evaluated as a template. |
| postgresql.enabled | bool | `true` | enable an included PostgreSQL DB. see <https://github.com/bitnami/charts/tree/master/bitnami/postgresql> for details if set to `false`, the values under `externalDatabase` are used |
| postgresql.primary.containerSecurityContext.readOnlyRootFilesystem | bool | `true` | |
| replicaCount | int | `1` | number of replicas to deploy |
| resources | object | `{}` | configure the FHIR server's resource requests and limits |
| securityContext.allowPrivilegeEscalation | bool | `false` | |
Expand Down Expand Up @@ -139,4 +140,4 @@ kubectl port-forward -n observability service/simplest-query 16686:16686
and opening <http:https://localhost:16686/> in your browser.

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.3](https://github.com/norwoodj/helm-docs/releases/v1.11.3)
Autogenerated from chart metadata using [helm-docs v1.13.0](https://github.com/norwoodj/helm-docs/releases/v1.13.0)
2 changes: 1 addition & 1 deletion charts/hapi-fhir-jpaserver/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: wait-for-db-to-be-ready
image: docker.io/bitnami/postgresql:16.1.0-debian-11-r18@sha256:06f1f2297f6241a02bd8e8c025b31625254ca66784ac75a4a62e945fa611d045
image: docker.io/bitnami/postgresql:16.2.0-debian-12-r6@sha256:ea55532b6f75afbc97f617d91ec5efae17609c8eb825a31845fa9cb9e4aa13e1
imagePullPolicy: IfNotPresent
{{- with .Values.restrictedContainerSecurityContext }}
securityContext:
Expand Down
5 changes: 4 additions & 1 deletion charts/hapi-fhir-jpaserver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ image:
# -- the path inside the repository
repository: hapiproject/hapi
# -- the image tag. As of v5.7.0, this is the `distroless` flavor by default, add `-tomcat` to use the Tomcat-based image.
tag: "v6.10.1@sha256:4eac1b3481180b028616d1fab7e657e368538063d75f7ed3be2032e34c657dd4"
tag: "v7.0.3@sha256:73ff82fec42e5cbb7e66338d47af09ba91c140e98beeaee41a5459572d5ae1ce"
# -- image pullPolicy to use
pullPolicy: IfNotPresent

Expand Down Expand Up @@ -109,6 +109,9 @@ postgresql:
# see <https://github.com/bitnami/charts/tree/master/bitnami/postgresql> for details
# if set to `false`, the values under `externalDatabase` are used
enabled: true
primary:
containerSecurityContext:
readOnlyRootFilesystem: true
auth:
# -- name for a custom database to create
database: "fhir"
Expand Down
30 changes: 27 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,20 @@
</dependency>
</dependencies>
</profile>
<!-- examples of how to start the server using the default profile-->
<!-- mvn clean package jetty:run -->
<!-- java -jar jetty-runner.jar target/hapi-fhir-jpaserver.war -->
<!-- -->
<!-- Examples of how to run the server: -->
<!-- -->
<!-- For Spring Boot use: -->
<!-- mvn spring-boot:run -->
<!-- -->
<!-- For JETTY use: -->
<!-- mvn -Pjetty spring-boot:run -->
<!-- -->
<!-- For the Tomcat WAR approach use: -->
<!-- mvn clean package -DskipTests && java -jar ./target/ROOT.war -->
<!-- -->
<!-- NEXT: Browse to http:https://localhost:8080/fhir -->
<!-- -->
<profile>
<id>jetty</id>
<dependencies>
Expand Down Expand Up @@ -676,5 +687,18 @@
</plugins>
</build>
</profile>
<!-- For connecting to GCP CloudSQL Postgres instances:
https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/blob/main/docs/jdbc.md#postgres-1
Needs 'boot' profile as well. -->
<profile>
<id>cloudsql-postgres</id>
<dependencies>
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>postgres-socket-factory</artifactId>
<version>1.17.0</version>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
42 changes: 42 additions & 0 deletions src/main/java/ca/uhn/fhir/jpa/starter/web/JobController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package ca.uhn.fhir.jpa.starter.web;

import ca.uhn.fhir.batch2.api.IJobCoordinator;
import ca.uhn.fhir.batch2.api.JobOperationResultJson;
import ca.uhn.fhir.batch2.model.JobInstance;
import ca.uhn.fhir.batch2.model.StatusEnum;
import ca.uhn.fhir.batch2.models.JobInstanceFetchRequest;
import jakarta.validation.constraints.Min;
import org.springframework.data.domain.Sort;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("control")
public class JobController {
private final IJobCoordinator theJobCoordinator;

public JobController(IJobCoordinator theJobCoordinator) {
this.theJobCoordinator = theJobCoordinator;
}

@RequestMapping(value = JobController.JOBS, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public List<JobInstance> getAllJobs(@RequestParam(name = "pageStart") @Min(0) int pageStart, @RequestParam(name = "batchSize") int batchSize, @RequestParam(name = "jobStatus", required = false) StatusEnum jobStatus) {
JobInstanceFetchRequest jobInstanceFetchRequest = new JobInstanceFetchRequest();
jobInstanceFetchRequest.setPageStart(pageStart);
jobInstanceFetchRequest.setBatchSize(batchSize);
jobInstanceFetchRequest.setJobStatus(jobStatus != null ? jobStatus.toString() : "");
jobInstanceFetchRequest.setSort(Sort.by(Sort.Direction.DESC, JobController.MY_CREATE_TIME));

return theJobCoordinator.fetchAllJobInstances(jobInstanceFetchRequest).getContent();
}

@RequestMapping(value = JobController.JOBS, method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public JobOperationResultJson cancelInstance(@RequestParam(name = "instanceId") String instanceId) {
return theJobCoordinator.cancelInstance(instanceId);
}

public static final String JOBS = "jobs";
public static final String MY_CREATE_TIME = "myCreateTime";
}
5 changes: 3 additions & 2 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#Uncomment the following lines to enable the fhir endpoint to be available at /example/path/fhir instead of /fhir
#server:
#Uncomment the "servlet" and "context-path" lines below to make the fhir endpoint available at /example/path/fhir instead of the default value of /fhir
server:
# servlet:
# context-path: /example/path
port: 8080
#Adds the option to go to eg. http:https://localhost:8080/actuator/health for seeing the running configuration
#see https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.endpoints
management:
Expand Down

0 comments on commit 1d3342d

Please sign in to comment.