Giter Site home page Giter Site logo

microservices-ci's Introduction

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.

Objective

  • The goal is to have a microservices application with a CI pipeline in a few minutes.

Notes 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"

Quick Start

###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: http://jhipster.github.io/creating-an-app/

jhipster Microservices Architecure details: http://jhipster.github.io/microservices-architecture/

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_app_name"

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.

$ wget https://raw.githubusercontent.com/ogomezm/microservices-ci/master/src/.gitlab-ci.yml

###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: http://docs.gitlab.com/ce/ci/quick_start/README.html

"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) http://docs.gitlab.com/ce/ci/runners/README.html

Activate container registry: http://about.gitlab.com/2016/05/23/gitlab-container-registry/

###5.Edit the .gitlab-ci.yml to configure your build

variables:

JHIPSTER_GATEWAY_APP: "gateway_application_name"

JHIPSTER_MICROSERVICE_APP: "microservice_application_name"

GITLAB_GROUP: "group"

GITLAB_PROJECT: "project"

GITLAB_GROUP & GITLAB_PROJECT 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)

Enjoy!

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

Then execute

$ 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.

services:

application_name:

  image: registry.gitlab.com/GITLAB_USER/PROJECT_NAME:APPLICATION_NAME

"Note you have to do it for both gateway and microservices application"

microservices-ci's People

Contributors

ogomezm avatar

Watchers

James Cloos avatar

Forkers

ksiebel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.