- create a docker compose file for your webserver (without nginx)
- try to deploy a working nginx load balancer (you need to craft a nginx image first)
- add
docker node update --label-add db=true m2
- check
#! /bin/bash
set -u
docker node ls -q | xargs docker node inspect \
-f '{{ .ID }} [{{ .Description.Hostname }}]: {{ range $k, $v := .Spec.Labels }}{{ $k }}={{ $v }} {{end}}'
version: "3.3"
services:
nginx:
image: ${DECIHUB_IMAGE_NGINX:-ERROR}
ports:
- { target: 80, published: 80, protocol: tcp, mode: host }
- { target: 443, published: 443, protocol: tcp, mode: host }
networks: [ "backend" ]
volumes: [ "certs:/etc/letsencrypt" ]
deploy:
replicas: 1
placement: { constraints: [ node.labels.web == true ] }
api:
image: ${POLYTECH_IMAGE_API:-ERROR}
networks: [ "backend" ]
deploy: { replicas: 3 }
networks:
backend:
volumes:
certs:
external: true
random websites used while crafting this compose file