The Push Gateway handles the delivery of notifications from the TI context and abstracts communication with push providers, e.g. APNS or Firebase.
Copyright 2021-2025 gematik GmbH
EUROPEAN UNION PUBLIC LICENCE v. 1.2
EUPL © the European Union 2007, 2016
See the LICENSE for the specific language governing permissions and limitations under the License
You should have the ktfmt-Plugin
installed and enabled with google setting to avoid code
formatting issues.
In order to apply the code format run
./mvnw spotless:apply
You can run the application on your machine in the following ways.
Starting up with docker compose also starts a
jaeger-all-in-one which can be reached with a browser of
your choice at http://localhost:16686. This enables you to
test tracing of the application.
gematik-network
if it not already exists
docker network create gematik-network./mvnw clean packagedocker compose build --no-cache --force-rmdocker compose up -d --force-recreateThe charts folder contains a Helm Chart
which enables you to run the application in a local
kubernetes-like environment if you have a
kubernetes cluster up and running. There are many ways to
create one, however, the usage of k3d is described
here.
k3d on you machine by following this guidek3d registry create registry.localhost --port 5001k3d cluster create pgw --registry-use k3d-registry.localhost:5001kubectl create namespace pgwdocker tag push-gateway-backend:latest k3d-registry.localhost:5001/push-gateway-backend:<dockerTag>docker push k3d-registry.localhost:5001/push-gateway-backend:<dockerTag>$PROJECT_ROOT/charts/values/local.yaml:backend.imagekubectl create secret generic postgres-admin -n pgw \
--from-literal=username="$(openssl rand -hex 16)" \
--from-literal=password="$(openssl rand -hex 32)"kubectl create secret generic broker-credentials -n pgw \
--from-literal=username="$(openssl rand -hex 16)" \
--from-literal=password="$(openssl rand -hex 32)"--from-file=xy is
the name of the filename that must be referenced in your push
configuration:
kubectl create secret generic apns-pkcs12-certs -n pgw --from-file=certfile.p12=<certfile-on-your-machine>.p12
kubectl create secret generic apns-pkcs8-certs -n pgw --from-file=keyfile.p8=<keyfile-on-your-machine>.p8
kubectl create secret generic firebase-service-account-jsons -n pgw --from-file=service-account.json=<json-file-on-your-machine>.jsonInstall or upgrade the application in your kubernetes cluster
helm install pgw ./charts -f charts/values.yaml -f charts/values/local.yaml -n pgw
helm upgrade pgw ./charts -f charts/values.yaml -f charts/values/local.yaml --install -n pgw
From now on you can use kubectl commands to see logs,
forward ports, etc.
Default values are maintained in charts/values.yaml and
can be overridden by files in charts/values/. You can set
up your own local environment by copying the default values.yaml to
charts/values/local.yaml. This file is ignored by git and
never checked in. Adapt according to your needs.
Running the application with docker compose will also
open port 5005 for JVM remote debugging. However, you may
also want to just run the application in your IDE in debug mode.
The application's k3d deployment also provides port
5005 for debugging when you have enabled debug mode in
values/local.yaml. You can make this port available with
the kubectl port-forward command.
In order for the push gateway to be able to communicate to APNS and Firebase you need to setup credentials in your deployed environment. For APNS the Token and Certificate based methods are supported. For Android devices Firebase is supported.
The configuration of the Push Gateway can be done via
PUSH_CONFIG_FILE environment using a configmap with
configuration values (see
compose/backend/push-config.yaml.tpl for an example).
The application consists of an API part and a Worker part. The
API-part provides the openapi specification implementation, receives,
validates and queues valid push notifications into an Artemis MQ. The
Worker-part consumes the notifications from the Artemis MQ and sends
them to APNS/Firebase. The application can be configured to run in
either or both modes at once. It can be controlled via the
APP_MODE environment variable (default:
BOTH).
PRODUCER: runs only the producer component (e.g.,
incoming requests and enqueueing).CONSUMER: runs only the consumer component (dequeueing
and push delivery).BOTH: runs producer and consumer together in one
process (useful for local/dev).For scaling, deploy producer and consumer as separate workloads and
scale them independently based on load. The Helm chart already applies
this split by setting APP_MODE=PRODUCER for the producer
deployment and APP_MODE=CONSUMER for the consumer
deployment, while docker compose defaults to BOTH.