Microservice is a configuration service built on top of spring-cloud-config-server. JDBC Backend (database — PostgreSQL) is used to store service configurations. To work with creating/updating/deleting/getting configuration properties — REST interaction is provided:
METHOD | PATH | DESCRIPTION | BODY | PARAM | RESPONSE |
---|---|---|---|---|---|
POST | /api/configurations/page | Getting a page with configuration properties | SearchSettings | - | TableResult<PropertyReturnDto> |
POST | /api/configurations | Creation of a new configuration property. If there is one already, there is a duplicate error | PropertyDto | refresh | PropertyReturnDto |
POST | /api/configurations/batch | Creation of a large number of new configurations. If there are already such ones - a duplicate error | List<PropertyDto> | refresh | List<PropertyReturnDto> |
GET | /api/configurations/{propertyId} | Search for a configuration property by its UUID identifier | - | - | PropertyReturnDto |
PUT | /api/configurations | Updating an existing configuration property. If there is no such thing, a new one is created | PropertyDto | refresh | PropertyReturnDto |
PUT | /api/configurations/batch | Updating a large number of pre-existing configuration properties. If there is no such thing, a new one is created | List<PropertyDto> | refresh | List<PropertyReturnDto> |
DELETE | /api/configurations/batch | Removing a large number of configuration properties | SearchSettingsSimple | refresh | List<PropertyReturnDto> |
DELETE | /api/configurations/{propertyId} | Deleting a configuration property by its UUID identifier | - | refresh | PropertyReturnDto |
POST | /api/configurations/refresh/{destination} | Sending a message to the target service to update its configuration properties | - | - | - |
POST | /api/configurations/refresh | Sending a message to services to update their configuration properties | List<String> | - | - |
- JDK: 18 and higher;
- Docker: postgres + kafka;
All commands are executed in the console. For all actions, you can use the IDE, but who knows about it — and will do it, the instruction is not needed.
Clone Repository
- Create a folder:
mkdir GitProjects
(the folder name can be anything, but you will need to continue to use only it); - Go to the folder:
cd GitProjects
; - Cloning a repository:
git clone https://github.com/HogwartsSchoolOfMagic/ConfigurationService.git
; - Go to the folder:
cd ConfigurationService
; - Complete.
Build project
Inside the folder: ConfigurationService
, you need to run the command: mvn clean install
.
Database Setup
After cloning the repository — we should already be in the project folder.
- For docker to work, you need to install it first;
- To configure the database required for the application to work, go to the folder:
cd docker\postgres
; - Run the .bat file with the command:
postgres.bat
. Default port: 5024.
Application launch
After building the application, execute the command: mvn spring-boot:run
. Default port: 8888.
- Translation of configuration properties;
- Setting up, connecting and working with the Postgres database;
- Using LiquiBase to create a database structure.
- Spring Boot: WEB, Data, Admin client;
- Spring Cloud: Server, Eureka client;
- Postgres;
- LiquiBase;
- Lombok;
- Mapstruct;
- Docker.
Copyright ©2022, Vladislav [SmithyVL] Kuznetsov