Caddy proxy for OpenStack API's

Here is my example Caddyfile for Openstack API's using Cloudflare DNS verification. I needed to build a custom Dockerfile Lazily I haven't used docker-compose, yet.. I will!

1docker run -it --rm -p5000:5000 -p 9696:9696 -p 9292:9292 -p 8774:8774 -p 8776:8776 -p 8778:8778 -p 9878:9878 -p 9511:9511 -p 8004:8004 -p 2019:2019 -p80:80 -p443:443 -v $(pwd)/Caddyfile:/etc/caddy/Caddyfile -e CLOUDFLARE_API_TOKEN=my-token -v caddy_data:/data --name caddy caddy-nexgen

Dockerfile

1FROM caddy:builder AS builder
2
3RUN caddy-builder \
4    github.com/caddy-dns/cloudflare
5
6FROM caddy:latest
7
8COPY --from=builder /usr/bin/caddy /usr/bin/caddy

  1{
  2    email cory@hawkvelt.id.au
  3}
  4
  5api.cloud.com {
  6    tls {
  7        dns cloudflare {env.CLOUDFLARE_AUTH_TOKEN}
  8    }
  9    # log {
 10    #     output stdout
 11    #     level DEBUG
 12    # }        
 13
 14	reverse_proxy 10.11.254.251:88 {
 15        health_uri /auth/login/
 16        health_status 2xx
 17    }
 18	reverse_proxy 10.11.254.252:88 {
 19        health_uri /auth/login/
 20        health_status 2xx
 21    }
 22	reverse_proxy 10.11.254.253:88 {
 23        health_uri /auth/login/
 24        health_status 2xx
 25    }
 26}
 27api.cloud.com:5000 {
 28    tls {
 29        dns cloudflare {env.CLOUDFLARE_AUTH_TOKEN}
 30    }
 31    # log {
 32    #     output stdout
 33    #     level DEBUG
 34    # }        
 35
 36	reverse_proxy 10.11.254.251:5000 {
 37        health_uri /v3/
 38        health_status 2xx
 39    }
 40	reverse_proxy 10.11.254.252:5000 {
 41        health_uri /v3/
 42        health_status 2xx
 43    }
 44	reverse_proxy 10.11.254.253:5000 {
 45        health_uri /v3/
 46        health_status 2xx
 47    }
 48}
 49
 50api.cloud.com:6080 {
 51    tls {
 52        dns cloudflare {env.CLOUDFLARE_AUTH_TOKEN}
 53    }
 54
 55        reverse_proxy 10.11.254.251:6080 {
 56        health_uri /
 57        health_status 404
 58    }
 59        reverse_proxy 10.11.254.252:6080 {
 60        health_uri /
 61        health_status 404
 62    }
 63        reverse_proxy 10.11.254.253:6080 {
 64        health_uri /
 65        health_status 404
 66    }
 67}
 68
 69api.cloud.com:9696 {
 70    tls {
 71        dns cloudflare {env.CLOUDFLARE_AUTH_TOKEN}
 72    }
 73	reverse_proxy 10.11.254.251:9696 {
 74        health_uri /
 75        health_status 2xx
 76    }
 77	reverse_proxy 10.11.254.252:9696 {
 78        health_uri /
 79        health_status 2xx
 80    }
 81	reverse_proxy 10.11.254.253:9696 {
 82        health_uri /
 83        health_status 2xx
 84    }
 85}
 86
 87api.cloud.com:9292 {
 88    tls {
 89        dns cloudflare {env.CLOUDFLARE_AUTH_TOKEN}
 90    }
 91	reverse_proxy 10.11.254.251:9292 {
 92        health_uri /
 93        health_status 300
 94    }
 95	reverse_proxy 10.11.254.252:9292 {
 96        health_uri /
 97        health_status 300
 98    }
 99	reverse_proxy 10.11.254.253:9292 {
100        health_uri /
101        health_status 300
102    }
103}
104
105api.cloud.com:8774 {
106    tls {
107        dns cloudflare {env.CLOUDFLARE_AUTH_TOKEN}
108    }
109        reverse_proxy 10.11.254.251:8774 {
110        health_uri /
111        health_status 2xx
112    }
113        reverse_proxy 10.11.254.252:8774 {
114        health_uri /
115        health_status 2xx
116    }
117        reverse_proxy 10.11.254.253:8774 {
118        health_uri /
119        health_status 2xx
120    }
121}
122
123api.cloud.com:8776 {
124    tls {
125        dns cloudflare {env.CLOUDFLARE_AUTH_TOKEN}
126    }
127	reverse_proxy 10.11.254.251:8776 {
128        health_uri /
129        health_status 300
130    }
131	reverse_proxy 10.11.254.252:8776 {
132        health_uri /
133        health_status 300
134    }
135	reverse_proxy 10.11.254.253:8776 {
136        health_uri /
137        health_status 300
138    }
139}
140
141api.cloud.com:8778 {
142    tls {
143        dns cloudflare {env.CLOUDFLARE_AUTH_TOKEN}
144    }
145	reverse_proxy 10.11.254.251:8778 {
146        health_uri /
147        health_status 2xx
148    }
149	reverse_proxy 10.11.254.252:8778 {
150        health_uri /
151        health_status 2xx
152    }
153	reverse_proxy 10.11.254.253:8778 {
154        health_uri /
155        health_status 2xx
156    }
157}