公开的 Nix 容器镜像
openEduSuite 的基础设施镜像不再依赖上游 registry;每个镜像都以可复现的 Nix 构建形式提供。每个镜像从源码确定性推导,逐字节可复现,并可完全离线运行,这是气隙运行的大学集群的基本要求。
镜像家族
所有镜像遵循相同的模式:扁平的多层 OCI 容器(dockerTools.buildLayeredImage),由对应上游项目的固定 Nix 构建生成。没有发行版基础层,没有不受控的软件包列表;只有 Nix store 布局所提供的二进制文件和库。
| 镜像 | 替代 | 版本 | 用途 |
|---|---|---|---|
dex |
ghcr.io/dexidp/dex |
2.38.0-nix | OIDC/OAuth2 身份提供商(ArgoCD SSO) |
helmfile |
ghcr.io/helmfile/helmfile |
1.8.0-nix | ArgoCD CMP sidecar 的 Helmfile 渲染器 |
k8up |
ghcr.io/k8up-io/k8up |
2.13.1-nix | Kubernetes 备份操作器(Restic) |
cloudnative-pg |
ghcr.io/cloudnative-pg/cloudnative-pg |
1.30.1-nix | Postgres 操作器;向每个数据库 Pod 注入实例管理器 |
postgresql |
ghcr.io/cloudnative-pg/postgresql |
16.15-nix | 兼容 CNPG 的 PostgreSQL 16(UID 26、/controller 布局、barman-cloud) |
agentflow |
——(taskfleet 的后继者) | 0.1.0-nix | DAG 编排的编码代理战役(af) |
获取途径
公共主镜像库(registry.openedusuite.org)
完整且可公开访问的镜像家族位于本项目的公共 OCI 镜像库上(Zot,置于 Traefik 之后,使用 Let's Encrypt 证书):
https://registry.openedusuite.org/dex:2.38.0-nix
https://registry.openedusuite.org/helmfile:1.8.0-nix
https://registry.openedusuite.org/k8up:2.13.1-nix
https://registry.openedusuite.org/cloudnative-pg:1.30.1-nix
https://registry.openedusuite.org/postgresql:16.15-nix
https://registry.openedusuite.org/agentflow:0.1.0-nix
拉取无需认证;仅推送受访问控制:
$ docker pull registry.openedusuite.org/k8up:2.13.1-nix
GHCR(公共镜像库,规划中)
相同的镜像还将发布到 ghcr.io/tobias-weiss-ai-xr/…(可见性与冗余)。状态:GHCR 的推送正等待具有 Packages: write 权限的令牌。
ghcr.io/tobias-weiss-ai-xr/dex:2.38.0-nix
ghcr.io/tobias-weiss-ai-xr/helmfile:1.8.0-nix
ghcr.io/tobias-weiss-ai-xr/k8up:2.13.1-nix
ghcr.io/tobias-weiss-ai-xr/cloudnative-pg:1.30.1-nix
ghcr.io/tobias-weiss-ai-xr/postgresql:16.15-nix
ghcr.io/tobias-weiss-ai-xr/agentflow:0.1.0-nix
镜像库:Zot(集群内部)
气隙(air-gap)目标环境会将同一镜像家族镜像到本地 Zot registry 节点上,该节点同时充当拉取透传缓存(示例使用 RFC 5737 文档专用地址):
192.0.2.10:5002/opendesk-nix/<name>:<tag>
k3s registry 镜像配置将所有 ghcr.io 拉取重定向到 Zot;即使外部出口中断,集群也能自给自足。
为什么选择 Nix?
- 可复现性。 镜像是 Nix flake 输入的函数。同一修订版的两次构建产生相同的 store 路径,因此也产生相同的镜像摘要。
- 以构造方式实现最小化。 Nix 镜像只包含 store 提供的内容:上游 Go 二进制文件、CA 证书、
tzdata。没有包管理器,也不含多余的 shell。 - 离线运行。 构建可以通过 nix copy closure 离线重建;Zot 镜像库使集群与外部 registry 解耦。
- 可审计性。 推导(derivation)就是 SBOM:每个依赖项都可以从 store 路径中读取(
/nix/store/…-k8up-2.13.1)。
自行构建
推导文件位于 openEduSuite-hrz 仓库的 nix/images/infra/ 目录下:
$ nix build .#k8up
$ skopeo copy --dest-tls-verify=false --format oci \
docker-archive:result \
docker://ghcr.io/tobias-weiss-ai-xr/k8up:2.13.1-nix
flake 通过 flake.lock 固定 nixpkgs;Go 模块哈希(vendorHash)和源码哈希均按推导固定。
CNPG 兼容性说明
PostgreSQL 镜像满足 CloudNativePG 操作器的契约要求:UID/GID 26、/controller 作为工作目录、/var/run/postgresql 作为套接字目录,以及用于备份路径的 barman-cloud。实例管理器(与上游一样)并不内置在镜像中;操作器通过 bootstrap-controller 初始化容器注入它。因此操作器镜像在两个位置都包含该二进制文件(/manager 和 /controller/instance-manager)。
展望
镜像家族将随着套件需求而增长:应用镜像(Intercom、Stalwart 分支、SOGo)将紧随其后走同样的 Nix 之路。目标始终不变:一个无需从外部 registry 执行任何一条命令式 docker pull 的集群。