- Install Docker Desktop (https://www.docker.com/get-started/)
- Make sure Docker Desktop installed -
docker version - Setup Kubernetes Cluster on Docker Desktop (https://www.docker.com/blog/how-to-set-up-a-kubernetes-cluster-on-docker-desktop/) or minikube also could be used.
- Ensure kubectl works -
kubectl version - Install
skaffold- https://skaffold.dev/docs/install/ - Ensure skaffold works -
skaffold version - Clone the repo -
git clone https://github.com/avinashcodelabs/ticketing.git - Build docker image of each microservice and push them to Docker Hub (https://hub.docker.com/repositories/avinashcodelabs)
docker build -t avinashcodelabs/auth auth && docker push avinashcodelabs/authdocker build -t avinashcodelabs/client client && docker push avinashcodelabs/clientdocker build -t avinashcodelabs/expiration expiration && docker push avinashcodelabs/expirationdocker build -t avinashcodelabs/orders orders && docker push avinashcodelabs/ordersdocker build -t avinashcodelabs/payments payments && docker push avinashcodelabs/paymentsdocker build -t avinashcodelabs/tickets tickets && docker push avinashcodelabs/tickets
- Modify hosts file to redirect
127.0.0.1 ticketing.devto have k8s loadbalancer domain name. - Create k8s load balancer, ingress-nginx
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.13.3/deploy/static/provider/cloud/deploy.yamlfrom https://kubernetes.github.io/ingress-nginx/deploy/#quick-start. - Same script has been downloaded and will run as part of
skaffold devstored at => infra/k8s-dev/setup-loadbalancer-ingress-controller.yaml . This setup will create and destroy every time I start and stop the skaffold. Better to follow the point 11 and delete this script from the directory. - Create 2 secrets
kubectl create secret generic stripe-secret --from-literal STRIPE_KEY=GETITFROMSTRIEDEVELOPERTOOLAPIKEYSkubectl create secret generic jwt-secret --from-literal JWT_KEY=ITCOULDBEANYTHING
- Start the app using below command (it automatically creates all the k8s objects - Deployments, Services, Pods etc and destroys them when it stopped)
ticketing > skaffold dev - App UI available at
https://ticketing.dev - App API available at
https://ticketing.dev/api/users/signup
ticketing.dev.mov
- Microservices
- Event Driven Architecture
- Pub/Sub
- JavaScript
- TypeScript
- Docker
- Kubernetes
- Skaffold
- NATS Streaming - Messaging system
- Node.js
- Express.js
- MongoDB
- Mongoose
- Redis
- JWT Auth
- Next.js
- Server Side Rendering
- Stripe - Payment system
- Boostrap
- GitHub Actions
- Postman
- DockerHub
Postman API collection at ticketing/ticketing.postman_collection.json
- NATS Streaming docker image - https://hub.docker.com/_/nats-streaming
- NATS Streaming docs - https://nats-io.gitbook.io/legacy-nats-docs/ nats-streaming-server-aka-stan/developing-with-stan
- NATS Streaming - node.js client - https://www.npmjs.com/package/node-nats-streaming
- Test credit card numbers = https://docs.stripe.com/testing#cards
- Stripe checkout component - https://www.npmjs.com/package/react-stripe-checkout
- Enable this => Enable card data collection with a publishable key without using Stripe's pre-built UI elements at https://dashboard.stripe.com/settings/integration in order above component to work.
- To test ticketing payment in Postman, we can use test token
tok_visathis always works.
In order to decrypt the jwt token,
- Take JWT from cookie.
- Use https://www.base64decode.org/ to convert from base64 to utf-8 string
- Copy 'jwt' key value from it.
- Paste that into https://www.jwt.io/ to decode it and see the payload
- Docker Desktop K8S (single-node) -> kind (multi-node)
- node -> bun
- express -> fastify
- express-validator -> zod
- skaffold -> tilt.dev or devspace.sh
- Nextjs Pages Router -> App Router
- Find proper way to automate creating secret in k8s. Helm config can recognize(resolve) .env file keys and skaffold will take care of running yaml file as usual? for now, problem is k8s config files wont recognize from .env keys. or else bash script to generate yaml files on the file by reading .env keys and run that yaml through skaffold
- Add dev and prod mode config files like watch files in dev mode and build in prod mode etc
- Add one more microservice as notification service(SMS or Email).
- POSTMAN collection to Swagger UI or any other OpenAPI standards UI.