• Stars
    star
    126
  • Rank 284,543 (Top 6 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

JHipster Microservices Example using Spring Cloud, Spring Boot, Angular, Docker, and Kubernetes

JHipster Microservices Example

A microservice architecture created with JHipster. Uses Spring Cloud, Spring Boot, Angular, and MongoDB for a simple blog/store applications.

Please read Develop and Deploy Microservices with JHipster to see how this example was created.

Prerequisites: Java 8, Node.js 6.11, Yarn, and Docker.

NOTE: If you're not on Mac or Windows, you may need to install Docker Compose as well.

Okta has Authentication and User Management APIs that reduce development time with instant-on, scalable user infrastructure. Okta's intuitive API and expert support make it easy for developers to authenticate, manage and secure users and roles in any application.

Getting Started

To install this example application, run the following commands:

git clone https://github.com/oktadeveloper/jhipster-microservices-example.git
cd jhipster-microservices-example
  1. Start the registry by running ./mvnw -Pprod in the registry directory.

  2. Install dependencies in the blog directory, build the UI, and run the Spring Boot app.

    yarn
    ./mvnw 
    
  3. Start MongoDB using Docker Compose in the store directory.

    docker-compose -f src/main/docker/mongodb.yml up
  4. Install dependencies in the store directory, build the UI, and run the Spring Boot app.

    yarn
    ./mvnw 
    

You should be able to see the blog app at http://localhost:8080 and edit products (from the store app)

Run with Docker Compose

You can use Docker Compose to start everything if you don't want to start applications manually with Maven.

  1. Make sure Docker is running.

  2. Build Docker images for the blog and store applications by running the following command in both directories.

    ./mvnw package -Pprod docker:build
    
  3. Open a terminal, navigate to the docker directory of this project, and run the following command. If you have a lot of RAM on your machine, you might want to adjust Docker's default setting (2 GB).

    docker-compose up -d
    

    TIP: Remove -d from the end of the command above if you want to see logs from all containers in the current window.

  4. Use Kitematic to view the ports and logs for the services deployed.

To create activity in JHipster Console's charts, you run the Gatling tests in the blog and store projects.

./mvnw gatling:execute

To remove all Docker containers, run the following commands or do it manually using Kitematic.

docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)

To find what's running on a port on macOS, use sudo lsof -i :9092 # checks port 9092.

Run with Kubernetes and Minikube

  1. Install kubectl, VirtualBox, and Minikube.

  2. Start Minikube using minikube start.

  3. To be able to work with the docker daemon, make sure Docker is running, then run the following command in your terminal:

    eval $(minikube docker-env)
  4. Create Docker images of the blog and store applications:

    ./mvnw package -Pprod docker:build
  5. Navigate to the kubernetes directory in your terminal and re-generate the files so they match your Docker repository name.

    jhipster kubernetes
    

    Follow the instructions for tagging and pushing the Docker images.

    docker image tag blog {yourRepoName}/blog
    docker push {yourRepoName}/blog
    docker image tag store {yourRepoName}/store
    docker push {yourRepoName}/store
  6. Use kubectl to deploy to Minikube.

    kubectl apply -f registry
    kubectl apply -f blog
    kubectl apply -f store
    

    The deployment process can take several minutes to complete. Run minikube dashboard to see the deployed containers. You can also run kubectl get po -o wide --watch to see the status of each pod.

  7. Run minikube service blog to view the blog application. You should be able to login and add blogs, entries, and products.

To remove all deployed containers, run the following command:

kubectl delete deployment --all

To stop Minikube, run minikube stop.

NOTE: If you run minikube delete and have trouble running minikube start afterward, run rm -rf ~/.minikube. See this issue for more information.

Google Cloud

  1. Create a Google Cloud project at console.cloud.google.com.

  2. Navigate to https://console.cloud.google.com/kubernetes/list to initialize the Container Engine for your project.

  3. Install Google Cloud SDK and set project using:

    gcloud config set project <project-name>
    
  4. Create a cluster:

    gcloud container clusters create <cluster-name> --machine-type=n1-standard-2 --scopes cloud-platform --zone us-west1-a
    

    To see a list of possible zones, run gcloud compute zones list.

  5. Push the blog and store docker images to Docker Hub. You will need to create an account and run docker login to push your images. The images can be run from any directory.

    docker image tag blog mraible/blog
    docker push mraible/blog
    docker image tag store mraible/store
    docker push mraible/store
  6. Run kubectl commands to deploy.

    kubectl apply -f registry
    kubectl apply -f blog
    kubectl apply -f store
  7. Use port-forwarding to see the registry app locally.

    kubectl port-forward jhipster-registry-0 8761:8761
    
  8. Run kubectl svc blog to view the blog application on Google Cloud.

  9. Scale microservice apps as needed with kubectl:

    kubectl scale --replicas=3 deployment/store
    

To see a screencast of this process, watch this YouTube video.

AWS

If you know how to deploy this architecture to AWS, I'd love to hear about it! I tried in anger, but ultimately failed.

Links

This example uses JHipster, and awesome project that allows you to generate a microservices architecture with Spring Boot. See Develop a Microservices Architecture with OAuth 2.0 and JHipster for an example that uses OAuth and Okta.

Help

Please post any questions as comments on the blog post, or visit our Okta Developer Forums. You can also email [email protected] if would like to create a support ticket.

License

Apache 2.0, see LICENSE.

More Repositories

1

java-microservices-examples

Java Microservices: Spring Boot, Spring Cloud, JHipster, Spring Cloud Config, and Spring Cloud Gateway
Java
498
star
2

okta-aws-cli-assume-role

Okta AWS CLI Assume Role Tool
HTML
337
star
3

spring-boot-microservices-example

Bootiful Microservices with Spring Boot
TypeScript
307
star
4

okta-spring-boot-react-crud-example

Simple CRUD with React and Spring Boot 3
Java
252
star
5

okta-spring-boot-2-angular-5-example

A Cool Cars Example that showcases Spring Boot 2, Angular 5, and Okta's Support for both.
TypeScript
131
star
6

spring-boot-react-example

Example app showing how to build a Spring Boot REST API and React UI
TypeScript
109
star
7

spring-boot-angular-example

Example app showing how to build a Spring Boot REST API and Angular UI
TypeScript
94
star
8

okta-vue-node-example

Example of a Basic CRUD App with Vue.js and Node
JavaScript
90
star
9

okta-spring-boot-2-angular-7-example

A Cool Cars Example that showcases Spring Boot 2.1, Angular 7, and Okta's support for both.
TypeScript
86
star
10

schematics

Schematics for adding Okta and Auth0 Auth to your projects
TypeScript
69
star
11

okta-node-express-typescript-vue-example

Example Node.js API using TypeScript, Express, and Vue
TypeScript
66
star
12

native-java-examples

Native Java Apps with Micronaut, Quarkus, and Spring Boot
HTML
61
star
13

okta-react-node-example

A simple React.js + Node.js example app.
JavaScript
58
star
14

okta-spring-boot-authz-server-example

Spring Security OAuth 2.0 Guide
Java
58
star
15

okta-spring-boot-saml-example

Spring Boot, SAML, and Okta
Java
57
star
16

okta-oidc-flows-example

JavaScript
56
star
17

okta-spring-boot-2-angular-8-example

Angular 8 + Spring Boot 2.2 = ❀️
TypeScript
53
star
18

python-flask-react-crud-example

Build a simple CRUD application with Python, Flask, and React.
JavaScript
51
star
19

okta-php-core-rest-api-example

PHP
49
star
20

okta-go-vue-example

An Okta example app built with Go + Vue.
Go
47
star
21

okta-nodejs-sql-server-example

JavaScript
47
star
22

okta-scim-beta

Python
44
star
23

okta-kong-origin-example

Kong Gateway Example with OIDC and Okta
Java
44
star
24

okta-spring-boot-vue-crud-example

A Todo App that showcases Spring Boot, Vue.js, and Okta's support for both.
Vue
42
star
25

okta-blog

The Okta developer blog.
SCSS
41
star
26

okta-spring-boot-2-angular-9-example

CRUD Example with Angular 9.0 and Spring Boot 2.2
TypeScript
40
star
27

okta-dac

Okta Delegated Admin Console
Vue
38
star
28

okta-aspnetcore-vue-crud-example

CRUD Application with ASP.NET Core and Vue.js
JavaScript
37
star
29

okta-php-symfony-vue-crud-example

Build a Basic CRUD App with Symfony 4 and Vue
PHP
31
star
30

okta-node-sql-server-example

Build a Node.js App with SQL Server Tutorial
JavaScript
30
star
31

okta-jhipster-microservices-oauth-example

A microservices architecture built with JHipster, OAuth 2.0, and Okta
Java
30
star
32

okta-react-native-app-auth-example

React Native Example that Authenticates with Okta using App Auth
JavaScript
29
star
33

auth0-java-microservices-examples

Java Microservice Examples
Java
29
star
34

okta-wordpress-sign-in-widget

Replaces the WordPress login screen with the Okta sign-in widget
PHP
29
star
35

okta-vue-auth-example

A Vue.js Example with Okta for Authentication
JavaScript
29
star
36

okta-aspnet-mvc-example

ASP.NET 4.x MVC + Okta example
JavaScript
28
star
37

spring-boot-ionic-example

Example app that shows how to develop a mobile app with Ionic, Angular, and Spring Boot
TypeScript
28
star
38

auth0-full-stack-java-example

πŸ”₯ Full Stack Java Example
Java
28
star
39

auth0-java-oauth-examples

Java
27
star
40

okta-react-native-spring-boot-example

React Native + Spring Boot + OIDC
Java
27
star
41

auth0-spring-boot-angular-crud-example

Angular and Spring Boot CRUD Example
Java
27
star
42

ionic-jhipster-starter

Starter Template for Ionic Apps with JHipster
TypeScript
27
star
43

spring-boot-angular-pwa-example

Spring Boot API with Angular PWA
TypeScript
24
star
44

okta-angular-microfrontend-example

Starter code + completed project for micro-frontends using Webpack 5 and Module Federation plugin in Angular and sharing authenticated state
TypeScript
24
star
45

byob-dashboard

Vue
24
star
46

auth0-micro-frontends-jhipster-example

Micro Frontends for Java Microservices
Java
24
star
47

okta-ionic-auth-example

Example showing Ionic Authentication with Okta
TypeScript
23
star
48

spring-boot-vue-example

Bootiful Spring Boot + Vue Example
Vue
23
star
49

okta-cli-mfa-example

Shell
23
star
50

shiro-spring-boot-example

Java
23
star
51

auth0-java-rest-api-examples

Java REST API Examples
HTML
23
star
52

okta-aspnetcore-mvc-example

ASP.NET Core 2.0 MVC + Okta example
C#
22
star
53

okta-php-laravel-vue-crud-example

PHP
22
star
54

okta-angular-openid-connect-example

Angular + Angular CLI with Authentication from OpenID Connect and Okta
TypeScript
22
star
55

okta-react-photo-gallery-example

A Photo Gallery Example with React, Spring Boot, and JHipster 5 + Auth by Okta
TypeScript
22
star
56

crypto-invoicer

A personal web portal for invoicing clients with Bitcoin.
JavaScript
21
star
57

gatsby-netlify-okta-example

Gatsby, Netlify, and Okta Example App
JavaScript
21
star
58

okta-spring-boot-oauth-example

Spring Boot, OAuth 2.0, and Okta Example
Groovy
21
star
59

okta-smartfhir-docs

Documentation for using Okta as a SMART/FHIR authorization server.
20
star
60

api-security-book

CSS
20
star
61

okta-angular-material-login-example

Angular Material Login Example
TypeScript
20
star
62

okta-graphql-react-express-example

Web App with Express, React and GraphQL
JavaScript
20
star
63

okta-microservice-security-examples

Demos from Oktane18: API and Microservices Best Practices
Java
18
star
64

okta-spring-security-5-example

Authentication with Spring Security 5 and Okta OIDC
Java
18
star
65

okta-angular-sign-in-widget-example

Angular + Okta Sign-In Widget Example
TypeScript
18
star
66

okta-node-express-example

A simple sample application built using Node and Express that contains user login, registration, and password reset functionality.
JavaScript
17
star
67

okta-smartfhir-demo

Example of using Okta as an authorization server as part of a SMART on FHIR deployment.
JavaScript
16
star
68

okta-express-graphql-example

JavaScript
16
star
69

okta-spring-boot-oidc-sso-example

JavaScript
15
star
70

okta-openidconnect-appauth-android

Android Application with Okta as the IdP and AppAuth as the OpenID Connect mobile library
Java
14
star
71

example-maven-plugin

A simple example Apache Maven plugin
Java
14
star
72

okta-dotnetcore-react-example

C#
14
star
73

okta-node-express-typescript-react-example

Node.js API with TypeScript
TypeScript
14
star
74

okta-node-rest-api-example

Simple REST API with Node and OAuth 2.0
JavaScript
14
star
75

okta-angular-spring-boot-docker-example

Angular + Spring Boot Docker Example
TypeScript
14
star
76

okta-socket-io-chat-example

A simple chat application based on Socket.IO, React, and Express.
JavaScript
14
star
77

okta-spring-security-roles-example

Okta + Groups with Spring Security
Java
14
star
78

okta-ionic-4-login-example

Ionic 4 User Login and Registration Example
TypeScript
13
star
79

okta-nestjs-postgres-example

Sample application using NestJS and Postgres
TypeScript
13
star
80

okta-angular-node-example

Basic CRUD Example with Angular and Node
TypeScript
13
star
81

terraform-provider-oktaasa

Terraform Okta ASA provider
Go
13
star
82

okta-android-kotlin-crud-example

The source code for the Okta Kotlin Android CRUD tutorial.
Kotlin
13
star
83

okta-angular-mysql-timeline-example

An Angular + MySQL Timeline Example
TypeScript
13
star
84

okta-kotlin-typescript-notes-example

Kotlin and TypeScript! πŸŽ‰
TypeScript
13
star
85

auth0-spring-boot-passkeys-demo

A passkeys demo using Spring Boot and Auth0 as IdP
Java
13
star
86

okta-openidconnect-appauth-ios

iOS Sample Application with AppAuth
Swift
12
star
87

okta-angular-electron-example

TypeScript
12
star
88

spring-boot-client-credentials-example

Shell
12
star
89

okta-spring-jx-example

CI/CD for Spring Boot with Jenkins X and Kubernetes
Java
12
star
90

okta-react-docker-example

React + Docker Example
JavaScript
12
star
91

okta-oauth2-proxy-example

Java
12
star
92

okta-spring-jwt-and-opaque-token-example

Java
12
star
93

okta-spring-boot-angular-auth-code-flow-example

Package Angular and Spring Boot into a single JAR!
Java
12
star
94

okta-vanilla-js-example

A Vanilla JavaScript App with Authentication
JavaScript
12
star
95

rockstar

rockstar Chrome extension - enhance Okta
JavaScript
11
star
96

okta-php-symfony-angular-crud-example

Example CRUD App with Symfony and Angular
PHP
11
star
97

okta-appauth-xamarin-example

Xamarin.Forms authentication with OpenID Connect and Okta
C#
10
star
98

okta-node-cli-example

A command-line applications using Node.js
JavaScript
10
star
99

okta-node-express-15-minute-auth-example

Secure Authentication with Express and Okta
Handlebars
10
star
100

okta-php-trivia-react

PHP
10
star