Microservice application with continuous integration
What is this repository?
This is an open source project to create a continuous integration pipeline for building, testing and deploying a microservices application in a continuous integration environment.
- The goal is to have a microservices application with a CI pipeline in a few minutes.
This section describes some design principles and decisions.
- Docker it is used to package the application artifacts and its dependencies.
- This project assumes you are defining your infrastructure as code using docker-compose.
- By now we assume you use jhipster to generate microservices application.
"The jhipster microservice application has to be packaged as docker containers and use docker-compose for CI environment deployment."
- It uses Gitlab as code repository, CI and docker registry.
Notes for the future
- More code repositories will be added in future releases.
- It has to be microservice application technology stack agnostic.
"As far as the technology stack supports using docker to package the application and it is generated using yeoman scaffolding"
###1.Create a directory for your project and enter into it
$ mkdir project_name
$ cd project_name
###2.Create your microservice application with jhipster.
How to create a jhipster application:
jhipster Microservices Architecure details:
_At this stage you should have two applications in your project, each one with its own folder "/project_name/gateway_app_name & /project_name/microservice_appname"
Remembrer to modify gateway_app pom.xml (adding '--allow-root' to bower install)
<execution> <id>bower install</id> <goals> <goal>bower</goal> </goals> <configuration> <arguments>install --no-color --allow-root</arguments> </configuration> </execution>
###3.Download the .gitlab-ci.yml in your /project_name folder.
###4.Create your Gitlab project and activate the ci and the docker repository.
Now you create a project in gitlab.com and go to project settings to activate the shared runners and container registry.
Configure your CI:
"For a quick start you can use shared runners, but please read the security considerations of using shared runners in the link above"
Docker dind it is not supported in shared runners so the deploy step will fail
Find details of how to create and register shared runners with docker in docker i the URL below
Create Specific runners
(This allows you to create your own runners with docker in docker support)
Activate container registry:
###5.Edit the .gitlab-ci.yml to configure your build
_GITLAB_GROUP & GITLABPROJECT are your gitlab username and project name
###6.Push your code to the repository
Go for one of your favorite drinks, it takes around 10 minutes to run your ci pipeline with an small jhipster project.
After 10 minutes...
Login into gitlab.com.
Select your project.
Go to Pipelines menu and see your build details, and your artifacts (application war files)
Go to Container Registry menu and see your containers. (docker containers)
Beyond quick start
Infrestructure as code
Create a folder within the project with the docker-compose name or something similar and enter into it.
$ mkdir docker_compose
$ cd docker_compose
$ yo jhipster:docker-compose
This will create all the needed files to bring the application up and running.
"Find more details about docker-compose with jhipster in http://jhipster.github.io/docker-compose/ "
Now update the images sources of the docker-compose.yml file to point to your gitlab docker repository.
"Note you have to do it for both gateway and microservices application"