Skip to content

Latest commit

 

History

History
60 lines (44 loc) · 1.39 KB

compose.md

File metadata and controls

60 lines (44 loc) · 1.39 KB

docker compose

  1. create a docker compose file for your webserver (without nginx)
  2. try to deploy a working nginx load balancer (you need to craft a nginx image first)

node labels

  1. add
docker node update --label-add db=true m2
  1. 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}}'

compose file

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