Coder Social home page Coder Social logo

phillip-kruger / microprofile-demo Goto Github PK

View Code? Open in Web Editor NEW
23.0 3.0 11.0 13.29 MB

Demo app for MicroProfile

License: Apache License 2.0

Java 29.32% Shell 0.29% HTML 13.54% CSS 25.20% JavaScript 6.76% Dockerfile 0.56% SCSS 24.34%
microprofile openliberty payara-micro thorntail

microprofile-demo's Introduction

Microprofile demo


Build Status Maven Central License

logo

Presentations

If anyone is looking for a talk to give at your local meetups or conferences you are welcome to use all or parts of this demo and presentation. You can make it your own or use it as is. You are also welcome to improve the talk and demo and contribute back. (reference)

Known presentations

Implementations

The demo runs on

thorntail

payara

openliberty

Dependencies

This demo use microprofile-extentions extensively.

High level use case

highlevel

Getting started.

Source code

Get the demo code on your PC:

git clone https://github.com/phillip-kruger/microprofile-demo.git
cd microprofile-demo
mvn clean install

Running

Docker compose

You can use docker and docker compose to run the whole project in a single command:

mvn clean install
docker-compose up --build

This will start each service in it's own container, and also start Prometheus, Grafana and Nginx in a container. You can go to http://localhost to get the menu.

Manually

Alternatively you can start the services manually:

Microservices

Build and start Membership service

cd membership/
mvn clean install -Prun

Build and start Profiling service

cd profiling/
mvn clean install -Prun

Build and start User service

cd user/
mvn clean install -Prun
Prometheus and Grafana (Optional)

To see the metrics in action (i.e. more than just the raw output) you will need a Prometheus and Grafana server.

So something like this:

packer -S prometheus
sudo pacman -Ss grafana
sudo systemctl start prometheus.service
sudo systemctl start grafana.service

Also make sure prometheus is configured in

/etc/prometheus/prometheus.yml

(look at prometheus.yml as an example. You can also use the grafana.json for the grafana dashboards)

Static Web Demo page

There is a static HTML Demo page, you can go to any of

You can generate a token in the User Service to be used in the other services.

You can find some test users in the OpenLiberty configuration - server.xml

Testing some requests

Example POST to create an event

{
    "userId": 1,
    "eventName": "Squash",
    "location": "Centurion",
    "partnerName": "Fitbit",
    "timeOccured": "2018-07-06T09:15:58+02",
    "timeReceived": "2018-07-06T09:15:58+02",
    "durationInMinutes": 34,
    "metaData": {
      "calories": "312"
    }
}

Sample

sample

Advance

To make the example easier we use an internal H2 Database and internal Elasticsearch server, so no need to install any datastore.

You can, however, use MySQL if you prefer:

MySQL / Maria (Optional)

You need a MySQL/Maria Database installed and running on your PC.

So something like this:

sudo pacman -S mariadb
sudo systemctl start mariadb.service

You need to create a Database and Database User in Maria:

mysql -u root -p < membership/init.sql

You also need to change the datasource definition in web.xml and change the driver in pom.xml

microprofile-demo's People

Contributors

dependabot[bot] avatar phillip-kruger avatar xstefank avatar

Stargazers

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

Watchers

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