Microservices Lifecycle Support


Intro

The platform provides the integration with the systems in charge of CI/CD circle.

For this purpose, the platform provides a tool to create and administrate the lifecycle of web applications and microservices from the web console of the control panel, following the standards of the CI/CD circle: creation, compilation, tests execution, generation of Docker images and deployment in CaaS.


The features that provides this lifecycle from the platform are:

  1. Microservice creation.
  2. Download code and development.
  3. Compilation of the code and Docker image generation from Jenkins.

  4. Deployment of the docker images in CaaS platform.

  5. Updating a Microservice.

Microservice creation

Creating a a microservice in the platform, a developer registers a new deployable artifact. Automatically the platform generates all the infrastructure to support the full lifecycle:

  • Project in GIT repository based in Maven and Spring Boot, with a predefined skeleton according to the purpose of the artifact, and including the APIs of the platform to make easier for developers the interaction with the different modules of the platform.
  • Jenkins Pipeline in charge of downloading the code from a stable branch of the GIT repository, and launching tasks of compilation, unitary and integration tests execution, quality assurance, docker images generation and publishing of images in Docker registry.
  • Deployment and execution en CaaS platform of the microservice in charge of downloading the image from a Docker registry and deploy it containerized in an enviroment where it is exposed as service and can consume services from the platform and other microservices.


Creating a new microservice, the developer with provide information of the microservice itself, as its identification, type of microservice (template), ontologies that it will use and configuration of the service (port and context path).

Each template of microservice type, provides an archetype to generate a skeleton of code to start the development.

Depending on the template, the base skeleton of code will change and dependencies of the project will be added or not, including those which are APIs of the platform. For example:

    • APIs to connect with the broker of the platform.
    • APIs to register the artifact on the platform as a Digital Twin.
    • APIs to authenticate with de Single-Sign-On of the paltform.




During the creation of the microservice it is also provide the configuration of the GIT, Jenkins and containers CaaS platform which will support the CI/CD lifecycle of the microservice. The developer can choose between the default configuration (provided by an administrator of the platform) or a manual configuration to provide a specific instance of any of theese systems.


It is also possible to create a microservice from an existing project. In this case, the developer will provide the configuration of the GIT repository where the project is allocated and the step of creating a new project in a repository will be skipped.


Download code and development

Once the microservice is generated, it is available to be downloaded from the GIT repository. For this purpose, the url to the project in Gitlab is available from the Control Panel:





Using the tools of the developers' IDE, a developer can clone the repository of the project, downloading the code generated by the platform for the microservice:

Once downloaded it can be imported in Eclipse to start de development. As it is shown, the skeleton provides a set of packages and snippets of code to facilitate the development:

Once a new feature is developed the code will be uploaded to GIT repository:

Compilation of the code and Docker image generation from Jenkins

Once created the microservice, the source code uploaded to the GIT repository can be compiled to generate a Docker image. This task is performed by a Jenkins pipeline generated during the creation of the microservice.
This pipeline is also in charge of executing unitary and integration tests and quality assurance rules.
From the control panel of the platform we can execute the pipeline selecting the source branch in GIT repository and generate docker images with a specific tag, registering them in a docker registry.

Deployment of the docker images in CaaS platform

A docker image generated in the previous step can be deployed in the CaaS platform from the control panel. In this case the developer must select the environment in the CaaS platform, the host where the CaaS will create the container, and the DNS where the services will be exposed.




Once deployed, the Microservice will be available in the DNS address.

Updating a Microservice

A deployed microservice can be redeployed to change any property o to deploy a new Docker image.