I'm new to DevOps specifically using golang and microservice architecture.
I'm wondering if go applications should or should not be deployed in containers (Docker). In this case, I have a system built with micro-service architecture. For example here, I have 2 web services, A and B. Also I have another web server acts as a gateway in front of those two.
Both A and B need access for a database, MySQL for example. A handles table A, and B handles table B.
I know that in Go, source codes are compiled into a single executable binary file. And because I have 3 services here, I have 3 binaries. All three run as web server exposing JSON REST API.
My questions are these:
Can I deploy these servers together in one host running on different ports? If my host get an IP x.x.x.x for example, my gateway can run in x.x.x.x:80, A in port 81, and B in port 82 for example. A and B will talk to a MySQL server somewhere outside or maybe inside the same host. Is this a good practice? Can Continuous Deployment works with this practice?
Why should I deploy and run those binaries inside containers like Docker? I know that since its release few years ago, Docker had found its way to be integrated inside a development workflow easily. But of course using Docker is not as simple as just compiling the code into a binary and then moving it to a deployment server. Using Docker we have to put the executable inside the container and then move the container as well to the deployment server.
What about scalibility and high availability without using Docker? Can I just replicate my services and run them all at once in different hosts using a load balancer? This way I should deploy A, B, and gateway in one host, and another A, B, and gateway in another host, then setup load balancer in front of them. A, B, and the gateway runs in port 80, 81, and 82 respectively. This way I could have thousands of nodes in a form of VMs or LXD containers maybe, spread accross hundreds of bare metals, deployed with a simple bash script and ssh, or Ansible if things get complex. Yes or no?
And what about the scalability and availability of using Docker? Should I just put all my services inside containers and manage them with something like Kubernetes to achieve high availability? Doing this does add overhead, right? Because the team will have to learn new technology like Kubernetes if they haven't known it yet.
Can you give me an example of some best practices of deploying golang services?