The first part of our microservice architecture that will be explained is the webserver. It is the first service the user connects to and one of only two services that are exposed to the user. The webserver consists of an instance of nginx (a high-performance webserver) serving the application’s frontend (static files like HTML, CSS, JS and images).
The webserver lends itself to some introductory explanations about continuous integration pipelines and docker deployments to APPUiO (building on those in the General Concepts section), as the build/deployment pipeline is quite simple and as it doesn’t directly depend on any other service.
We won’t go into the implementation details, but you are welcome to have a look at the sources on GitHub.
Goals for CI¶
What we would like to achieve with our pipeline can be shortly summarized as follows:
- Run all of the application’s tests
- Build a docker container that can be run on APPUiO
- Push the newly built container directly to the APPUiO registry
- Update the application configuration on APPUiO
- Trigger a new deployment in APPUiO
The following sections will describe how this pipeline might be implemented using GitLab CI. Topics that will be covered include (among others):
- Building and running the service as a docker container
- Implementing a simple GitLab CI pipeline with caching and artifacts
- Strategies when using multiple deployment environments (staging, prod etc.)
- Preparing our APPUiO project such that we can deploy the service (routes, deployments etc.)
- Extending our pipeline such that the APPUiO configuration is tracked alongside our source code
- Adding health checks to the deployment of our service