Skip to content

WIP: feat: Add DockerDriver for deploying chatmail relays via Docker Compose inside LXC - #37

Draft
j4n wants to merge 17 commits into
j4n/incus-container-hardeningfrom
j4n/docker-driver
Draft

WIP: feat: Add DockerDriver for deploying chatmail relays via Docker Compose inside LXC#37
j4n wants to merge 17 commits into
j4n/incus-container-hardeningfrom
j4n/docker-driver

Conversation

@j4n

@j4n j4n commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Supersedes #6 as a combined PR.

Add DockerDriver for deploying chatmail relays via Docker Compose inside LXC containers (Docker-in-LXC with security.nesting).

Features:

  • Pull pre-built images from GHCR (--source ghcr:TAG)
  • Inject local builds
  • Healthcheck polling / log streaming
  • SSH forwarding into Docker containers (for test compatibility)
  • DNS zone extraction and PowerDNS loading
  • security.privileged fenced behind CI=true

CLI subcommands: deploy, pull, logs, ps, shell

@j4n
j4n changed the base branch from main to j4n/docker-driver-prereqs August 3, 2026 15:07
@j4n j4n self-assigned this Aug 3, 2026
@j4n
j4n marked this pull request as draft August 3, 2026 15:12
@j4n
j4n force-pushed the j4n/docker-driver branch from e417654 to bec45fb Compare August 3, 2026 15:22
@j4n
j4n marked this pull request as ready for review August 3, 2026 15:22
@j4n j4n changed the title Add DockerDriver for deploying chatmail relays via Docker Compose inside LXC containers and CI support. Add DockerDriver for deploying chatmail relays via Docker Compose inside LXC Aug 3, 2026
@j4n
j4n marked this pull request as draft August 3, 2026 15:29
@j4n
j4n force-pushed the j4n/docker-driver-prereqs branch from e706ea1 to 68f7425 Compare August 5, 2026 10:32
@j4n
j4n force-pushed the j4n/docker-driver branch 2 times, most recently from c976c53 to 7cd8076 Compare August 5, 2026 11:44
@j4n
j4n force-pushed the j4n/docker-driver-prereqs branch from 68f7425 to c652452 Compare August 5, 2026 11:57
@j4n
j4n force-pushed the j4n/docker-driver branch 2 times, most recently from e4d54c6 to 3e8fb06 Compare August 5, 2026 12:18
@j4n
j4n marked this pull request as ready for review August 5, 2026 12:38
@j4n j4n changed the title Add DockerDriver for deploying chatmail relays via Docker Compose inside LXC feat: Add DockerDriver for deploying chatmail relays via Docker Compose inside LXC Aug 5, 2026
@j4n
j4n force-pushed the j4n/docker-driver-prereqs branch from c652452 to 05c62e8 Compare August 6, 2026 06:07
@j4n
j4n force-pushed the j4n/docker-driver branch 2 times, most recently from ef304d6 to 966b5be Compare August 6, 2026 07:43
@j4n
j4n force-pushed the j4n/docker-driver-prereqs branch from 05c62e8 to 628634a Compare August 6, 2026 11:23
@j4n
j4n force-pushed the j4n/docker-driver branch from 05a3c7f to 31246e2 Compare August 6, 2026 11:23
@j4n
j4n force-pushed the j4n/docker-driver-prereqs branch from 628634a to eaf84ed Compare August 6, 2026 11:35
@j4n
j4n force-pushed the j4n/docker-driver branch 2 times, most recently from 97d7e54 to 904a895 Compare August 11, 2026 10:39
@j4n
j4n force-pushed the j4n/docker-driver-prereqs branch from eaf84ed to 0836f27 Compare August 11, 2026 10:39
@hpk42
hpk42 force-pushed the j4n/docker-driver-prereqs branch from 0836f27 to 553a878 Compare August 11, 2026 12:36
@hpk42
hpk42 force-pushed the j4n/docker-driver branch from 904a895 to faa68f4 Compare August 11, 2026 12:36
@hpk42
hpk42 force-pushed the j4n/docker-driver-prereqs branch from 553a878 to d972f27 Compare August 11, 2026 12:53
@hpk42
hpk42 force-pushed the j4n/docker-driver branch from faa68f4 to 18a0dad Compare August 11, 2026 12:53
@j4n
j4n force-pushed the j4n/docker-driver branch from 18a0dad to b2b46bf Compare August 12, 2026 07:04
@j4n
j4n force-pushed the j4n/docker-driver-prereqs branch from d972f27 to 73fb9df Compare August 12, 2026 07:04
@j4n
j4n force-pushed the j4n/docker-driver branch from b2b46bf to fca3116 Compare August 13, 2026 16:03
@j4n
j4n changed the base branch from j4n/docker-driver-prereqs to j4n/incus-container-hardening August 13, 2026 16:03
@j4n
j4n changed the base branch from j4n/incus-container-hardening to j4n/nightly-matrix August 13, 2026 16:04
@j4n
j4n changed the base branch from j4n/nightly-matrix to j4n/incus-container-hardening August 13, 2026 16:04
@j4n
j4n marked this pull request as draft August 13, 2026 16:04
@j4n
j4n force-pushed the j4n/docker-driver branch from fca3116 to ce9f3c1 Compare August 13, 2026 17:06
@j4n j4n changed the title feat: Add DockerDriver for deploying chatmail relays via Docker Compose inside LXC WIP: feat: Add DockerDriver for deploying chatmail relays via Docker Compose inside LXC Aug 19, 2026
@j4n
j4n force-pushed the j4n/incus-container-hardening branch from ea8d2c2 to 87c42da Compare August 31, 2026 15:52
j4n added 16 commits August 31, 2026 17:53
Containers with Docker or other networking can expose IPs on multiple
interfaces. Extend _extract_ip() to accepts an optional subnet filter and add
bridge_subnet() to get the bridge subnet so wait_ready() and list_managed()
only pick addresses on incusbr0.
Move the initialization check (DNS container running + base image
present) from cli._check_init() into Incus.check_init() so
drivers can call it without depending on the CLI module.
…ure()

Allows drivers to pass additional Incus config keys (e.g.
security.nesting=true for Docker-in-LXC) when launching containers.
Passed through Container and RelayContainer.
When the source ref is a full 40-char SHA, e.g., from CI dispatch,
the shallow git-main clone won't have it. Detect this case and
fetch just that commit with --depth 1 before checkout.
The `git reset --hard origin/{ref}` is only useful for branch refs,
for SHA refs it always fails silently since there's no remote tracking branch.
Only run it for branch refs.
…nit_relay

Extract the cmdeploy test logic into a standalone run_test_cmdeploy() so
any cmdeploy-based driver can call it, not just CmdeployDriver.
…ript

Both the cmdeploy and docker drivers need to generate chatmail.ini with
relaxed rate limits for testing. Extract the overrides dict and the
Python snippet builder into shared helpers.
Two wrappers for Container.bash() with and without failure checking.
Add DockerDriver for deploying chatmail relays via Docker Compose
inside LXC containers (Docker-in-LXC with security.nesting).

Features:
- Pull pre-built images from GHCR (--source ghcr:TAG)
- Inject local builds
- Healthcheck polling / log streaming
- SSH forwarding into Docker containers (for test compatibility)
- DNS zone extraction and PowerDNS loading
- security.privileged fenced behind CI=true

CLI subcommands: deploy, pull, logs, ps, shell
- Register DockerDriver in DRIVER_BY_NAME
- test-cmdeploy: dispatch to driver class from container metadata
- Fix _print_builder_repos to use driver REPO_NAME (avoids dupes)
Cache a localchat-docker image (Docker images stripped before export)
and dump per-service Docker diagnostics when a run fails.

AppArmor is not touched here: callers that need Docker-in-LXC systemd
disable it from their own cmlxc_commands, so the shared workflow stays
neutral for every other consumer.
@j4n
j4n force-pushed the j4n/docker-driver branch from ce9f3c1 to 6b2c2ad Compare August 31, 2026 15:56
We previously set iptables:false which was fine for host-mode networking Docker
containers, bridge-mode docker-compose.yaml needs Docker's NAT, so remove the config.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant