services: app01-replica: image: ${APP01_IMAGE} hostname: ${APP01_HOSTNAME} environment: APP01_IMAGE: "${APP01_IMAGE}" APP01_HOSTNAME: "${APP01_HOSTNAME}" APP01_EXPOSED_PORT: "${APP01_EXPOSED_PORT}" URL: "${URL}" APP01_PATH_PREFIX: "${APP01_PATH_PREFIX}" PROXY_NETWORK: "${PROXY_NETWORK}" expose: - "${APP01_EXPOSED_PORT}" deploy: mode: replicated replicas: 3 restart: always logging: driver: "json-file" options: max-size: "50m" max-file: "10" compress: "true" rotate-max-age: "7d" labels: "app=app01,env=production,version=1.0.0" labels: app: "app01" version: "1.0.0" env: "test" app_url: "${URL}/${APP01_PATH_PREFIX}" traefik.enable: "true" traefik.http.routers.app01.entrypoints: "https" traefik.http.routers.app01.rule: "Host(`${URL}`) && PathPrefix(`/${APP01_PATH_PREFIX}`)" traefik.http.routers.app01.tls: "true" traefik.http.routers.app01.tls.certresolver: "letsEncrypt" traefik.http.routers.app01.service: "app01" traefik.http.services.app01.loadbalancer.server.port: "${APP01_EXPOSED_PORT}" traefik.http.services.app01.loadbalancer.passhostheader: "true" traefik.http.routers.app01.middlewares: "app01-header" traefik.http.middlewares.app01-header.headers.referrerPolicy: "no-referrer" traefik.http.middlewares.app01-header.headers.stsSeconds: "15552000" traefik.http.middlewares.app01-header.headers.forceSTSHeader: "true" traefik.http.middlewares.app01-header.headers.stsPreload: "true" traefik.http.middlewares.app01-header.headers.customrequestheaders.X-Forwarded-Proto: "https,wss" traefik.docker.network: "${PROXY_NETWORK}" networks: - proxy app02: image: ${APP02_IMAGE} hostname: ${APP02_HOSTNAME} environment: APP02_IMAGE: "${APP02_IMAGE}" APP02_HOSTNAME: "${APP02_HOSTNAME}" APP02_EXPOSED_PORT: "${APP02_EXPOSED_PORT}" APP03_HOSTNAME: "${APP03_HOSTNAME}" APP03_EXPOSED_PORT: "${APP03_EXPOSED_PORT}" URL: "${URL}" APP01_PATH_PREFIX: "${APP02_PATH_PREFIX}" PROXY_NETWORK: "${PROXY_NETWORK}" SERVICE_NETWORK: ${SERVICE_NETWORK} expose: - "${APP02_EXPOSED_PORT}" restart: always deploy: resources: limits: cpus: '0.50' memory: 50M reservations: cpus: '0.25' memory: 20M logging: driver: "fluentd" options: fluentd-address: "tcp://:24224" tag: "docker.{{.Name}}" labels: app: "app02" version: "1.0.0" env: "test" app_url: "${URL}/${APP02_PATH_PREFIX}" traefik.enable: "true" traefik.http.routers.app01.entrypoints: "https" traefik.http.routers.app01.rule: "Host(`${URL}`) && PathPrefix(`/${APP02_PATH_PREFIX}`)" traefik.http.routers.app01.tls: "true" traefik.http.routers.app01.tls.certresolver: "letsEncrypt" traefik.http.routers.app01.service: "app01" traefik.http.services.app01.loadbalancer.server.port: "5000" traefik.http.services.app01.loadbalancer.passhostheader: "true" traefik.http.routers.app01.middlewares: "app01-header" traefik.http.middlewares.app01-header.headers.referrerPolicy: "no-referrer" traefik.http.middlewares.app01-header.headers.stsSeconds: "15552000" traefik.http.middlewares.app01-header.headers.forceSTSHeader: "true" traefik.http.middlewares.app01-header.headers.stsPreload: "true" traefik.http.middlewares.app01-header.headers.customrequestheaders.X-Forwarded-Proto: "https,wss" traefik.docker.network: "${PROXY_NETWORK}" networks: - proxy - service app03: image: ${APP03_IMAGE} hostname: ${APP03_HOSTNAME} depends_on: app02: condition: service_started environment: APP03_IMAGE: "${APP03_IMAGE}" APP03_HOSTNAME: "${APP03_HOSTNAME}" APP03_EXPOSED_PORT: "${APP03_EXPOSED_PORT}" SERVICE_NETWORK: ${SERVICE_NETWORK} expose: - "${APP03_EXPOSED_PORT}" restart: always deploy: resources: limits: cpus: '0.50' memory: 50M reservations: cpus: '0.25' memory: 20M logging: driver: "fluentd" options: fluentd-address: "tcp://:24224" tag: "docker.{{.Name}}" labels: app: "app03" version: "1.0.0" env: "test" networks: - service networks: proxy: name: ${PROXY_NETWORK} external: true service: name: ${SERVICE_NETWORK} external: true