What is all this you say? I strongly suggest you to read the following gist before going ahead:
https://gist.github.com/rahulk789/616643b75337f255c9403009456003d0
Implemented using node.js and socket.io ; This is an attempt to create a whatsapp clone.
run sudo npm i socket.io nodemon -g
nodemon nodeServer/index.js
<your browser> index.html
\
You can also set up the server simply by running sudo docker compose up
to create a docker image , run sudo docker build -t rchat-server-image .
To run the docker image and access it on localhost sudo docker run -d -p 8000:8000 rchat-server-image
For api image sudo docker run -d -p 4099:4099 rchat-api-deployment
To access it on kubernetes:
sudo k0s kubectl apply -f k8s-deployment.yaml
To delete the pod
sudo k0s kubectl delete pod rchat-server-pod
Run the following to check if the pod is running
sudo k0s kubectl get pods
Run the following to access the server service on localhost
sudo k0s kubectl port-forward service/rchat-server-deployment 8000:8000
Run the following to access the api service on localhost
sudo k0s kubectl port-forward service/rchat-api-deployment 4099:4099
To test scaling run the following with correct IP (or localhost)
while true; do curl http://10.106.224.66:4099/ ; done;
To deploy grafana on k8s run:
sudo k0s kubectl apply -f k8s-deployment.yaml
Run the following to access grafana on localhost
sudo k0s kubectl port-forward service/grafana 3000:3000
To deploy prometheus on k8s run:
sudo k0s kubectl apply -f k8s-deployment.yaml
Run the following to access prometheus on localhost
sudo k0s kubectl port-forward service/prometheus-service 9090:8080