Oracle Backend for Microservices and AI includes Spring Cloud Config which provides server- and client-side support for externalized configurations in a distributed system. The Spring Cloud Config server provides a central place to manage external properties for applications across all environments.
The Spring Cloud Config server is pre-configured to work with the Spring Boot Eureka service registry, configured to store the Configuration in the Oracle Autonomous Database to support labeled versions of configuration environments as well as being accessible to a wide range of tools for managing the content. More details can be found here: (Spring Cloud Config Documentation).
When building applications using Spring Config Server, the Spring Cloud Config client’s application.yaml configuration file must include access information to the deployed Spring Config Server:
spring:application:name:<application name>config:import:optional:configserver:${config.server.url} cloud:config:label:<optional>profile:<optional>username:<A user with the role ROLE_USER>password:<password>
You also need to add the following dependency to your Spring Boot application pom.xml:
The configuration is stored in the CONFIGSERVER schema in the PROPERTIES table. Managing the data for the Spring Cloud Config server should be done using the CLI or the REST API endpoints. If you prefer, you can also work directly with the CONFIGSERVER.PROPERTIES table in the database. How to access the database is documented here, (Accessing the database).
During setup of Oracle Backend for Microservices and AI, the following data is loaded into CONFIGSERVER.PROPERTIES. This data can be deleted.
| APPLICATION | PROFILE | LABEL | PROP_KEY | VALUE
|-----------------|----------------|----------|---------------------|-----------------------------------|
| atael | dev | latest | test-property | This is the test-property value |
| atael | dev | latest | test-property-2 | This is the test-property-2 value |
| application-a | production | 12c | db-name | databasename-a-prod |
| application-a | production | 12c | db-connection | connectionstring-a-prod |
| application-a | development | 23cbeta | db-dev-name | databasename-a-dev |
| application-a | development | 23cbeta | db-dev-connection | connectionstring-a-dev |
| application-b | production | 19c | db-name | databasename-b-prod |
| application-b | production | 19c | db-connection | connectionstring-b-prod |
| application-b | development | 23cbeta | db-dev-name | databasename-b-dev |
| application-b | development | 23cbeta | db-dev-connection | connectionstring-b-dev |
| application-c | secret | 23.4 | json-db | 23c-json-db |
| application-c | secret | 23.4 | json-sdb-conn | 23c-mongo-conn |
| application-c | secret | 23.4 | txeventq | 23c-conn-string |
| application-c | secret | 23.4 | txeventq | 23c-kafka-name |
Managing Config Server Data
Maintaining the Config Servers information can be done using the following methods:
Oracle Backend for Microservices CLI, oractl.
REST API endpoints exposed via obaas-admin and config-server services.
Config Server REST API endpoints overview
The following REST API endpoints are available to the Config Server entries. The table lists which minimum required role is needed to perform the operation. ‘N/A’ in the following table indicates that the endpoint does not require authentication to be accessed.
End point
Method
Description
Minimum Required Role
/srv/config/all
GET
Get all distinct properties for a service (application)
N/A
/srv/config/properties
GET
Get all distinct properties with filters (see examples)
N/A
/srv/config/properties/add
POST
Create properties from a file
ROLE_USER
/srv/config/property/add
POST
Create a property
ROLE_USER
/srv/config/property/update
PUT
Update a property
ROLE_USER
/srv/config/properties/delete
DELETE
Delete properties with filters (see examples)
ROLE_ADMIN
Config Server REST API endpoints examples
In all of the following examples, replace <username>:<password> with your username and password when necessary. (Getting User information). The examples are using curl to interact with the REST API endpoints. This also requires an open tunnel on port 8080 to either the config-server or obaas-admin service. Use the following command to start a tunnel to the config-server service:
The Config Server data can be created using the following SQL statements:
INSERTINTOCONFIGSERVER.PROPERTIES(APPLICATION,PROFILE,LABEL,PROP_KEY,VALUE)VALUES('atael','dev','latest','test-property','This is the test-property value');INSERTINTOCONFIGSERVER.PROPERTIES(APPLICATION,PROFILE,LABEL,PROP_KEY,VALUE)VALUES('atael','dev','latest','test-property-2','This is the test-property-2 value');INSERTINTOCONFIGSERVER.PROPERTIES(APPLICATION,PROFILE,LABEL,PROP_KEY,VALUE)VALUES('application-a','production','12c','db-name','databasename-a-prod');INSERTINTOCONFIGSERVER.PROPERTIES(APPLICATION,PROFILE,LABEL,PROP_KEY,VALUE)VALUES('application-a','production','12c','db-connection','connectionstring-a-prod');INSERTINTOCONFIGSERVER.PROPERTIES(APPLICATION,PROFILE,LABEL,PROP_KEY,VALUE)VALUES('application-a','development','23cbeta','db-dev-name','databasename-a-dev');INSERTINTOCONFIGSERVER.PROPERTIES(APPLICATION,PROFILE,LABEL,PROP_KEY,VALUE)VALUES('application-a','development','23cbeta','db-dev-connection','connectionstring-a-dev');INSERTINTOCONFIGSERVER.PROPERTIES(APPLICATION,PROFILE,LABEL,PROP_KEY,VALUE)VALUES('application-b','production','19c','db-name','databasename-b-prod');INSERTINTOCONFIGSERVER.PROPERTIES(APPLICATION,PROFILE,LABEL,PROP_KEY,VALUE)VALUES('application-b','production','19c','db-connection','connectionstring-b-prod');INSERTINTOCONFIGSERVER.PROPERTIES(APPLICATION,PROFILE,LABEL,PROP_KEY,VALUE)VALUES('application-b','development','23cbeta','db-dev-name','databasename-b-dev');INSERTINTOCONFIGSERVER.PROPERTIES(APPLICATION,PROFILE,LABEL,PROP_KEY,VALUE)VALUES('application-b','development','23cbeta','db-dev-connection','connectionstring-b-dev');INSERTINTOCONFIGSERVER.PROPERTIES(APPLICATION,PROFILE,LABEL,PROP_KEY,VALUE)VALUES('application-c','secret','23.4','json-db','23c-json-db');INSERTINTOCONFIGSERVER.PROPERTIES(APPLICATION,PROFILE,LABEL,PROP_KEY,VALUE)VALUES('application-c','secret','23.4','json-sdb-conn','23c-mongo-conn');INSERTINTOCONFIGSERVER.PROPERTIES(APPLICATION,PROFILE,LABEL,PROP_KEY,VALUE)VALUES('application-c','secret','23.4','txeventq','23c-conn-string');INSERTINTOCONFIGSERVER.PROPERTIES(APPLICATION,PROFILE,LABEL,PROP_KEY,VALUE)VALUES('application-c','secret','23.4','txeventq','23c-kafka-name');