First of all, I am new to docker cloud, but I have some experience with using docker containers.
For now I am using heroku for hosting every app, but I am thinking about moving to docker cloud.
However there are some things I don’t understand in docker cloud.
My goal is to create heroku-like environment for a simple app that looks like this on heroku:
- web dyno (scaled)
- worker dyno (scaled)
- scheduler dyno (single dyno always)
As I understand, on heroku each dyno is a separate node in docker cloud (AWS EC2 instance for example), that runs 1 process of given type (web/worker/scheduler). So in docker cloud it should be 1 node that runs 1 container.
So to create heroku-like environment for my app, as I understand, I should:
- create node cluster with deployment tag “web” and start as many nodes as I want for web process (for example 4 ec2 nano instances)
- create node cluster with deployment tag “worker” and start as many nodes as I want for worker process (for example 2 ec2 nano instances)
- create node cluster with deployment tag “scheduler” and start 1 node (single ec2 nano instance for example)
- create service “web-service” from my web process image that will target “web” tag and use EVERY_NODE startegy so it will be deployed to each node of web cluster.
- create service “worker-service” from my worker process image that will target “worker” tag and use EVERY_NODE startegy so it will be deployed to each node of worker cluster.
- …and same as above for scheduler.
Can anyone clarify if it makes any sense?
The last thing that will be needed in this setup is some load balancer in front of web nodes, right?
That’s the hardest part I guess. The load balancer should:
- be available on my app custom domain, like myapp.com
- balance requests to that domain (or it’s default docker cloud http address) across all web nodes
- auto discover new nodes when web cluster is scaled
- perform healthchecks on all web nodes
Moreover, each of web nodes should not be exposed publicly (they should be exposed through load balancer only).
Can anyone tell me how to create such environment? I guess I should create separate cluster with 1? node that will host load balancer itselft, but how I can configure it to accomplish all goals listed above?