The todo app is a Golang application designed to be a example of Go, Docker and Kubernetes with a React Typrescript frontend.
Currently to get started, you will need to run go through the following
- Download Docker
- Download Go
- Install Minikube (including kubectl)
- Install Skaffold
- Create a file named secrets.yaml and insert the following. The data is base64 encoded values which you can update yourself.
apiVersion: v1
kind: Secret
metadata:
name: db-config
type: Opaque
data: # plaintext values
dbRootUser: cm9vdA== # root
dbRootPw: cm9vdA== # root
dbName: dG9kb2xpc3Q= # todolist
dbUser: dXNlcg== # user
dbPw: cGFzc3dvcmQ= # password
- Run the following to create persistent volume claim so our database has somewhere to persist
kubectl apply -f k8s-persistent-volume-claim.yaml
kubectl apply -f secrets.yaml
kubectl apply -f k8s-todo-database-deployment.yaml
- Get the name of the MySQL pod using
kubectl get pods
- Open a bash shell in the above by running
kubectl exec -it [POD_NAME_HERE] -- /bin/bash
- In the shell, open MySQL using, entering the password from above at the prompt
mysql -u [inser the dbRootUser from secrets] -p
- Run this SQL Script
- Run the command
skaffold dev --port-forward
- Open http://localhost:8080 in the browser and you should see pong.
In order to start the backend server, run the commands
kubectl apply -f k8s-persistent-volume-claim.yaml
kubectl apply -f secrets.yaml
kubectl apply -f k8s-todo-database-deployment.yaml
skaffold dev --port-forward
This will build images of the database and the server, deploy them to minikube, watch for changes and auctomatically build when changes are detected. The database will be accessible via localhost:3307 (however it might also be 3306 depending if you have MySQL running on the local machine) and the server available at http://localhost:8080.
Exit the Skaffold in the terminal using CTRL+c then, run the following
kubectl delete -f k8s-persistent-volume-claim.yaml
kubectl delete -f secrets.yaml
kubectl delete -f k8s-todo-database-deployment.yaml
Coming soon, probably when there is a frontend server