lucaslorentz / caddy-docker-proxy

Caddy as a reverse proxy for Docker
MIT License
3.06k stars 174 forks source link

Multiple Import Labels #677

Closed nightshark closed 1 week ago

nightshark commented 1 week ago

I'm having a difficult time importing two snippets from the CDP container. It only seems to read the first one when generating the Caddyfile. Would you be able to point me in the right direction? I thought it was possible with suffixes on the label.

Here is one of the site containers:

labels:
      caddy: link.somewebsite.org
      caddy.crowdsec:
      caddy.reverse_proxy: "{{upstreams 9090}}"
      caddy.import: "auth"
      caddy_0.import: "access-log linkding"

Here is the CDP setup:

labels:
      caddy.email: "sldf.org"
      caddy.order: "crowdsec first" # forces the CrowdSec directive to be executed first
      #caddy.crowdsec.api_url: http://192.168.1.197:8282/
      caddy.crowdsec.api_url: http://172.23.0.1:8282/ 
      caddy.crowdsec.api_key: $CROWDSEC_API_KEY
      caddy.crowdsec.ticker_interval: 10s
      #caddy.crowdsec.disable_streaming:
      #caddy.crowdsec.enable_hard_fails:
      caddy_0: (auth)
      caddy_0.forward_auth: 192.168.1.197:9091
      caddy_0.forward_auth.uri: https://
      caddy_0.forward_auth.copy_headers: Remote-User Remote-Groups Remote-Name Remote-Email
      caddy.servers.trusted_proxies: "cloudflare"
      caddy.servers.trusted_proxies.interval: "12h"
      caddy.servers.trusted_proxies.timeout: "15s"

      caddy.servers.trusted_proxies_strict: #https://caddyserver.com/docs/caddyfile/options#trusted-proxies
      caddy_1: (logfile)
      #caddy_1.log.format: "console"
      caddy_1.log.output: "file /logs/access.log"
      caddy_1.log.output.roll_size: "2mb"
      caddy_1.log.output.keep: "10"
      caddy_1.log.output.roll_keep_for: "720h"
      caddy_2: (access-log)
      #caddy_2.log.format: "console"
      caddy_2.log.output: "file /logs/{args[0]}.log"
      caddy_2.log.output.role_size: "2mb"
      caddy_2.log.output.keep: "10"
      caddy_2.log.output.roll_keep_for: "720h"
nightshark commented 1 week ago

I needed to be using the format:

caddy.1_import: (snippet_name)
caddy.2_import: (snippet_name)

I missed this in the docs.