filariow / demo-app

An simple e-commerce microservice demo application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SOA Demo App

Epic: https://issues.redhat.com/browse/APPSVC-1240

At the time of writing the architecture is composed of the following 4 services:

  • frontend: an NGINX server who provides the React application.
  • catalog: a microservices in charge of handling the Catalog of products.
  • orders: a microservice in charge of handling the Orders.
  • orders-events-consumer: reacts to the events fired by the Orders' database and places messages in a Message Brokers.

The catalog microservice will also listen from messages published on a Message broker's Topic and updates the ordered Product's sold quantity.

final-architecture

Run the demo-app

Clone this repo and it's submodules

git clone --recursive git@github.com:primaza/demo-app.git

Run with Docker Compose

This mode will only use locally deployed services, so it won't integrate with AWS services but with locally deployed development versions of those services. Use the following command:

docker compose up

Run on Kubernetes

Configure AWS Secrets

Onto the kubernetes cluster will be installed the AWS operators that will need access to AWS. The easiest way to provide this access, is relying on long-term access keys. That's not the most secure way to allow access, so feel free to use other options.

Once you have the Access Key pair (i.e., Access Key ID and Access Key Secret), use the companion tool to generate the needed secrets. We assume you stored the secrets in a password manager, like pass.

AWS_ACCESS_KEY_ID=$(pass 'demo-soa/aws/access_key') AWS_SECRET_ACCESS_KEY=$(pass 'demo-soa/aws/secret_access_key') ./hack/aws-create-secrets.sh

Run on Minikube

You can use the script ./hack/run-on-minikube.sh to easily run the application on a minikube cluster.

The script will accomplish the following actions:

  • create a Minikube cluster using profile demo-soa
  • build the image into Minikube (cfr. minikube docker-env --help)
  • deploy the application on the cluster
  • open the application site in a browser, or prompts the url in the console
Use local services

Local instances of the cloud services will be published on the minikube cluster and used instead of the cloud ones.

Use the following command to set install the demo app with local instances of AWS services:

LOCAL_SERVICES=true ./hack/run-on-minikube.sh
Use AWS services

Follow what described in section Configure AWS Secrets.

Then use the following command to setup minikube and install the demo-app:

./hack/run-on-minikube.sh

Run on OpenShift Local with CRC

Use local services

Local instances of the cloud services will be published on the minikube cluster and used instead of the cloud ones.

Use the following command to set install the demo app with local instances of AWS services:

LOCAL_SERVICES=true ./hack/run-on-crc.sh
Use AWS services

Follow what described in section Configure AWS Secrets.

Then use the following command to setup OpenShift local and install the demo-app:

./hack/run-on-crc.sh

Generate Services' Clients with OpenAPI Generator

Refer to https://openapi-generator.tech.

make generate-clients

About

An simple e-commerce microservice demo application


Languages

Language:TypeScript 43.8%Language:Go 34.8%Language:Shell 9.9%Language:Makefile 3.6%Language:Python 3.6%Language:CSS 1.7%Language:Dockerfile 1.3%Language:HTML 1.1%Language:JavaScript 0.2%