Skip to content

A test of scaling a simple websocket server written in Java and can be deployed either locally with HAProxy or deployed to google cloud kubernetes engine with their google autoscaler

License

Notifications You must be signed in to change notification settings

Luuuuuis/SocketRedisClusterTest

Repository files navigation

SocketRedisClusterTest

A test of scaling a simple websocket server written in Java and can be deployed either locally with HAProxy or deployed to google cloud kubernetes engine

To build this reposetory use docker build -t socketserver ..

Can locally be deployed in two different ways (known to me):

Docker Swarm

If you haven't enabled docker swarm yet, run: docker swarm init.

This stack can be deployed using docker stack deploy --compose-file=docker-compose.yml [NAME]. This may take a while.

Finally you can observe your service using docker service ls. Scalling is possible with docker service scale [NAME]_ws=[NUM]. Delete this service using docker service rm [NAME].

Kubernetes Engine on Google Cloud

Follow the tutorial on their official site. https://console.cloud.google.com/kubernetes/

A nice sample is provided by them on GitHub

Docker Compose

Docker Compose does NOT work due to network limitations

Usage

When deploying loacally you can access the websocket via any webbrowser or application that supports websockets. Connectings will be handled under the port 8443 so you can connect using ws://localhost:8443. Port and more is editable in the docker-compose.yml.

SSL

You can obtain a SSL certificate either with LetsEncrypt or using CloudFlare. Either way you have to edit the docker-compose.yml to add your private key and your certificate like shown. This may help you creating the string.

Can scale ;) image

About

A test of scaling a simple websocket server written in Java and can be deployed either locally with HAProxy or deployed to google cloud kubernetes engine with their google autoscaler

Topics

Resources

License

Stars

Watchers

Forks