This project shows an approach of a microservices implementation, as well as event-driven architecture.
The app is basically a platform where you can buy and sell concert tickets. It implements tickets+orders listing and creation, as well as payments and expiration management.
tickets
, orders
, expiration
and payments
constitute the microservices of this system.
common
is a common package used accross the microservices.
When a user buys a ticket, he creates an order. Then, the ticket is locked for 1 min (default), giving him the time to pay, or not, his order.
The payments
service implements Stripe.
-
You'll need a stripe account, get your keys, and then create a
.stripe-secret.env
file at the root of the project- Populate it with
STRIPE_KEY=<secret-key>
andPUBLIC_STRIPE_KEY=<public-key>
- Populate it with
-
The github actions build and pushes the images to DockerHub, but to my repositories by using my username. So change that too.
- My dockerhub username is
tmprimitivo
, replace it with your DockerHub username.
- My dockerhub username is
-
If you want to deploy, the github actions workflow files are ready
- I've made the config to deploy with DigitalOcean
- Once you've signed in, create a Kubernetes Cluster, and install+config your doctl on your local machine
- You'll just have to change the cluster name in the Github actions file. The current name used is
concert-tickets-app
- Also, in
infra/k8s-prod/ingress-service.yml
, set your production hostname. Current one used isfurio.team
-
You'll also have to register a few secrets in your Github repo, so the GitHub CI can use them
DIGITALOCEAN_ACCESS_TOKEN
-> Your DigitalOcean API keyDOCKERHUB_TOKEN
-> Your Dockerhub tokenDOCKERHUB_USERNAME
-> Your Dockerhub username
-
On local machine, set a
GITHUB_AUTH_TOKEN
env var with your Github Token value -
After starting up Minikube :
- Get minikube's ip with
minikube ip
- Modifiy /etc/hosts to match the minikube's ip with "weconcert.dev" (
192.168.49.2 weconcert.dev
)
- Get minikube's ip with
-
Browse freely the
Makefile
, it contains a lot of things that might help you in dev mode
ONE last thing :
- If you decide to publish the
common
pkg to your own repo, you'll have to publish it to Github packages.- So, replace every
applinh
orAppliNH
with your github username. They mostly lie in the.npmrc
files or in theMakefile
, but also in thepackage.json
ofcommon
,auth
,payments
,orders
,expiration
andtickets
. - You then can run
make pub-common
to publish to your Github packages - and
make sync-common-all
to install package in all the microservices.
- So, replace every
make start-dev
Then head tohttps://weconcert.dev
.
If you've got a certificate error, just type "thisisunsafe" in the middle of the page, whithout selecting any input box.
If you wanna restart the app, and that minikube is already running and everything is configured properly, just run skaffold dev
.