Overview

Date: 2026-05-11

Time: 15:39

Overview

This is an FTL2 AI-loop rule that ensures Caddy reverse proxy is correctly configured on the stargate host, proxying stargate.catbeez18.com to localhost:8000. It follows the observe/condition/action pattern: observe system state, check if remediation is needed, then converge to the desired state. This rule was auto-generated by the ftl2-ai-loop system.

Usage Patterns

This rule is not called directly — it is loaded and executed by the FTL2 AI reconciliation loop. The loop evaluates it periodically or on trigger.

The file defines three top-level constructs:


# The condition receives observed state as a dict keyed by observation name
async def condition(state: dict) -> bool:
    caddyfile = state.get("caddyfile_content", {}).get("stdout", "")
    ...

# The action receives the ftl runtime for executing modules against hosts
async def action(ftl) -> None:
    await ftl["stargate"].copy(content=..., dest="/etc/caddy/Caddyfile", ...)

API and Configuration

Observations use the command module with cmd and host params. Each observation is named and its results appear in the state dict passed to condition().

Action modules used:

| Module | Purpose | Key Params |

|--------|---------|------------|

| copy | Deploy file content | content, dest, owner, group, mode |

| ansible.posix.firewalld | Manage firewall rules | service, permanent, immediate, state |

| service | Manage systemd services | name, state, enabled |

Host targeting: All operations target "stargate" via ftl["stargate"].

Expected Caddyfile content:


stargate.catbeez18.com {
	reverse_proxy localhost:8000
}

Key Behaviors

Relationships