https://github.com/garryone/parcellab-sre-interview
https://github.com/garryone/parcellab-sre-interview
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/garryone/parcellab-sre-interview
- Owner: GarryOne
- Created: 2024-02-01T11:13:06.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-06T13:24:53.000Z (over 2 years ago)
- Last Synced: 2025-01-21T17:11:39.347Z (over 1 year ago)
- Language: TypeScript
- Size: 96.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Introduction
The API was built using [Nest.js](https://github.com/nestjs/nest).
There is a `GET /` endpoint which displays a `SALUTION_TEXT` defined in the ENV.
## Kubernetes configuration
* There is `deployment-a.yaml`.
* There is `deployment-b.yaml`.
## Setup
### Minikube
1. Have `minikube installed`. Then run `minikube start`
2. Switch kubectl context to minikube: `kubectl config set current-context minikube`
## Docker Local Registry
3. `minikube addons enable registry`
4. `kubectl port-forward --namespace kube-system $(kubectl get po -n kube-system | grep registry | awk '{print $1}') 5000:5000 &` - this will enable localhost:5000 as the **local docker registry**
## Deploy
5. Run `./docker-push.sh`
6. Run `./deploy-k8s.sh`
Alternatively, you can use `./deploy.sh` which combines both of the above.
## Unit test
* There is one unit test that assesses if `SALUTATION_TEXT` env value is being returned by the endpoint. It's running inside Dockerfile.
## Test
* `kubectl port-forward svc/nodejs-service-a -n default 8080:80` - http://localhost:8080 - you'll get `Hello Madam`
* `kubectl port-forward svc/nodejs-service-b -n default 8081:80` - http://localhost:8081 - you'll get `Dear Sir`