Xamal.Commands.Caddy (xamal v0.3.1)

Copy Markdown View Source

Caddy install, config generation, reload, and management commands.

Summary

Functions

Check if Caddy is installed.

Replace /etc/caddy/Caddyfile with an import directive so Caddy picks up service Caddyfiles on reboot.

Install Caddy via apt on Debian/Ubuntu.

Get Caddy proxy logs via journalctl. Options: lines (default 100), since, grep, follow.

Read the active port from the active_port file.

Reload Caddy configuration (graceful - drains existing connections).

Start Caddy with the service Caddyfile.

Check Caddy status.

Stop Caddy.

Write the active port to the active_port file.

Write a Caddyfile to the service directory.

Write a maintenance mode Caddyfile.

Functions

check_installed()

Check if Caddy is installed.

configure_system_caddyfile()

Replace /etc/caddy/Caddyfile with an import directive so Caddy picks up service Caddyfiles on reboot.

install()

Install Caddy via apt on Debian/Ubuntu.

logs(opts \\ [])

Get Caddy proxy logs via journalctl. Options: lines (default 100), since, grep, follow.

read_active_port(config)

Read the active port from the active_port file.

reload(config)

Reload Caddy configuration (graceful - drains existing connections).

start(config)

Start Caddy with the service Caddyfile.

status()

Check Caddy status.

stop()

Stop Caddy.

write_active_port(config, port)

Write the active port to the active_port file.

write_caddyfile(config, upstream_port)

Write a Caddyfile to the service directory.

write_maintenance_caddyfile(config)

Write a maintenance mode Caddyfile.