I am writing a webserver in Go. I want to run it in production. How I can set up the server? Should I just run the executable and open the ports (be it VM, Docker or K8). Or is there specific way?
Also, like in Python, we have Gunicorn which is used in production which also gives the option of workers to handle concurrent requests. Is there something similar for Go? I know Go can handle concurrent requests but still workers can balance the load.
Generally, put the executable in a container. There are many tools to manage and orchestrate containers. There’s probably already an orchestrator where you plan deploy your code.
It’s common to launch the application/binary into a container with kubernetes, in front of this you can put some services like nginx, traefik to route yours services and a Load Balancer to route into yours servers from AWS/GCP/Azure
but, there are some tools can help you here https://awesome-go.com
Depends on the service but if you use net/http each handler will be executed in a goroutine. gunicorn takes care of handling requests in different process/thread.