I am thinking I’ll just keep a Caddyfile
to make it easy for humans and use a Docker CMD to convert it to JSON using caddy adapt
.
The plan is to have two containers.
The first (static
) will contain Caddy and is the webserver for my application. Caddy will start with a default configuration containing a website which I always need to exist.
I then have another container (supervisor
) which will dynamically configure Caddy for extra websites from a database. supervisor
will make a request against the Caddy Configuration API (in static
) to updaye Caddy’s configuration.
So one website stays regardless of anything else. Others come and go overtime. I was just hoping to store the configuration for the website that always remains in one spot rather than two, but it’s a little hard trying to use Caddyfile and POST /load
.
Again, nothing major and easy to work around.
I have a similar setup which is working really well but I use etcd and confd in the middle to fuse supervisor
and static
together (i.e. supervisor
updates etcd, and I use confd in static
to rewrite Caddy configuration files and reload Caddy). I want to remove etcd and confd entirely now that the Caddy Configuration API exists.