Caddy caddy-docker-proxy to handle load balancing with reverse proxy>

@matt && @francislavoie thank you for your messages.

I have checked the template and i am sorry to say that it really makes no sense to fill it in.

this is docker-copose file

version: '3.7'

# Settings and configurations that are common for all containers
x-minio-common: &minio-common
  image: quay.io/minio/minio:RELEASE.2022-07-17T15-43-14Z
  command: server --console-address ":9001" http://minio{1...4}/data{1...2}
  expose:
    - "9000"
    - "9001"
  networks:
    - minio
  # environment:
    # MINIO_ROOT_USER: minioadmin
    # MINIO_ROOT_PASSWORD: minioadmin
  healthcheck:
    test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
    interval: 30s
    timeout: 20s
    retries: 3

# starts 4 docker containers running minio server instances.
# using nginx reverse proxy, load balancing, you can access
# it through port 9000.
services:
  minio1:
    <<: *minio-common
    hostname: minio1
    volumes:
      - data1-1:/data1
      - data1-2:/data2

  minio2:
    <<: *minio-common
    hostname: minio2
    volumes:
      - data2-1:/data1
      - data2-2:/data2

  minio3:
    <<: *minio-common
    hostname: minio3
    volumes:
      - data3-1:/data1
      - data3-2:/data2

  minio4:
    <<: *minio-common
    hostname: minio4
    volumes:
      - data4-1:/data1
      - data4-2:/data2

  caddy:
    image: caddy
    hostname: caddy
    networks:
      - minio
      - caddy
    labels:
      caddy: "s3.woss.io"
      caddy.reverse_proxy: "{{upstreams}}"
    depends_on:
      - minio1
      - minio2
      - minio3
      - minio4
    volumes:
      - caddy_data:/data
      - ./Caddyfile:/etc/caddy/Caddyfile

networks:
  minio:
    driver: bridge
  caddy:
    external: true

## By default this config uses default local driver,
## For custom volumes replace with volume driver configuration.
volumes:
  caddy_data:
  data1-1:
  data1-2:
  data2-1:
  data2-2:
  data3-1:
  data3-2:
  data4-1:
  data4-2:

and Caddyfile

{
        debug
        email daniel@woss.io
        log {
                output file /var/log/caddy/caddy.log
                level DEBUG
        }
}
http://127.0.0.1 {
  reverse_proxy minio:9000 minio2:9000 minio3:9000
}

As said in the reverse_proxy (Caddyfile directive) — Caddy Documentation this should be done in a similar fashion. I cannot figure out how to make this work with the docker-caddy proxy.

I hope this makes sense now :slight_smile:

1 Like