A simple but scalable ticketing app built based on the Microservices Architecture and deployed to the Google Cloud Platform.
- NodeJS
- ExpressJS
- React
- NextJS
- Docker
- Kubernetes
- NGINX Ingress Controller
- Skaffold
- MongoDB
- NATS streaming server
Docker
Before you attempt to clone the repo and follow the next steps on how to run the app, ensure you have Docker locally installed on your machine. If not, follow this guide on how to set up Docker on your machine.
Run the docker
command to ensure that docker is successfully installed. If you get this error 'docker' is not recognized as an internal or external command
, try to reinstall docker correctly or make sure it is added to your path.
Kubernetes
Docker Desktop includes a standalone Kubernetes server that runs on your local host, so that you can test deploying your Docker workloads on Kubernetes. To enable Kubernetes on your Docker desktop;
- Open Docker desktop.
- Click settings.
- Under settings select Kubernetes.
- Check Enable Kubernetes.
- Click Apply and Restart.
Run the kubectl
command to ensure that docker is successfully installed. If you get this error 'kubectl' is not recognized as an internal or external command
, try to reinstall Kubernetes correctly or make sure it is added to your path.
Skaffold
Install and set up Skaffold using this guide on how to get started with Skaffold. Run the skaffold
command to ensure that skaffold is successfully installed. If you get this error 'skaffold' is not recognized as an internal or external command
, try to reinstall skaffold correctly or make sure it is added to your path.
Google Cloud Platform
- Sign Up for a GCP account using this link https://cloud.google.com/free.
- Go to the GCP console and create a new project
ticketing-app
. - In your project, scroll and select the Kubernetes Engine option on the menu.
- Click on Create cluster to create a kubernetes cluster for your app. Click create at the bottom to finally create your cluster.
- Install the google cloud sdk using this guide https://cloud.google.com/sdk/docs/quickstart.
- Initialize and configure the google cloud sdk; first sign in with
gcloud auth login
. A little window will appear in your browser prompting you to choose the google account you prefer to use to sign in. Sign in with the account you used to create your GCP account. - Run
gcloud container clusters get-credentials <cluster-name>
to install the GPC context locally on Docker Desktop.
Ingress-Nginx
Follow this guide to set up ingress-nginx for your GCP project.
ticketing.dev domain
To ensure that everytime we try to visit ticketing.dev we navigate to the ticketing.dev on our machine rather than real url on the internet, open your local host file with your favorite editor in adminstrator mode: for example; C:\Windows\System32\Drivers\etc\hosts
on windows or etc/hosts
on mac.
Click Kubernetes Engines on your project menu, select Services and Ingress. Under services and ingress look for ingress-nginx-controller, copy the IP Address and paste it to your hosts file, then append the domain name in this format.
31.79.218.200 ticketing.dev
Save the file.
Clone the repo.
git clone https://github.com/mwinel/ticketing-app.git
CD into the different services one at a time. For example;
cd auth
or
cd tickets
Install dependancies.
npm install
After all dependencies in all services have been installed cd to the root folder and run;
skaffold dev
Finally navigate to ticketing.dev
in your browser to test this app out.
CD into a given service such as auth or tickets and run the following command;
npm run test
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.