feat(deploy): prepare the LXD host for the isolated runner and labs
This commit is contained in:
1 parent
63e6b41bec
commit
56dcf32f8c
4 files changed
+152
No files matched your search
@@ -710,6 +710,31 @@ When the local resolver does not return the public address, add `--resolve <doma
|
||||
|
||||
This is one edge host and one app host. There is no failover, no external uptime check, and no rate limiting at the edge (the frontend container applies coarse per-client limits, and the backend domain quotas are separate and not implemented yet). The certificate covers only the one name, the site is IPv4 only, and the ACME account has no contact address. The tunnel carries no authentication beyond the AmneziaWG keys, and the obfuscation parameters raise the cost of blocking but are not a security control.
|
||||
|
||||
## Isolated runner and lab host (LXD)
|
||||
|
||||
The code runner and the practical labs run as LXD virtual machines on the app host, outside the Docker stack. The layout is in `deploy/labs/`: `lxd-preseed.yaml` (storage pool, bridges, profiles) and `acls.sh` (network ACLs). Apply it once, as a member of the `lxd` group:
|
||||
|
||||
```bash
|
||||
bash deploy/labs/acls.sh
|
||||
```
|
||||
|
||||
```bash
|
||||
lxd init --preseed < deploy/labs/lxd-preseed.yaml
|
||||
```
|
||||
|
||||
What it creates:
|
||||
|
||||
- Storage pool `lincodex`: btrfs in a 40 GiB loop file, so lab nodes are cloned from prepared snapshots in seconds.
|
||||
- Bridge `lxdbr-runner` (`10.80.0.1/24`) for the runner VM and bridge `lxdbr-labmgmt` (`10.81.0.1/24`) for the lab management plane. Both have no NAT, no DHCP and no DNS (`ipv4.dhcp=false`, `raw.dnsmasq: port=0`): the provisioner gives guests static addresses through cloud-init, so a guest has nothing to send towards the host.
|
||||
- Network ACLs with default ingress and egress `drop`. `lincodex-runner` lets only the app network (`172.29.79.0/24`, matched before Docker masquerades it) and the host side of the bridge open TCP 8443; the token on the runner API authorizes the caller. `lincodex-labmgmt` lets only the host side open SSH and the RouterOS API (22, 8728, 8729) to the nodes. Guests can start no connection at all.
|
||||
- Profiles `lincodex-runner` (2 vCPU, 3 GiB, 10 GiB disk) and `lincodex-lab-small` (1 vCPU, 768 MiB, 4 GiB disk). For a VM the memory limit is the guest RAM, so it cannot be exceeded.
|
||||
|
||||
The `lxd` group is equivalent to root on the host. Only the lab provisioner and the operator use it; the backend and the other containers never get the LXD socket.
|
||||
|
||||
Verified on the app host (TASK-592): from a guest on `lxdbr-runner` the internet, the host SSH, the bridge address, the app network and the LAN router are unreachable; from the app network only TCP 8443 of the guest is reachable; a VM with the lab profile boots under nested KVM and sees one CPU and about 700 MiB. The host `ufw` denies incoming traffic by default, which also blocks DHCP to the bridges; static addressing avoids opening it.
|
||||
|
||||
Cleanup before the rollout removed only the Docker build cache (`docker builder prune -af`, about 8 GB). `apt-get clean` and `journalctl --vacuum-size=100M` need sudo and are left to the operator. Docker volumes, the images of the running stack, `wg0`, `awg-lincodex` and the `ufw` rules are not touched.
|
||||
|
||||
## Services and images
|
||||
|
||||
Container images use moving `latest` or `alpine` tags where the upstream publishes them. Check the current Compose references when updating the stack. These tags can move; the [release manifest](#release-manifest) records the actual image digests of a release. An SBOM is not produced yet. Application dependency lockfiles remain checked in separately.
|
||||
|
||||
Reference in new issue
Block a user