Coder Social home page Coder Social logo

romanow / micro-services-v2 Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 4.0 827 KB

Example for demonstrate microservices communication and observability

Kotlin 93.76% Shell 1.16% Dockerfile 1.68% JavaScript 2.18% HCL 1.23%
spring-boot spring-cloud kubernetes grafana elk-stack

micro-services-v2's Introduction

Microservices

Build project pre-commit

Состав

Взаимодействие сервисов

graph TD
  A[Store Service]--> B[Order Service]
  A[Store Service] --> C[Warehouse Service]
  A[Store Service] --> D[Warranty Service]
  B[OrderService] --> D[Warranty Service]
  B[OrderService] --> C[Warehouse Service]
  C[Warehouse Service] --> D[Warranty Service]

Сборка и запуск

Запуск в Docker Compose

# build services
$ ./gradlew clean build

# build docker images
$ docker compose build

# run images
$ docker compose up -d

Настройка Auth0

  1. Регистрируемся на Auth0.
  2. Создаем приложение: Applications -> Create Application: Native, заходим в созданное приложение и копируем Client ID и Client Secret.
  3. Переходим в Advanced Settings -> Grant Types: только Password (Resource Owner Password Flow).
  4. Переходим в API -> Create API:
    • Name: Cinema Aggregator Service;
    • Identifier: http://store.romanow-alex.ru;
    • Signing Algorithm: RS256.
  5. Настраиваем хранилище паролей: Settings -> Tenant Settings -> API Authorization Settings:
    • Default Audience: http://store.romanow-alex.ru;
    • Default Directory: Username-Password-Authentication.
  6. Создаем тестового пользователя: User Management -> Users -> Create User:
    • Email: [email protected];
    • Password: Qwerty123;
    • Connection: Username-Password-Authentication.

После настройки у вас должен успешно выполняться запрос на проверку получение токена (подставить свои настройки):

curl --location --request POST 'https://romanowalex.eu.auth0.com/oauth/token' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'grant_type=password' \
  --data-urlencode '[email protected]' \
  --data-urlencode 'password=Qwerty123' \
  --data-urlencode 'scope=openid' \
  --data-urlencode 'client_id=<Client ID>' \
  --data-urlencode 'client_secret=<Client Secret>'

В ответ получаем токен:

{
  "access_token": "...",
  "id_token": "...",
  "scope": "openid profile email ...",
  "expires_in": 86400,
  "token_type": "Bearer"
}

Нагрузочное тестирование

$ brew install k6

$ k6 run \
    --out influxdb=http://localhost:8086/k6 \
    -e [email protected] \
    -e PASSWORD=Qwerty123 \
    -e CLIENT_ID=pXrawhpoDM63b82A7fkiLvRIH81wgmH9 \
    -e CLIENT_SECRET=LzQSxUOE2dmAUdgstWke4ngXUeZNLVczvSid7ZVV8HTegCRbOxchQtJ_23EuZ9_V \
    k6.js

Ссылки

  1. 10 антипаттернов деплоя в Kubernetes: распространенные практики, для которых есть другие решения
  2. How do you rollback deployments in Kubernetes?

micro-services-v2's People

Contributors

romanow avatar

Stargazers

 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.