Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add another example for a static configuration #596

Open
Folas1337 opened this issue Mar 16, 2024 · 0 comments
Open

Add another example for a static configuration #596

Folas1337 opened this issue Mar 16, 2024 · 0 comments

Comments

@Folas1337
Copy link

While this might be obvious to people that know Caddy well, it wasn't for me and it took me a moment to figure out how to set this up.

There are use cases in which you can't rely on labels to configure your docker setup and you have to do it statically for whatever reason (as you have maybe connected your "ghetto swarm" through a VPN or you're only using swarm to have an overlay network but you're not really using the swarm functionality to deploy services as some services don't even scale with swarms). For those scenarios I would appreciate a static.yaml or something like that in the examples.

I migrated from the image SteveLTN/https-portal and needed a similar way of handling things by defining my proxy settings on the proxy container and not through labels on other containers 😄

Here's my current docker-compose.yml:

version: "3.7"
services:
  caddy:
    image: lucaslorentz/caddy-docker-proxy:ci-alpine
    container_name: caddy
    ports:
      - 80:80
      - 443:443
    environment:
      - CADDY_INGRESS_NETWORKS=caddy_network
    networks:
      - caddy_network
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - caddy_data:/data
    labels:
      caddy_1: container1.example.com
      caddy_1.reverse_proxy: "dockerContainer1:8080"
      caddy_2: container2.example.com, container.example.com
      caddy_2.reverse_proxy: "dockerContainer2:8081"
      #Add more containers to proxy here :)
    restart: unless-stopped

networks:
  caddy_network:
    driver: overlay

volumes:
  caddy_data: {}

Feel free to copy into the examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant