Configuring Docker¶
The Suite 3.0 uses Docker to run the services. There is already a development deployment configuration that allows developers to run all the services locally as in a k3s cluster. We need to add our components: the microservice, the application service and the Backend for Frontend to that deployment configuration so we, and all teams working on the Suite, can run them.
The configuration for Docker will also be use to run our microservice in development and staging environments.
Before continuing, ensure you have read and followed the development deployment. You need to have the cluster up and running in order to deploy our new service.
Container Images¶
The container images for our applications will be auto generated using the Suite CLI. An Application Manifest was auto generated when the template was executed. This manifest includes all the information required to build a container image for our application, and a separate one was also included in our bff.
Adding our services to the Kubernetes deployment¶
In order to run our services in the local development environment, we need to generate the Kubernetes manifests to do so.
Now, we need to run the following commands inside an activated deployment container.
We can use the suite-gen-app
script to generate the manifests for our
application.
Bash | |
---|---|
You should review the new manifests created inside
deployment/k8s/applications/equipments
, deployment/k8s/applications/ema-app
and deployment/k8s/applications/ema-bff
. Next, as the
development deployment instructs, review
and change the Ingress host name to ema-bff
inside the
`deployment/k8s/applications/ema-bff/ingress.yaml
file.
Adding the services to the localdev deployment¶
Once you have reviewed the manifests, we need add them to the localdev
deployment, in order to get started quickly we'll add them to the hub. These
manifests need to be linked into the applications
kustomization
file that
will get deployed when we run the suite-installer
. If you have just deployed a
cluster following the
development deployment guide you should
modify the deployment/k8s/environments/localdev/hub/teams/landings
since you
ran it with --apps=./k8s/environments/localdev/hub/teams/landings
Edit the kustomization file to add the service, app and bff to the resources
field.
Running the services in kubernetes¶
You can use the Suite Installer or suite-apply
to deploy your service. Feel
free to just run the installer again and let it take care, or run suite-apply
against your kustomization file which should be faster.
Once they are deployed,we can check the status using kubectl get pod
and
looking for our services. They should be healthy and ready and we should be able
to access them using the Ingress we declared, so we should be able to access
https://ema-bff.localdev.suite.itsynch.com/graphql/ and see the GraphQL
playground of the BFF running on Docker.
You will notice that the container images failed to be pulled from the localdev registry. That is because we have not built the images yet.
The easiest way to build the images, and replace the proper tag in the
deployment is to use the suite-replace
command:
Bash | |
---|---|
This command will build the images, push them to a the localdev container registry, which is running on your machine by the suite-installer, and will add "Kustomize Image Replacements" to the kustomization file so that the images for our services are pulled from the localdev registry.
Our service's images will be available on the ITsynch registry after the PR with our changes is merged into main. Until that happens, we need to use the localdev registry.