I have an app that I’d like to deploy using Docker Swarm on 2 servers for now. One server would act like a Manager and the other one as the Worker.
The app is a JS app that has 5 images: nginx, mongo, api, frontend, and backend. I start these parts as services via docker-compose.
My biggest concern is the data persistency.
- Do I bind mongo to only one node (let’s say manager since it uses a volume) and leave it like that?
- That would mean that the entire app is vulnerable if the manager node goes offline (database backups are certainly a must)?
- Other services replicated and scaled on other worker nodes will have no issues in communicating with this database?
Would it then be necessary to have only mongo and nginx with 1 replica each and bind them to specific node and all other services replicated throughout the cluster?
Additionally, I have seen approaches in creating a Docker Swarm with simple init on the host and then connecting the worker with the command on another host. If I want to run manager and worker on the same server, then I suppose I would have to run each node in a virtual machine through docker-machine, is that correct?
I am still trying to grasp the conception of how Swarm works and I am thankful for any input.