Zone a C2C platform, build with scalability and availability in mind.
Zone uses a custom utility library zone-common. Github: zone-common
This application is divided into 5 micro-services.
-
Authentication
-
Products
- Create, Fetch and Update Products.
-
Orders
- Create, Update Orders
-
Payments
- Create Payments
-
Client
- Provides UI to end users to interact with the app.
Messaging System used to communicate between these services is NATS.
Messages are persisted using NATS-Jetstream.
The zone has 3 streams that persist messages.
1. products
2. orders
3. payments
Events/messages flowing in the application:
1. PRODUCT.created
2. PRODUCT.updated
3. ORDER.created
4. ORDER.cancelled
5. PAYMENT.created
Type of QueueGroups in the application
1. product_created_listeners
2. product_updated_listeners
3. payment_created_listeners
4. order_created_listeners
5. order_cancelled_listeners
All Listeners/Consumers are of type Queue Push Consumers.
https://www.loom.com/share/40319d495c8d4bae9639012b0ef93b9c
Prerequisite to run the application
Docker, Kubernetes, Skaffold, nats-cli must be install
Inside K8's cluster
Install IngressController, cert-manager using helm.
-
cd Zone
-
Create secrets Refer commands in (_secret.txt).
-
Create a Self-signed Kubernetes SSL certificate.
-
configure nats-cli.
-
Setup NATS streams.
create
products
,orders
andpayments
streams.use command
nats stream add
when prompted subject add following subjects for above streams repectively
PRODUCT.*
,ORDER.*
,PAYMENT.*
here
*
is subject wildcardexample
StreamName: products Subject: PRODUCT.* . . . (default-options can be used for the rest)
use command
nats stream ls
to check if streams. -
In PersistentVolume Object replace
hostPath
in all files in infra/k8s.- auth-pg-pvolume.yaml
- nats-jetstream-pvolume.yaml
- orders-pg-pvolume.yaml
- payments-pg-pvolume.yaml
- products-pg-pvolume.yaml
- redis-pvolume.yaml
-
run
skaffold dev