Open ofsahin opened 3 years ago
I don't think this is possible right now, it would probably require a new command to work. I think the Caddyfile is just read once when starting docker-proxy
and never again.
You should probably move the things you have in that Caddyfile into labels on your Caddy service though, but either way I think it'll require a restart.
Or you could move it to docker swarm config to keep using the Caddyfile syntax .
Both supports reload.
I don't know about docker swarm, I will keep restarting caddy. It is personal server afterallπ
Thank you
The Caddyfile is automatically reloaded by polling (default every 30 seconds, see CADDY_DOCKER_POLLING_INTERVAL), so there shouldn't be any need to manually reload or even restart. Works for me.
One issue I faced in the beginning: If you mounted just the Caddyfile into the container and not the config directory, you must edit the file in-place. Editors like e.g. VIM write a new file and rename it, so it gets a new inode and won't be picked up by the container. Two proposals to work around that:
1) mount the directory 2) create a symlink to the Caddyfile and point your editor to edit the symlink. This will trigger in-place update of the file which can be seen by the bind-mount.
Is there a way to view the operating caddyfile?
@MagicJF no need to make a comment in another issue after having opened one. https://github.com/lucaslorentz/caddy-docker-proxy/issues/502 Your question is not relevant to this feature request.
The Caddyfile is automatically reloaded by polling (default every 30 seconds, see CADDY_DOCKER_POLLING_INTERVAL), so there shouldn't be any need to manually reload or even restart. Works for me.
One issue I faced in the beginning: If you mounted just the Caddyfile into the container and not the config directory, you must edit the file in-place. Editors like e.g. VIM write a new file and rename it, so it gets a new inode and won't be picked up by the container. Two proposals to work around that:
1. mount the directory 2. create a symlink to the Caddyfile and point your editor to edit the symlink. This will trigger in-place update of the file which can be seen by the bind-mount.
Hello, I can see that Caddy is reloading itself but I fail to understand how it could find the docker-compose configuration by itself. I am running the docker-compose binary; if I edit the docker-compose.yaml nothing gets reloaded automatically.
Running docker-compose up --no-recreate
does not reload the Caddy configuration.
Restarting containers (--force-recreate
) does works but I obviously don't want to keep restarting my containers when I need to test proxy options.
The documentation says
Every time a Docker object changes, the plugin updates the Caddyfile
How can I trigger such a change?
It's not the docker-compose files that it watches, it's the docker labels, which are attached to the actual running containers in memory (i.e. docker inspect <container-id>
, you'll see the labels).
In fact, CDP knows nothing about Docker Compose, it only knows the Docker API via the unix socket.
You must re-create containers for label changes to take effect.
I can indeed see the labels not getting updated without restarting the container. Thanks for your reply!
I obviously don't want to keep restarting my containers when I need to test proxy options.
Probably not what you want either but if restarting implicitly due to local file changes (might apply to compose file, I haven't tested), you could try compose watch?: https://docs.docker.com/compose/file-watch/
hello,
i just started using this plugin and it is awesome π€π thanks for the help @francislavoie
now the question normally when i change caddyfile, i hot reload the config docker exec -it caddy /usr/bin/caddy reload --config /etc/caddy/Caddyfile --adapter caddyfile but since i started using this plugin, i could not figure out how to reload the base caddyfile set by -caddyfile-path
i tried docker exec -it caddy /usr/bin/caddy docker-proxy reload -caddyfile-path /etc/caddy/Caddyfile
but when i use it like this, i end up in the container and cursor stays there, if i ctrl+c it says INFO shutting down {"signal": "SIGINT"} WARN exiting; byeee!! π {"signal": "SIGINT"} INFO shutdown complete {"signal": "SIGINT", "exit_code": 0}
is there a way to hot reload base caddyfile?