Add remote Caddy support — generate snippet files when Caddy is on another host

New site config key: CADDY_REMOTE_HOST (set via 'sudo ./setup.sh configure').
When set, configure_caddy_for_service operates in "remote" mode instead of
writing to a local Caddyfile:
- Upstream uses CADDY_REMOTE_HOST:PORT (host IP, not container name)
- Snippet saved to ~/docker/caddy-snippets/<subdomain>.caddy
- User is shown scp/rsync commands to copy it to the Caddy machine

Three modes in configure_caddy_for_service (lib/common.sh and inline stubs):
  local:  ~/docker/caddy/ exists → write Caddyfile + reload (existing behavior)
  remote: CADDY_REMOTE_HOST set → save snippet, print copy instructions
  none:   neither configured → silent return (unchanged)

All 31 service standalone bootstrap stubs updated with the new logic.
CADDY_REMOTE_HOST global added to all 42 standalone bootstrap sections.
setup.sh configure now prompts for CADDY_REMOTE_HOST with a clear explanation.
wolf.sh: add missing stubs (configure_caddy_for_service, write_readme,
  prompt_yn, ensure_docker_dir_ownership) and the Authelia/Caddy/start calls
  that were missing from the install function.

https://claude.ai/code/session_014CCYqVwW6d6f5dw1qRokYt
This commit is contained in:
Claude
2026-06-08 21:10:37 +00:00
parent 6498ee1f7b
commit d4e06914e7
44 changed files with 2482 additions and 1177 deletions
+10 -1
View File
@@ -121,10 +121,19 @@ run_site_configure() {
local _cur_tz="${SITE_TZ:-$_sys_tz}"
local _cur_dom="${SITE_DOMAIN:-}"
local _cur_net="${SITE_CADDY_NET:-caddy_net}"
local _cur_caddy_host="${CADDY_REMOTE_HOST:-}"
prompt_text " Timezone [${_cur_tz}]:" "$_cur_tz" SITE_TZ
prompt_text " Base domain (e.g., example.com) [${_cur_dom:-<not set>}]:" "$_cur_dom" SITE_DOMAIN
prompt_text " Caddy Docker network [${_cur_net}]:" "$_cur_net" SITE_CADDY_NET
export SITE_TZ SITE_DOMAIN SITE_CADDY_NET
echo ""
echo " Caddy location: leave blank if Caddy runs on THIS machine (default)."
echo " Set to this machine's LAN IP or hostname if Caddy runs on a DIFFERENT"
echo " machine — service installers will generate snippet files to copy over."
prompt_text " Caddy remote host (LAN IP/hostname) [${_cur_caddy_host:-<this machine>}]:" "$_cur_caddy_host" CADDY_REMOTE_HOST
export SITE_TZ SITE_DOMAIN SITE_CADDY_NET CADDY_REMOTE_HOST
mkdir -p "$DOCKER_DIR"
save_site_config
log_success "Saved to $DOCKER_DIR/.config"