Closed spethso closed 5 years ago
@wagnerdk as you created the Docker images, can you help here what values the environment variables need to have? Further, you should also know which interface the frontend exposes... Please talk directly to @gepperho.
Please specify here in this issue the exact variable name and value to use (based on an example). This would really help others to quickly grasp the necessary information.
Only one variable is necessary. This is:BACKEND_REST_API
. To test only the front end it is possible to use
conduit.productionready.io/api
as a value (The http://
is added by the nginx.conf, comparable to the nginx.conf used in our own front end). This uses the API which is provided by the authors of the real world example. To connect the front end with the backend the environment variable has to be set to the address of the back end. I don't know exactly how this is handled in our kubernetes client. Maybe @davidkopp or @JakobBenz could help here. The front end is than exposed at the container port 80.
The back end does not need environment variables. It exposes its API at the container port 8080.
It is required to set the environment variable as part of the service deployment information. The UI has already implemented this.
The specific API of mico-core
is PUT /applications/{shortName}/{version}/deploymentInformation/{serviceShortName}
e.g. with the body
{
"replicas": 1,
"labels": [],
"environmentVariables": [
{
"name": "BACKEND_REST_API",
"value": "backend-interface-r3f4cpb7.mico-workspace.svc.cluster.local"
}
],
"imagePullPolicy": "IfNotPresent"
}
The value of the environment variable BACKEND_REST_API
follows the pattern
{service-interface-uid}.{namespace}.svc.cluster.local
The service-interface-uid
is generated by mico-core
based on the name of the MicoServiceInterface (here: backend-interface
) during the deployment of the MicoApplication and is used as the name of the Kubernetes service.
Currently it is required to retrieve this name manually (kubectl get svc -n mico-workspace
) and set it as the environment variable like described above. Issue #522 describes how to automatically set the environment variable during the deployment so there won't be any manual step required anymore.
We improved the workflow to setup connections between MICO services (e.g. between a frontend and a backend) with the PR #595.
A user has to provide 3 information to connect the frontend with a backend:
BACKEND_REST_API
)spring-boot-realworld-example-app
)rest
)These information are part of the service deployment information. Example request:
curl -X PUT \
'http://{{host}}/applications/{{shortName}}/{{version}}/deploymentInformation/{{serviceShortName-frontend}}' \
-d '{
"replicas": 1,
"labels": [
{
"key": "component",
"value": "frontend"
}
],
"environmentVariables": [],
"interfaceConnections": [
{
"environmentVariableName": "BACKEND_REST_API",
"micoServiceShortName": "spring-boot-realworld-example-app",
"micoServiceInterfaceName": "rest"
}
],
"imagePullPolicy": "IfNotPresent"
}'
Is documented in the user documentation as part of the tutorials: https://mico-docs.readthedocs.io/en/latest/tutorials/04-manage-an-application.html#editing-deployment-information-of-services
As a frontend developer, I want to know, which information, e.g. environment variables or interface definitions, deployment information, are needed to deploy the extended scenario services.
Document it in the developer documentation.