Each service has its own database (MongoDB) and uses domain events to communicate with other services. NATS Streaming is used as an event bus.
- Auth Service - implements JWT-based user authentication and protects API endpoints from unauthorized access
- Tickets Service - handles ticket creation, editing and listing
- Orders Service - handles ticket reservation, cancellation and listing
- Payments Service - handles credit card payments coming from users using Stripe as a payment processor
- Expiration Service - watches for the expiration of ticket reservations using an expiration queue
- Kubernetes Ingress - provides routing rules to manage external users' access to the services in the Kubernetes cluster
It's a Server Side Rendered React app with tickets and orders pages. It uses Stripe Checkout for payments and Bootstrap for styling.
-
In order to build and deploy this project you need Docker, Kubernetes and Skaffold
-
You can opt to deploy your application in the cloud by running the deployment scripts in Github Workflows. In this case you need a DigitalOcean account.
-
To deploy the application locally first you need to set the
baseURL
to http://ingress-nginx-controller.ingress-nginx.svc.cluster.local in./client/api/build-client.js
file. -
To deploy the application on DigitalOcean first you need to set the
baseURL
to a public domain name in the following file./client/api/build-client.js
. Domain names can be configured under DigitalOcean's Networing menu (see the docs) -
In case of production deployment change the
spec.rules.host
and theservice.beta.kubernetes.io/do-loadbalancer-hostname
configs to your own domain name in the following fileinfrastructure/kubernetes-prod/ingress-service.yaml
-
Add
ticketing.dev
tohosts
file (/etc/hosts
orC:\Windows\Systems32\Drivers\etc\hosts
):127.0.0.1 ticketing.dev
-
Don't forget to select local Kubernetes context (
docker-desktop
) before running any commands -
You need a Stripe account for payments and you have to set your secret Stripe API key. You can find it under
Developers->API keys->Secret key
kubectl create secret generic stripe-secret --from-literal=STRIPE_KEY=<YOUR_SECRET_STRIPE_API_KEY>
-
Set the secret key for JWT-based authentication:
kubectl create secret generic jwt-secret --from-literal=JWT_KEY=<YOUR_SECRET_KEY>
-
Install NGINX Ingress Controller locally
-
Go to the root directory, then build and deploy your application:
skaffold run
-
Create a DigitalOcean account
-
Create a Kubernetes cluster on DigitalOcean and name it
ticketing
-
Install doctl
-
Generate a DigitalOcean access token
-
To get access to the remote Kubernetes cluster run:
doctl auth init -t <YOUR DIGITALOCEAN ACCESS TOKEN>
-
Add the credentials for the specified cluster to your local
kubeconfig
:doctl kubernetes cluster kubeconfig save <remote cluster name>
-
Don't forget to select remote Kubernetes context before running the following commands
-
You need a Stripe account and to set your secret Stripe API key. You can find it under
Developers->API keys->Secret key
kubectl create secret generic stripe-secret --from-literal=STRIPE_KEY=<YOUR_SECRET_STRIPE_API_KEY>
-
Set the secret key for JWT-based authentication:
kubectl create secret generic jwt-secret --from-literal=JWT_KEY=<YOUR_SECRET_KEY>
-
Install NGINX Ingress Controller for DigitalOcean
-
Go to the root directory and deploy your application:
kubectl apply -f infrastructure/kubernetes && kubectl apply -f infrastructure/kubernetes-prod
-
Create a DigitalOcean account
-
Create a Kubernetes cluster on DigitalOcean and name it
ticketing
-
Generate a DigitalOcean access token
-
To get access to the remote Kubernetes cluster run:
doctl auth init -t <YOUR DIGITALOCEAN ACCESS TOKEN>
and enter your DigitalOcean access token
-
Add the credentials for the specified cluster to your local kubeconfig:
doctl kubernetes cluster kubeconfig save <remote cluster name>
-
Don't forget to select remote Kubernetes context before running the commands bellow
-
You need a Stripe account and to set your secret Stripe API key. You can find it under
Developers->API keys->Secret key
:kubectl create secret generic stripe-secret --from-literal=STRIPE_KEY=<YOUR_SECRET_STRIPE_API_KEY>
-
Set secret key for JWT-based authentication:
kubectl create secret generic jwt-secret --from-literal=JWT_KEY=<YOUR_SECRET_KEY>
-
Install NGINX Ingress Controller
-
Add a secret variable
DIGITALOCEAN_ACCESS_TOKEN
on Github (github project page ->settings ->secrets->New secret
) and enter your DigitalOcean API access token -
Save your DigitalOcean auth credentials in
DOCKER_USERNAME
and inDOCKER_PASSWORD
secret variables on Github -
On each push event to the
master
branch the deployment workflows get executed and the application gets deployed