feat: add LXC container support for local relay testing#884
Open
feat: add LXC container support for local relay testing#884
Conversation
Add cmdeploy "lxc-test" command to run cmdeploy against local containers, with supplementary lxc-start, lxc-stop and lxc-status subcommands. See doc/source/lxc.rst for full documentation including prerequisites, DNS setup, TLS handling, DNS-free testing, and known limitations. Apart from adding lxc-specific docs, tests, and implementation files in the cmdeploy/lxc directory, this PR adds the --ssh-config option to cmdeploy run/dns/status/test commands and pyinfra invocations, and also to sshexec (Execnet) handling. This allows for the host to need no DNS entries for a relay, and route all resolution through ssh-config. This is used by the "lxc-test" command, which performs a completely local setup -- again, see docs for more details. While working on DNS/SSH things i also unified all zone-file handling to use actual BIND format as it is easy enough to parse back.
link2xt
reviewed
Mar 6, 2026
| line = raw_line.strip() | ||
| if not line or line.startswith(";"): | ||
| continue | ||
| parts = line.split(None, 4) |
Contributor
There was a problem hiding this comment.
try:
name, ttl, _in, type, rdata = line.split(None, 4)
except ValueError:
raise ValueError(f"Bad zone record line")
name = name.rstrip(".")
yield name, ttl, type.upper(), rdata
link2xt
reviewed
Mar 6, 2026
| ``chatmail-turn`` discovers its listen addresses by enumerating globally routable IPs but | ||
| LXC containers only have private RFC 1918 addresses (``10.x.x.x``), | ||
| so the address list is empty and the server exits immediately. | ||
| `PR #11 on chatmail-turn <https://github.com/chatmail/chatmail-turn/pull/11>`_ |
Contributor
There was a problem hiding this comment.
It is merged, so we probably only need to tag a release there (CI builds the binaries) and then it can be updated to remove this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add cmdeploy "lxc-test" command to run cmdeploy against local containers, with supplementary lxc-start, lxc-stop and lxc-status subcommands.
See doc/source/lxc.rst for full documentation including prerequisites, DNS setup, TLS handling, DNS-free testing, and known limitations. I also pre-rendered it here: https://merlinux.eu/tmp/lx/lxc.html
Apart from adding lxc-specific docs, tests, and implementation files in the cmdeploy/lxc directory, this PR adds the --ssh-config option to cmdeploy run/dns/status/test commands and pyinfra invocations, and also to sshexec (Execnet) handling. This allows for the host to need no DNS entries for a relay, and route all resolution through ssh-config. This is used by the "lxc-test" command, which performs a completely local setup -- again, see docs for more details.
Some utilities for reading "deploy version" via git etc were centralized in the cmdeploy/utils.py file of helpers so that both lxc and non-lxc code can use it uniformly.
While working on DNS/SSH things i also unified all zone-file handling to use actual BIND format as it is easy enough to parse back.
related PRS:
chatmail/core#7926 to let core tests run against local lxc containers.
chatmail/chatmail-turn#11 to make chatmail-turn work in lxc containers
disclaimer: several rounds of LLM code/text generation were interweaved with manual editing and constraining/refactoring prompts during the work on this PR. I reviewed and tested changes multiple times, and eventually did several edits/refactorings by hand before asking for review.