Advanced API Console Configuration
In the sub-section api-console-config
there's an empty file called core-service.json
, that can override the information of core microservices.
Change the name of core services
If you want to change the name of a service you need to add an entry with a structure similar to the one shown below
{
"microservice-gateway-1": {
"type": "core",
"name": "microservice-gateway-1",
"key": "microservice-gateway"
}
}
where:
type: is the type of the services
name: is the name you wanna give to your service
key: is the real name of the service
Once the new name has been applied, remember to delete the old service's files from the configuration/
folder: service, deployment and any config map.
Add custom CA certs to core services
In an enterprise environment, to encrypt SSL connections, there could be a set of custom certificates signed by one or more trusted certificates. By following this guide you'll be able to provide one or more trusted certificates in PEM format in a single file for the core services managed by the Console.
If you want to add a custom CA certificate to a custom service you should visit this page.
To configure a custom CA certificate for cms-backend
core service, for example, you might:
- Verify if the service you want to provide an additional certificate with supports this feature by visiting its dedicated documentation page.
- Have the CA certificate in
pem
format, and rename the file inadditional-ca.pem
. - Create a Kubernetes Secret in the namespace (replace
YOUR_NAMESPACE
with your namespace name) of the project that needs it using the command:
kubectl -n YOUR_NAMESPACE create secret generic additional-ca-certificates --from-file=additional-ca.pem
This command will create a secret like the following:
apiVersion: v1
kind: Secret
metadata:
name: additional-ca-certificates
data:
additional-ca.pem: "base64-content"
The additional-ca.pem
content is created in base64.
- In the Console, access to the project and enter in the design section, select the working branch and click the advanced tab.
Select the api-console-config/core-services.json
file from the left menu.
Here, you should add:
{
"cms-backend": {
"key": "cms-backend",
"additionalCACerts": {
"secretName": "additional-ca-certificates",
"mountFilePath": "/home/node/app/tls/additional-ca.pem"
}
}
}
Once saved and generate the file adding this configuration, you should see the volume correctly mounted in the generated deployment file.
This feature is enabled only for cms-backend
and v1-adapter
core services. Other core services will be enabled in the future.
This feature is enabled for all environments. If it is not required to add custom ca certs, for example for a test environment, you must add a secret with an empty additional-ca.pem
file content.
Change the Number of Replicas
To change the number of replicas of a service you need to edit the file in the advanced Section: core-services.json.
and add the key replicas and value the number of replica.
For example, to configure the microservice-gateway
with 5 replicas, the configuration to be provided is as follows:
{
"microservice-gateway": {
"type": "core",
"name": "microservice-gateway",
"key": "microservice-gateway",
"replicas": 5
}
}
Add custom environment variables
If you need to add some new environment variables, all you need to do is edit the file in the advanced section: core-services.json
that you can find in Advanced → api-console-config.
Inside the file, you need to add the envs field inside the service you want to modify. The envs field is a JSON and must contain the <key: value> pairs with the environment variables you want to add.
In the example below, we are adding three new environment variables to the v1-adapter
microservice:
{
"v1-adapter": {
"name": "v1-adapter",
"key": "v1-adapter",
"type": "core",
"description": "Mia-Platform v1-adapter",
"envs": {
"LOGIN_REDIRECT_URL_AFTER_LOGOUT": "/web-login",
"USERS_ENDPOINT_BASE_URL": "/users",
"USERS_LOGOUT_URL": "http://auth0-client/logout"
}
}
}