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

This is the question about caddy-docker-proxy.

I’m using this quite extensively and i am loving it. Today i tried to set up minio cluster and i hit the wall on how to load balance 4 different minio instances.

Does anybody have experience with this?

Thank you .

1 Like

What wall are you hitting?

(I don’t have experience with what you’re doing, but people will be more inclined to help if you provide more information. Our help template is crucial for this.)

As Matt said, please fill out the help topic template, as per the forum rules.

We can’t answer vague questions like this, without more detail. You’re putting the onus on us to make assumptions as to what you mean.

1 Like

@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

Why are you spinning up 4 separate services for minio?

I think you’re looking for Docker Swarm’s deploy scale/replicas feature instead, which CDP will pick up on automatically.

1 Like

hm, well i was adapting the official tutorial which comes with nginx to use caddy :slight_smile:
It’s good to know that CDP will pick that up. Is that the only way to have CDP works with the load balancing feature and reverse proxy?

Possibly. You’ll need to open an issue on the CDP project to ask if there’s an alternative.

thanks. i wanted to do this in the first place then i thought you guys are somehow connected and it’s always better to have the info consolidated in one place.

Thanks for all your time and effort to understand and answer :peace_symbol:

This topic was automatically closed after 30 days. New replies are no longer allowed.