The numbers-app is application that show the result from numbersapi.com trivia. Made using go and react.
- golang
- echo-framework
- react
- axios
- skaffold
- helm
- distroless images
- precommit
To start the application you can use this command :
skaffold dev --profile { environment }
It will start the application and show all the logs including build, deployment, app logs, etc.
There was 3 environment available.
- development
- staging
- production
The development environment has only 1 pod will be deployed. To deploy the development profile you can use this command :
skaffold dev --profile development
The staging environment has 2 replicas active. To deploy the staging profile you can use this command :
skaffold dev --profile staging
The production environment has minimum of 2 replicas and maximum of 4 replicas active, with autoscale enabled and averageUtilization configured to 50% of cpu usage. To deploy the production profile you can use this command :
skaffold dev --profile production
You can modify the values of replicas, cpu averageUtilization, create new profile, rename the profile in a single file skaffold.yaml.
While skaffold dev running, you can modify the code or manifest and the skaffold will instantly re-run the cycle.
And when you stop the process, it will automatically cleanup everything.
Test the API using this command :
curl -s -XPOST -u dora:emon localhost:1323/numbersapi/23 | jq .
200 (OK)
"{\n \"text\": \"23 is the number of times Julius Caesar was stabbed.\",\n \"number\": 23,\n \"found\": true,\n \"type\": \"trivia\"\n}"
401 (Unauthorized)
{"message":"Unauthorized"}
404 (Not Found)
{"message":"Not Found"}
405 (Method Not Allowed)
{"message":"Method Not Allowed"}
This project only tested on docker-for-desktop, if you wanted to use it on real k8s cluster. Please modify the artifact image in skaffold.yaml and k8s manifest. The images need to be pushed to registry and pulled by your pod.