Docker Swarm
Docker Swarm is an orchestrator and so is Kubernetes.
Kubernetes is breathing down my neck too and today I am thinking, "What the hell, go for it! Why NOT run a single node with Kubernetes?" So jump off to that page for the latest on my explorations.
I was going to use Dart as a worker but I decided I did not want to pay the electric bill to spin all those drives up anymore, so I sold Dart and now it lives in Newberg. I am going to use Tern instead. Should be fine for testing.
bellman> docker swarm init Swarm initialized: current node (isk0jocx0rb37yonoafstyvoj) is now a manager. To add a worker to this swarm, run the following command: docker swarm join --token SWMTKN-1-5b81dywl9xkis6769fxnsvjahfy361w2kxkz69nc35bz3nxt6s-43jxeopl6inw8xur1vpcl23w7 192.168.123.2:2377 To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
tern> docker swarm join --token SWMTKN-1-5b81dywl9xkis6769fxnsvjahfy361w2kxkz69nc35bz3nxt6s-43jxeopl6inw8xur1vpcl23w7 192.168.123.2:2377 This node joined a swarm as a worker.
bellman> docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION isk0jocx0rb37yonoafstyvoj * bellman Ready Active Leader 19.03.5 vjbx2h8n8280ecib2btzkwcxw tern Ready Active 18.09.1
bellman> docker network create -d overlay --attachable proxy_net
The "attachable" option is for containers not yet running in swarm.
Now ordinarily I'd use Docker Compose to start a proxy running consisting of two components. One is the nginx reverse proxy and one is the letsencrypt docker. Here are the rules to start them swarm style using Docker Stack.
How about before trying all that I spin up simple web server? This works, and the proxy works normally too. It creates 4 replicas.
docker service create --name web --replicas=4 \ -p 80:80 -e NETWORK_ACCESS=internal \ -e VIRTUAL_HOST=solr.wildsong.biz -e VIRTUAL_PORT=80 \ -e LETSENCRYPT_HOST=solr.wildsong.biz -e [email protected] \ nginx:latest
This did not work, it's just something I tried. Possibly it's the volume settings? How do volumes work in a swarm?
docker service create --name proxy \ -p 80:80 -p 443:443 \ -e DHPARAM_GENERATION="false" \ -v /var/run/docker.sock:/tmp/docker.sock:ro \ -v ./network_internal.conf:/etc/nginx/network_internal.conf \ -v ./vhost.d:/etc/nginx/vhost.d \ -v proxy_html:/usr/share/nginx/html \ -v proxy_dhparam:/etc/nginx/dhparam \ -v proxy_certs:/etc/nginx/certs:ro \ jwilder/nginx-proxy:alpine