I just like to be explicit, so that someone later who would work on this can see it and know what this does
Anyway, I really want to know where all these problems occurs. From what I suspect from log, maybe this comes from automatic certificates management issues or somethings ( Sorry for not posting all of these at first time, I was exhausted by the time I posted this at 3 AM)
If I change nothing from config and reload, it seems no hangs.
Apr 3 14:02:18 USER caddy[51915]: {"level":"info","ts":1617426138.3133948,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"} Apr 3 14:02:18 cemware caddy[51915]: {"level":"warn","ts":1617426138.326343,"msg":"input is not formatted with 'caddy fmt'","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2}
Apr 3 14:02:18 USER caddy[31459]: {"level":"info","ts":1617426138.3274755,"logger":"admin.api","msg":"received request","method":"POST","host":"localhost:2019","uri":"/load","remote_addr":"127.0.0.1:39836","headers":{"Accept-Enc$ding":["gzip"],"Content-Length":["18144"],"Content-Type":["application/json"],"Origin":["localhost:2019"],"User-Agent":["Go-http-client/1.1"]}}
Apr 3 14:02:18 USER caddy[31459]: {"level":"info","ts":1617426138.349725,"logger":"admin.api","msg":"config is unchanged"} Apr 3 14:02:18 cemware caddy[31459]: {"level":"info","ts":1617426138.3499577,"logger":"admin.api","msg":"load complete"}
But if I change config and reload, log is like;
Apr 3 14:04:00 USER caddy[52837]: {"level":"info","ts":1617426240.3973637,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
Apr 3 14:04:00 USER caddy[52837]: {"level":"warn","ts":1617426240.4071853,"msg":"input is not formatted with 'caddy fmt'","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2}
Apr 3 14:04:00 USER caddy[31459]: {"level":"info","ts":1617426240.4079936,"logger":"admin.api","msg":"received request","method":"POST","host":"localhost:2019","uri":"/load","remote_addr":"127.0.0.1:40906","headers":{"Accept-Encoding":["gzip"],"Content-Length":["18144"],"Content-Type":["application/json"],"Origin":["localhost:2019"],"User-Agent":["Go-http-client/1.1"]}}
Apr 3 14:04:00 USER caddy[31459]: {"level":"info","ts":1617426240.411902,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
Apr 3 14:04:00 USER caddy[31459]: {"level":"info","ts":1617426240.4121284,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc002b944d0"}
Apr 3 14:04:00 USER caddy[31459]: {"level":"info","ts":1617426240.4825945,"logger":"http","msg":"skipping automatic certificate management because one or more matching certificates are already loaded","domain":"<DOMAIN_WITH_MANUALLY_BOUGHT_CERTIFICATES>","server_name":"srv0"}
Apr 3 14:04:00 USER caddy[31459]: {"level":"info","ts":1617426240.4826496,"logger":"http","msg":"skipping automatic certificate management because one or more matching certificates are already loaded","domain":"<DOMAIN_WITH_MANUALLY_BOUGHT_CERTIFICATES>","server_name":"srv0"}
Apr 3 14:04:00 USER caddy[31459]: {"level":"info","ts":1617426240.4826708,"logger":"http","msg":"skipping automatic certificate management because one or more matching certificates are already loaded","domain":"<DOMAIN_WITH_MANUALLY_BOUGHT_CERTIFICATES>","server_name":"srv0"}
Apr 3 14:04:00 USER caddy[31459]: {"level":"info","ts":1617426240.482713,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Apr 3 14:04:02 USER caddy[31459]: {"level":"info","ts":1617426242.644434,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN", "DOMAIN"]}
Apr 3 14:04:03 USER caddy[31459]: {"level":"info","ts":1617426243.663937,"logger":"tls","msg":"cleaned up storage units"}
Apr 3 14:04:10 USER caddy[31459]: {"level":"error","ts":1617426250.4122725,"logger":"admin","msg":"stopping current admin endpoint","error":"shutting down admin server: context deadline exceeded"}
Apr 3 14:07:00 USER systemd[1]: caddy.service: Reload operation timed out. Killing reload process.
So IMHO maybe at the time of enabling automatic TLS cert management, because there are so many domains, even though they do not have to be renewed, caddy tried and took so much time, and timeoutā¦? just thinking.