Giter VIP home page Giter VIP logo

microservice-baseline's Introduction

microservice-baseline

Build Status Quality Gate Status Coverage Technical Debt

This project serves as a baseline when you wish to begin a new micro service exposing HTTP endpoints.

It is set up with the following dependencies/frameworks:

Health endpoint

The application includes a simple health-endpoint, reachable at /health.

Example response:

{
  "service": "microservice-baseline",
  "timestamp": "2018-10-15T17:28:00.164Z",
  "runningSince": "2018-10-15T17:27:56.516Z",
  "version": "0.1-SNAPSHOT"
}

Endpoint tests

HealthEndpointTest.java showcases how a reusable TestServer is started, and the endpoint tested using REST-assured.

It is achieved by extending AbstractEndpointTest.

Properties

This baseline is set up without Spring, Constretto or similar tools. Instead the properties are read through the class PropertiesHelper in the Main class.

Properties are read from the following locations, in the following order:

  1. application.properties from classpath (resources/application.properties).
  2. config_override/application.properties file.

Dependency Injection to Endpoint Constructors

See JerseyConfig for example on how the property secured.endpoint.message is passed to the SecuredEndpoint constructor, and registered with Jersey.

It is only required to register the endpoint if you have special constructors. E.g. HealthEndpoint is registered through the line: packages("no.capraconsulting");

Logback

The default logback.xml in this repository only appends statements to STDOUT. This is intended, and covers the two main use cases:

If you wish to run the application with logging to file, you should use a properly set up file appender:

<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds">
  <property name="LOG_DIR" value="logs/"/>
  <property name="appName" value="app"/>
  <appender name="logfile" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>${LOG_DIR}/${appName}.log</file>
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
      <fileNamePattern>${LOG_DIR}/${appName}-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
      <maxHistory>7</maxHistory>
      <totalSizeCap>250MB</totalSizeCap>
      <timeBasedFileNamingAndTriggeringPolicy
        class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
        <maxFileSize>50MB</maxFileSize>
      </timeBasedFileNamingAndTriggeringPolicy>
    </rollingPolicy>
    <encoder>
      <pattern>%d{yyyy-MM-dd'T'HH:mm:ss.SSSZ} [%thread] %-5level %logger{35} - %msg%n</pattern>
    </encoder>
  </appender>
  <logger name="org.eclipse.jetty" level="WARN"/>
  <logger name="no.capraconsulting" level="INFO"/>
  <root level="info">
    <appender-ref ref="logfile"/>
  </root>
</configuration>

microservice-baseline's People

Contributors

andeero avatar henrist avatar hmatland avatar oyvindym avatar renovate-bot avatar renovate[bot] avatar sherriff avatar sirius avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

microservice-baseline's Issues

Dependency Dashboard

This issue contains a list of Renovate updates and their statuses.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to ignore the schedule.

  • chore(deps): update jetty.version to v9.4.39.v20210325 (org.eclipse.jetty:jetty-servlet, org.eclipse.jetty:jetty-server)

Pending Status Checks

These updates await pending status checks. To force their creation now, check the box below.

  • chore(deps): update jetty.version to v11 (major) (org.eclipse.jetty:jetty-servlet, org.eclipse.jetty:jetty-server)

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.


  • Check this box to trigger a request for Renovate to run again on this repository

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.