Skip to content

oktadev/okta-kafka-microservices-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microservices Architecture with JHipster and Kafka

This repository contains a microservices architecture with Kafka support and includes docker-compose configuration for running the services locally. Please read Communicate Between Microservices with Apache Kafka to see how this example was created.

Prerequisites:

Getting Started

To install this example, run the following commands:

git clone https://github.com/indiepopart/jhipster-kafka-cloud-stream.git
cd jhipster-kafka

Create an Application in Okta

Before you begin, you’ll need a free Okta developer account. Install the Okta CLI and run okta register to sign up for a new account. If you already have an account, run okta login. Then, run okta apps create jhipster. Select the default app name, or change it as you see fit. Provide the following redirect URIs:

  • login: http://localhost:8081/login/oauth2/code/oidc and http://localhost:8761/login/oauth2/code/oidc
  • logout: http://localhost:8081 and http://localhost:8761

You will see output like the following when it’s finished:

Okta application configuration has been written to: /path/to/app/.okta.env

Run cat .okta.env (or type .okta.env on Windows) to see the issuer and credentials for your app. It will look like this (except the placeholder values will be populated):

export SPRING_SECURITY_OAUTH2_CLIENT_PROVIDER_OIDC_ISSUER_URI="https://{yourOktaDomain}/oauth2/default"
export SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_OIDC_CLIENT_ID="{clientId}"
export SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_OIDC_CLIENT_SECRET="{clientSecret}"

Run with Docker Compose

Create an docker-compose/.env file with the following content:

OIDC_CLIENT_ID={yourClientId}
OIDC_CLIENT_SECRET={yourClientSecret}
RESOURCE_ISSUER_URI={yourOrgUrl}/oauth2/default
MAIL_USERNAME{yourGmailUsername}
MAIL_PASSWORD={yourGmailAppPassword}
DISTRIBUTION_LIST={anotherEmailAccount}

Note: As the alerts email service is Gmail, a Gmail App Password is required for the SMTP authentication.

Build the services docker images for blog, store and gateway with the following command:

./mvnw -ntp -Pprod verify jib:dockerBuild

Once all the services are built, run docker-compose:

docker compose up

Login to the JHipster Registry at http://localhost:8761 with Okta user credentials and check the service's health.

Once everything is up, go to the gateway at http://localhost:8081 and log in. Create store entity and then update it. The alert microservice should log entries when processing the received message from the store service.

Links

Help

Please post any questions as comments on the blog post, or on the Okta Developer Forums.

License

Apache 2.0, see LICENSE.