Code Monkey home page Code Monkey logo

edison-microservice's Introduction

edison-microservice

Collection of independent libraries on top of Spring Boot to provide a faster setup of jvm microservices.

"I never did anything by accident, nor did any of my inventions come by accident; they came by work." - Thomas Edison

Status

Next Selected Stories Active Stories

build codecov Known Vulnerabilities release license

Have a look at the release notes for details about updates and changes.

About

This project contains a number of independent libraries on top of Spring Boot to provide a faster setup of jvm microservices. The libraries are used in different projects at OTTO. It's purpose is to provide a common implementation for cross-cutting requirements like:

  • Health checks that are used to tell the load balancer or mesos platform whether or not a service is healthy.
  • A status page/document that is used to give information about the current state of the service. Status information also include details about sub-components, background jobs like imports, and so on.
  • A simple job handling library that is used to run asynchronous background jobs, which for example can be used to run data imports from other systems.
  • An optional MongoDB-based implementation of a JobRepository
  • Support for MongoDB-based repositories in case you do not like Spring Data
  • Support for feature toggles based on Togglz

... plus all the features of Spring Boot.

Future Releases aka Roadmap

Semantic Versioning v2.0.0 is used to specify the version numbers.

This project maintains its roadmap with issues and milestones.

1.0.0: Edison Microservices for Spring Boot 1.4 ✔

1.x.0: Edison Microservices for Spring Boot 1.5 ✔

2.0.0: Edison Microservices for Spring Boot 2.0

Migration from Edison 1.x to Edison 2

Edison 2 has several breaking changes that will make a refactoring of your current application necessary. For a list of the actual changes, please take a look at the Changelog.

When migrating, take care of the following adjustments:

  • Starting with Edison 2.0, the minimal Java version will be Java10. So install and configure your application and CI-Systems to use Java10 for running and building.

  • Follow the Spring Boot 2.0 Migration Guide to fix the most common problems.

    • If you want to use the behaviour of Edison 1.x, which hosts all management endpoints below /internal, you have to configure management.endpoints.web.base-path=/internal in your application.yml
  • Remove dependencies to the edison-aws Project, which will be deprecated some time in the future. Necessary functionality was transferred to a submodule of edison-microservice (named edison-aws).

  • If you have used gradlew bootRepackage for packaging your application so far, you have to migrate this to gradlew bootJar.

  • Refactor calls made through the AWS SDK, which got updated in the process of the new major version of edison and this will most probably break prior code that relied on the AWS SDK.

  • To use @Timed-Annotations, you need to configure Micrometer accordingly. See the following Example for a configuration that covers the annotation and naming of all metrics:

      @Configuration
      @EnableAspectJAutoProxy
      public class MicrometerConfiguration {
      
          @Bean
          public PrometheusNamingConvention prometheusNamingConvention() {
              return new PrometheusNamingConvention();
          }
      
          @Bean
          public MeterRegistryCustomizer<MeterRegistry> metricsCommonTags(@Value("${service.vertical}") final String vertical,
                                                                          @Value("${service.name}") final String serviceName,
                                                                          final PrometheusNamingConvention prometheusNamingConvention) {
              return registry -> registry
                      .config()
                      .namingConvention(new NamingConvention() { 
                          // Set naming convention that gets applied to all metrics, in this  example explicitly using a Prometheus naming convention
                          @Override
                          public String name(final String name, final Meter.Type type, final String baseUnit) {
                              return prometheusNamingConvention.name(String.format("%s.%s.%s", vertical, serviceName, name), type, baseUnit);
                          }
                      })
                      .meterFilter(new MeterFilter() { // Configure generally applicable configurations, like percentiles
                          @Override
                          public DistributionStatisticConfig configure(final Meter.Id id,
                                                                       final DistributionStatisticConfig config) {
                              return config.merge(DistributionStatisticConfig.builder()
                                      .percentiles(0.5, 0.9, 0.95, 0.98, 0.99, 0.999)
                                      .build());
                          }
                      });
          }
      
          // Create a `TimedAspect` to enable `@Timed`-Annotations
          @Bean
          public TimedAspect timedAspect(final MeterRegistry registry) {
              return new TimedAspect(registry);
          }
      }

Documentation

Edison Modules:

  • edison-aws: AWS related configuration and togglz settings
  • edison-core: Main library of Edison microservices.
  • edison-jobs: Optional module providing a simple job library.
  • edison-mongo: Auto-configuration for MongoDB repositories plus implementation of MongoJobRepository and Togglz StateRepository.
  • edison-oauth: Auto-configuration for OAuth Public Key repositories with autofetching and a simple JWT Token Validation.
  • edison-togglz: Optional support for feature toggles for Edison microservices based on Togglz.
  • edison-testsupport: Test support for feature toggles plus utilities.
  • edison-validation: Optional module for validation in Spring with a specific response format.

Examples:

  • example-status: Service only relying on edison-core to show the usage of health and status features.
  • example-jobs: Edison service using edison-jobs to run background tasks.
  • example-togglz: Example using `edison-togglz´ to implement feature toggles.
  • example-togglz-mongo: Same edison-toggz, but with a MongoDB configuration to auto-configure persistence of feature toggles.

Setup

Make sure you have Java 10 or later and gradle 4.x installed on your computer.

Testing

Test and create coverage report

gradle check

Dependency Update

Determine possible dependency updates

gradle dependencyUpdates -Drevision=release

Publishing

Publish new releases

gradle uploadArchives

Examples

There are a few examples that may help you to start your first microservice based on Edison and Spring Boot. Because Spring Boot itself has some complexity, it is recommended to first read it's documentation before starting with Edison.

The examples can be started with gradle:

gradle examples:example-status:bootRun
gradle examples:example-jobs:bootRun
gradle examples:example-togglz:bootRun
gradle examples:example-togglz-mongo:bootRun

Open in your browser http://localhost:8080/

Note: Every example is configured to use port 8080, so make sure to run only one example at a time or to reconfigure the ports.

Contributing

Have a look at our contribution guidelines.

edison-microservice's People

Contributors

1ulhc8o2vwm8pwgwtjkpirw9zlbkt-c5 avatar benestem avatar christianfinckler1212 avatar danielrolfes2307 avatar ewoelfel avatar fabianhoffmann2363 avatar felixb avatar flosell avatar frankbregulla1111 avatar ftorkler avatar gsteinacker avatar hstruebe avatar janschawo1111 avatar mananbharara avatar marionoecker0301 avatar martinscheidweiler2708 avatar mazzeb avatar mediamarco avatar michaelkoelbl1011 avatar micharegel1111 avatar nikos avatar omarkacimi3254 avatar peterfouquet0001 avatar ralfwarfelmann0815 avatar redvox avatar simonmonecke avatar simonmonecke1708 avatar stefan42 avatar stefanschmidt1701 avatar tomvollerthun1337 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.