Name
Last commit
Last update
..
.gitkeep swarm init
README.md docker swarm, front-end add

logo

Docker Swarm 도입결과

성공적으로 www.hongsnet.net 시스템에 Docker Swarm을 도입/운영하였으며, 여기서는 설정만을 명시한다.

Docker Stack

# cat docker-stack.yml
version: '3'
services:
  hongsnet:
       image: registry.hongsnet.net/joohan.hong/docker/hongsnet:latest
       volumes:
        - HOME:/home
        - EDU_DATA:/home/edu/public_html/HongsBoard/Data
        - EDU_EDITOR:/home/edu/public_html/HongsBoard/Web_editor/EDU"
        - EDU_FILE:/home/edu/public_html/HongsBoard/Web_editor/FILE"
        - HONGS_DATA:/home/hongsnet/public_html/Data"
        - HONGS_EDITOR:/home/hongsnet/public_html/Web_editor/FILE"
        - NEWSYSTEM_DATA:/home/newhongsystem/public_html/Data"
        - NEWSYSTEM_EDITOR:/home/newhongsystem/public_html/Web_editor/FILE"
       ports:
        - "80:80"
        deploy:
          mode: replicated
          replicas: 5
          placement:
            constraints: [node.hostname != TB2-DOCKER]
          update_config:
            parallelism: 5
            delay: 10s
          restart_policy:
            condition: on-failure
            max_attempts: 3
            window: 120s

volumes:
  HOME:
   driver_opts:
     type: "nfs"
     o: "addr=192.192.0.254,nolock,soft,rw"
     device: ":/WEB_SRC/home"
  EDU_DATA:
   driver_opts:
     type: "nfs"
     o: "addr=192.192.0.254,nolock,soft,rw"
     device: ":/WEB_DATA/EDU/Data"
  EDU_EDITOR:
   driver_opts:
     type: "nfs"
     o: "addr=192.192.0.254,nolock,soft,rw"
     device: ":/WEB_DATA/EDU/Web_editor/EDU"
  EDU_FILE:
   driver_opts:
     type: "nfs"
     o: "addr=192.192.0.254,nolock,soft,rw"
     device: ":/WEB_DATA/EDU/Web_editor/FILE"
  HONGS_DATA:
   driver_opts:
     type: "nfs"
     o: "addr=192.192.0.254,nolock,soft,rw"
     device: ":/WEB_DATA/HONGSNET/Data"
  HONGS_EDITOR:
   driver_opts:
     type: "nfs"
     o: "addr=192.192.0.254,nolock,soft,rw"
     device: ":/WEB_DATA/HONGSNET/Web_editor/FILE"
  NEWSYSTEM_DATA:
   driver_opts:
     type: "nfs"
     o: "addr=192.192.0.254,nolock,soft,rw"
     device: ":/WEB_DATA/NEWHONGSYSTEM/Data"
  NEWSYSTEM_EDITOR:
   driver_opts:
     type: "nfs"
     o: "addr=192.192.0.254,nolock,soft,rw"
     device: ":/WEB_DATA/NEWHONGSYSTEM/Web_editor/FILE"

Front-end (HA-Proxy)

# cat /etc/haproxy/haproxy.cfg
...중략
backend www_hongsnet_net

    balance roundrobin
    option  forwardfor

    option  httpchk  HEAD / HONGSNET_LVS
    option  httpclose
    cookie  SVID insert indirect nocache maxlife 10m

    redirect scheme https code 301 if !{ ssl_fc }

    # 에러 파일 설정
    errorfile 400 /etc/haproxy/errors/400.http
    errorfile 403 /etc/haproxy/errors/403.http
    errorfile 408 /etc/haproxy/errors/408.http
    errorfile 500 /etc/haproxy/errors/500.http
    errorfile 502 /etc/haproxy/errors/502.http
    errorfile 503 /etc/haproxy/errors/503.http
    errorfile 504 /etc/haproxy/errors/504.http

    http-request cache-use web_cache
    http-response cache-store web_cache

    http-request set-src src

    server  tb2.hongsnet.net 172.24.0.151:80 cookie tb2 check fall 3 rise 2
    server  tb3.hongsnet.net 172.16.0.158:80 cookie tb3 check fall 3 rise 2
    server  tb3-docker.hongsnet.net 172.16.0.251:80 cookie tb3-docker check fall 3 rise 2