Closed accforgithubtest closed 3 months ago
Hey. The docs for caddy-docker-proxy seems quite straight forward to the normal configuraton.
You need to set ordering in the global block
{
order sablier before reverse_proxy
}
Then as per the docs just map over accordingly https://github.com/lucaslorentz/caddy-docker-proxy
caddy.directive: argA
caddy.directive.subdirA: valueA
caddy.directive.subdirB: valueB1 valueB2
↓
{
directive argA {
subdirA valueA
subdirB valueB1 valueB2
}
}
So I guess it would look something like this for Sablier
sablier {
names jupyter
dynamic {
display_name : jupyter
}
}
caddy.sablier.names: servicename
caddy.sablier.dynamic
↓
{
sablier {
names servicename
dynamic
}
}
I don't use that extension but it should be pretty straight forward. I would assume that it likely wont get added to the docs, as it should be straightforward to do that mapping, and its documentation for an extension rather that Caddy itself.
Hope the above helps.
Based on how containers are discovered, see:
I'd say that the caddy docker proxy does not work with containers that are shutdown. We should probably open up a pull request just for that on their repository.
A simple scan for containers that are down or services with 0 replicas would work.
Now that the issue https://github.com/lucaslorentz/caddy-docker-proxy/issues/527 has been closed, I should try some test on my end and then add the relevant documentation
[I am not a developer, but have been learning docker for self hosting purposes so my knowledge is limited and apologies if this is a dumb question.]
But it looks like i cannot directly use caddy-docker-proxy with sablier or vice-versa - is that correct assumption ? Pls correct me if my thinking is wrong.
What do I need to do to be able to use caddy-docker-proxy with sablier. Do I need to build a custom docker image ? Any help to get both of them working together is appreciated ! Thanks !
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
hi @ab623 - thanks for your earlier reply. I had other issues with my set up and had to park this for later. But I am now looking into getting sablier working with caddy again.
Sorry to ask basic questions, but I have tried looking at the sablier docs and caddy-docker-proxy docs, and still haven't been able to put together yet. I am not a developer, just been learning docker to put together my self hosted set-up.
Can you pls tell me where do I need to set this ? (I do not have a caddy file in my set up since I depend on caddy-docker-proxy to auto generate it from the labels in compose file.)
You need to set ordering in the global block { sablier before reverse_proxy }
My current sample docker compose file is below.
services:
caddy:
image: serfriz/caddy-ratelimit-dockerproxy-sablier:latest
container_name: caddy
environment:
- CADDY_INGRESS_NETWORKS=default
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./certs:/certs:ro
- ./sablier:/etc/sablier/
ports:
- 80:80
- 443:443
- 443:443/udp
labels:
caddy.sablier: "before reverse_proxy"
homer:
image: b4bz/homer:latest
container_name: homer
environment:
- INIT_ASSETS=0
volumes:
- ./:/www/assets
ports:
- 8080
labels:
caddy: homer.local.host
caddy.reverse_proxy: "{{upstreams 8080}}"
caddy.tls: "/certs/local.host+1.pem /certs/local.host+1-key.pem"
caddy.sablier.enable: true
caddy.sablier.names: homer
caddy.sablier.dynamic:
and the error I see in the logs is -
[ERROR] Removing invalid block: Caddyfile:2: unrecognized global option: sablier
{
sablier before reverse_proxy
}
[ERROR] Removing invalid block: directive 'sablier' is not an ordered HTTP handler, so it cannot be used here - try placing within a route block or using the order global option
homer.local.host {
reverse_proxy :8080
sablier {
dynamic
enable true
names homer
}
tls /certs/local.host+1.pem /certs/local.host+1-key.pem
}
I am using the serfriz/caddy-ratelimit-dockerproxy-sablier image for caddy, as serfriz helped to put together a image with caddy, sablier and caddy-docker-proxy.
The block from my config is: (seems like i mistyped it in my original comments. Hence the confusion)
{
order sablier before reverse_proxy
}
Therefore it seems as if
labels:
caddy.sablier: "before reverse_proxy"
should be this
labels:
caddy.order: "sablier before reverse_proxy"
Give that a try.
Some more info here https://github.com/acouvreur/sablier/issues/67#issuecomment-1634770511
That was the issue - missing the order keyword. thank you @ab623 !
hey @acouvreur
In case you are interested in adding this to the sablier docs, the docker compose I posted to Issue #264 can be used. It uses the docker image created by serfriz/caddy-ratelimit-dockerproxy-sablier
services:
caddy:
image: serfriz/caddy-ratelimit-dockerproxy-sablier:latest
container_name: caddy
dns: 10.0.0.25 #pihole
restart: always
environment:
- CADDY_INGRESS_NETWORKS=test_default
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- path/to/self-signed certificate files:/certs:ro
ports:
- 80:80
- 443:443
- 443:443/udp
- 10000:10000
labels:
caddy.order: sablier before reverse_proxy
networks:
default:
ipv4_address: 10.0.0.26
homer:
image: b4bz/homer:latest
container_name: homer
dns: 10.0.0.25 #pihole
restart: always
environment:
- INIT_ASSETS=0
volumes:
- ./:/www/assets
ports:
- 8080
labels:
caddy: homer.local.host
caddy.tls: "path to self-signed certificate files"
caddy.sablier.enable: true
caddy.sablier.names: homer
caddy.sablier.dynamic:
networks:
default:
ipv4_address: 10.0.0.27
Thanks @accforgithubtest ! I will add it to the docs! Looks very nice!
Hello,
I think this is a great project and thanks for all the great work by the way !
I am trying to use caddy-docker-proxy as a reverse proxy and would like to know how to setup sablier with caddy-docker-proxy.
caddy-docker-proxy allows to specify labels on the docker compose file for individual containers/services, and I would like to know how to use sablier.
I just saw the notes for a PR that the 1.4 beta version supports caddy, but cannot figure out how to set it up correctly.
A quick update to docs examples with docker compose and caddy-docker-proxy is much appreciated, thanks !