I’m migrating my websites from Github to a Gogs installation which resides on my own server, proxied through, you guessed it, Caddy.
I use Caddy’s git directive in order to automatically deploy my websites.
In order to serve files, Caddy first needs to clone them from their appropriate git repos. In order to access these repos, Caddy needs to be proxying the Gogs install… which it won’t start doing till it’s finished cloning the repos.
You could try this, although I’m not sure it’ll work. Start Caddy without the git directive but make sure proxying is enabled. Then restart Caddy (SIGUSR1) with the gitdirective and hopefully it will be able to still make use of the proxy. But again I’m not sure.
How about two Caddy instances. One for proxying gogs which needs to be started first, then the other for git and serving your site. Ugly but should work.
It turns out that the git directive conflicts with my new Caddy deployment setup: I’m now committing each site’s Caddyfile, and importing the following glob: ./*/Caddyfile, which works awesomely for adding sites without touching the “master” Caddyfile.
However, I can no longer use the git directive to automagically keep sites up-to-date… I’m wondering if it’d be worth adding a plugin which could say “Hey, if the directory I’m currently in is already a git repository, git pull and then restart Caddy.”
Will git work when the site root is ./? As in, can it git clone on the current directory? Because if so… I’ve just solved every one of my deployment problems