Code Monkey home page Code Monkey logo

metaarivu / ms-quickstart Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 3.0 44.88 MB

Microservice Template gives you a SpringBoot App template with Open API 3 Ex, Actuator, Sleuth, Prometheus, and POM file with Fat and Thin jar file creation and Dockerfile for containerization.

License: Apache License 2.0

Shell 13.71% Dockerfile 1.40% Java 84.89%
spring-boot microservice prometheus-metrics prometheus actuator ddd rest-api open-source open-api-v3

ms-quickstart's Introduction

Microservice Template

Microservice Template gives you a

  1. SpringBoot App template with
  2. Open API 3 Ex,
  3. Spring Actuator,
  4. Spring Sleuth and
  5. POM File with (SpringBoot) Fat and Thin (Maven) jar file creation and
  6. Dockerfile for containerisation.

Service Setup

Step 1 - Setup Org, Service, & Container Name, Versions, API Path in app.props.tmpl

  1. Update the Org Name in src/main/resources/app.props.tmpl file (service.org)
  2. Update the Microservice name in src/main/resources/app.props.tmpl file (service.name)
  3. Update the API Version in src/main/resources/app.props.tmpl file (service.api.version)
  4. Update the API Name in src/main/resources/app.props.tmpl file (service.api.name)
  5. Update the Container Name in src/main/resources/app.props.tmpl file (service.container)
  6. Update the Server Version src/main/resources/app.props.tmpl file (server.version)
  7. Update the SRC_BASE (Your Service Repository Base Directory) in getServiceName shell script

Sample Property File Template Property File

When you change the version in POM.xml, update that info in src/main/resources/app.props.tmpl - service.version property also.

Step 2 - Compile (Once your code is ready)

  1. compile

The above compile script will do the following

  1. Clean up the target folder
  2. Generate the build no. and build date (takes application.properties backup)
  3. build final output SpringBoot fat jar and maven thin jar
  4. copy the jar files (and dependencis) to src/docker folder
  5. copy the application.properties file to current folder and src/docker folder

In Step 2.2 application.properties file will be auto generated by the compile script. This is a critical step. Without generated application.properties file the service will not be running.

Step 3 - Run and Test

  1. run
  2. test

Docker Container Setup

Step 1 - Verify Container Name and Org Name

  1. Verify the Org Name in src/main/resources/app.props.tmpl file (service.org)
  2. Verify the container name in src/main/resources/app.props.tmpl file (service.container)
  3. Verify the microservice name in src/main/resources/app.props.tmpl file (service.api.name)

Step 2 - Build the image

  1. build (Build the Container)
  2. scan (Scan the container vulnerabilities)

Step 3 - Test the image

  1. start (Start the Container)
  2. logs (to view the container logs) - Wait for the Container to Startup
  3. Check the URL in a Browser

Step 4 - Push the image to Container Cloud Repository

Update the Org Name in src/main/resources/app.props.tmpl file (service.org) Setup the Docker Hub or any other Container Registry

  1. push (Push the Container to Docker Hub)

Other Commands

  1. stop (Stop the Container)_
  2. stats (show container stats)

(C) Copyright 2021 - MetArivu Author: Araf Karsh Hamid

ms-quickstart's People

Contributors

arafkarsh avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.