Configuration Service in terms of the Radar COVID project enables:
- Getting exposition settings to be used by apps.
- Getting internationalized texts.
- Getting list of Autonomous Communities and their information.
- Getting languages available: es-ES, ca-ES, en-US,...
- Getting countries of interest available: DE, AT, DK, IT,...
These are the frameworks and tools used to develop the solution:
- Java 11.
- Maven.
- Spring Boot version 2.3.
- Lombok, to help programmer. Developers have to include the IDE plugin to support Lombok features (ie, for Eclipse based IDE, go here).
- ArchUnit is used to check Java architecture.
- PostgreSQL.
- Testing:
- Spock Framework.
- Docker, because of using Testcontainers.
- Testcontainers.
- Monitoring:
Contentful is also used as content platform to manage literals for the different languages, etc.
To build the project, you need to run this command:
mvn clean package -P <environment>
Where <environment>
has these possible values:
local-env
. To run the application from local (eg, from IDE o from Maven usingmvn spring-boot:run
). It is the default profile, usingapplication.yml
configuration file. If any properties need to be modified, you can create application-local.yml configuration file.docker-env
. To run the application in a Docker container withdocker-compose
, usingapplication.yml
configuration file. If any properties need to be modified, you can create application-docker.yml configuration file.pre-env
. To run the application in the Preproduction environment. Preproduction environment properties are configured in the infrastructure.pro-env
. To run the application in the Production environment. Production environment properties are configured in the infrastructure
The project also uses Maven profile aws-env
to include dependencies when it is running on AWS environment, so the compilation command for Preproduction and Production environments would be:
mvn clean package -P pre-env,aws-env
mvn clean package -P pro-env,aws-env
All profiles will load the default configuration.
Depends on the environment you selected when you built the project, you can run the project:
- From the IDE, if you selected
local-env
environment (or you didn't select any Maven profile). - From Docker. Once you build the project, you will have in
configuration-server-boot/target/docker
the files you would need to run the application from a container (Dockerfile
and the Spring Boot fat-jar).
If you want to run the application inside a Docker container in local, once you built it, you should run:
docker-compose up -d postgres
docker-compose up -d backend
This project doesn't use either Liquibase or Flyway because:
- DB-Admins should only have database privileges to maintain the database model (DDL).
- Applications should only have privileges to maintain the data (DML).
Because of this, there are two scripts:
01-CONFIGURATION-DDL.sql
. Script to create the model.02-CONFIGURATION-DML.sql
. Script with inserts.
Along with the application there comes with OpenAPI Specification, which you can access in your web browser when the Verification Service is running (unless in Production environment, where it is inactive by default):
<base-url>/openapi/api-docs
You can download the YAML version in /openapi/api-docs.yaml
If running in local, you can get:
- OpenAPI: http://localhost:8080/openapi/api-docs
- Swagger UI: http://localhost:8080/openapi/ui
Endpoint | Description | Default values | Sample response |
---|---|---|---|
/masterData/ccaa?locale=<locale>[&additionalInfo=<additionalInfo>&platform=<platform>&version=<platformVersion>] |
Get Autonomous Communities available | locale=es-ES additionalInfo=false |
Response with additionalInfo=true :response-masterData-ccaa-additionalInfo.json |
/masterData/locales?locale=<locale>[&platform=<platform>&version=<platformVersion>] |
Get locales available | locale=es-ES |
response-masterData-locales.json |
/masterData/countries?locale=<locale>[&platform=<platform>&version=<platformVersion>] |
Get countries available | locale=es-ES |
response-masterData-countries.json |
/settings |
Get application settings | response-settings.json |
|
/texts?ccaa=<ccaa>[&locale=<locale>&platform=<platform>&version=<platformVersion>] |
Get texts by locale and Autonomous Community | ccaa=ES locale=es-ES |
Response with default parameters.response-texts.json |
NOTE: The sample responses are using default parameters so returns are in castellano. The real information is not in a JSON file; as we said before, we use Contentful to maintain the languages, texts, etc.
Configuration Service has four modules:
configuration-server-parent
. Parent Maven project to define dependencies and plugins.configuration-server-api
. DTOs exposed.configuration-server-boot
. Main application, global configurations and properties. This module also has integration tests and Java architecture tests with ArchUnit.configuration-server-service
. Business and data layers.
The following channels are available for discussions, feedback, and support requests:
Type | Channel |
---|---|
Issues |
If you want to contribute with this exciting project follow the steps in How to create a Pull Request in GitHub.
More details in CONTRIBUTING.md.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.