/cwa-server

Backend implementation for the Apple/Google exposure notification API.

Primary LanguageJavaApache License 2.0Apache-2.0

Corona-Warn-App Server

DevelopmentService APIsDocumentationSupportContributeContributorsRepositoriesLicensing

The goal of this project is to develop the official Corona-Warn-App for Germany based on the exposure notification API from Apple and Google. The apps (for both iOS and Android) use Bluetooth technology to exchange anonymous encrypted data with other mobile phones (on which the app is also installed) in the vicinity of an app user's phone. The data is stored locally on each user's device, preventing authorities or other parties from accessing or controlling the data. This repository contains the implementation of the server for encryption keys for the Corona-Warn-App. This implementation is still a work in progress, and the code it contains is currently alpha-quality code.

In this documentation, Corona-Warn-App services are also referred to as CWA services.

Architecture Overview

You can find the architecture overview here, which will give you a good starting point in how the backend services interact with other services, and what purpose they serve.

Development

After you've checked out this repository, you can run the application in one of the following ways:

  • As a Docker-based deployment on your local machine. You can run either:
    • Single components using the respective Dockerfile or
    • The full backend using the Docker Compose (which is considered the most convenient way)
  • As a Maven-based build on your local machine. If you want to develop something in a single component, this approach is preferable.

Docker-Based Deployment

If you want to use Docker-based deployment, you need to install Docker on your local machine. For more information about downloading and installing Docker, see the official Docker documentation.

Running the Full CWA Backend Using Docker Compose

For your convenience, a full setup including the generation of test data has been prepared using Docker Compose. To build the backend services, run docker-compose build in the repository's root directory. A default configuration file can be found under .envin the root folder of the repository. The default values for the local Postgres and Zenko Cloudserver should be changed in this file before docker-compose is run.

Once the services are built, you can start the whole backend using docker-compose up. The distribution service runs once and then finishes. If you want to trigger additional distribution runs, run docker-compose run distribution.

The docker-compose contains the following services:

Service Description Endpoint and Default Credentials
submission The Corona-Warn-App submission service http://localhost:8000
distribution The Corona-Warn-App distribution service NO ENDPOINT
postgres A postgres database installation postgres:8001
Username: postgres
Password: postgres
pgadmin A pgadmin installation for the postgres database http://localhost:8002
Username: user@domain.com
Password: password
cloudserver Zenko CloudServer is a S3-compliant object store http://localhost:8003/
Access key: accessKey1
Secret key: verySecretKey1
Known Limitation

The docker-compose runs into a timing issue in some cases when the create-bucket target runs before the objectstore is available. The mitigation is easy: after running docker-compose up wait until all components are initialized and running. Afterwards, trigger the create-bucket service manually by running docker-compose run create-bucket. If you want to trigger distribution runs, run docker-compose run distribution. The timing issue will be fixed in a future release.

Running Single CWA Services Using Docker

If you would like to build and run a single CWA service, it's considered easiest to run them in a Docker environment. You can do this using the script provided in the respective CWA service directory. The Docker script first builds the CWA service and then creates an image for the runtime, which means that there are no additional dependencies for you to install.

To build and run the distribution service, run the following command:

./services/distribution/build_and_run.sh

To build and run the submission service, run the following command:

./services/submission/build_and_run.sh

The submission service is available on localhost:8080.

Maven-Based Build

If you want to actively develop in one of the CWA services, the Maven-based runtime is most suitable. To prepare your machine to run the CWA project locally, we recommend that you first ensure that you've installed the following:

Configure

After you made sure that the specified dependencies are running, configure them in the respective configuration files.

  • Configure the Postgres connection in the submission config and in the distribution config
  • Configure the S3 compatible object storage in the distribution config
  • Configure the certificate and private key for the distribution service, the paths need to be prefixed with file:
    • VAULT_FILESIGNING_SECRET should be the path to the private key, example available in <repo-root>/docker-compose-test-secrets/private.pem
    • VAULT_FILESIGNING_CERT should be the path to the certificate, example available in <repo-root>/docker-compose-test-secrets/certificate.cert

Build

After you've checked out the repository, to build the project, run mvn install in your base directory.

Run

Navigate to the service you want to start and run the spring-boot:run target. The configured Postgres and the configured S3 compliant object storage are used as default. When you start the submission service, the endpoint is available on your local port 8080.

If you want to start the submission service, for example, you start it as follows:

  cd services/submission/
  mvn spring-boot:run

Debugging

To enable the DEBUG log level, you can run the application using the Spring dev profile.

mvn spring-boot:run -Dspring-boot.run.profiles=dev

To be able to set breakpoints (e.g. in IntelliJ), it may be necessary to use the -Dspring-boot.run.fork=false parameter.

Service APIs

The API that is being exposed by the backend services is documented in an OpenAPI specification. The specification files are available at the following locations:

Service OpenAPI Specification
Submission Service https://github.com/corona-warn-app/cwa-server/raw/master/services/submission/api_v1.json
Distribution Service https://github.com/corona-warn-app/cwa-server/raw/master/services/distribution/api_v1.json

Documentation

The full documentation for the Corona-Warn-App can be found in the cwa-documentation repository. The documentation repository contains technical documents, architecture information, and whitepapers related to this implementation.

Support and Feedback

The following channels are available for discussions, feedback, and support requests:

Type Channel
General Discussion
Concept Feedback
Backend Issue
Other Requests

How to Contribute

Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our Contribution Guidelines. By participating in this project, you agree to abide by its Code of Conduct at all times.

Contributors

The German government has asked SAP and Deutsche Telekom to develop the Corona-Warn-App for Germany as open source software. Deutsche Telekom is providing the network and mobile technology and will operate and run the backend for the app in a safe, scalable and stable manner. SAP is responsible for the app development, its framework and the underlying platform. Therefore, development teams of SAP and Deutsche Telekom are contributing to this project. At the same time our commitment to open source means that we are enabling -in fact encouraging- all interested parties to contribute and become part of its developer community.

Repositories

The following public repositories are currently available for the Corona-Warn-App:

Repository Description
cwa-documentation Project overview, general documentation, and white papers
cwa-server Backend implementation for the Apple/Google exposure notification API

Licensing

Copyright (c) 2020 SAP SE or an SAP affiliate company.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the LICENSE for the specific language governing permissions and limitations under the License.