No description
  • Python 34%
  • Go 26.4%
  • Shell 21.9%
  • Nix 12.2%
  • Makefile 4%
  • Other 1.5%
Find a file
comonad 0dbe610570
feat(make): add compose down/logs/ps wrappers for the mirror stack
The mirror stack only had up targets; add down/logs/ps for the bare
(local dev) compose plus the -siyuan/-zhiyuan site variants, and
g-storage-down to complete the g-storage lifecycle set. Volumes are
never removed.
2026-08-01 21:30:09 +08:00
.github refactor!: migrate to nix-snapshotter 2026-08-01 01:55:29 +08:00
caddy fix(loaders): realise the image's store paths before loading 2026-08-01 21:26:01 +08:00
caddy-gen fix(caddy-gen): spoof Host header for admin-API metrics proxy 2026-08-01 06:19:52 +08:00
clash fix(clash): add entrypoint so compose command appends 2026-08-01 04:08:46 +08:00
common refactor!: migrate to nix-snapshotter 2026-08-01 01:55:29 +08:00
data lug: upgrade to 0.12.5 (#116) 2021-01-04 10:56:09 +08:00
docs chore(ci): manage all deps with Nix flakes (#527) 2025-09-27 00:07:13 +08:00
frontend@aa45be5403 bump: update frontend 2026-06-24 05:11:17 +08:00
gateway-gen chore: add fail-on-change checks for caddy-gen/gateway-gen 2026-07-25 05:22:28 +08:00
git-backend fix(images): ship CA certificates for TLS 2026-08-01 04:41:21 +08:00
integration-test chore(nix): bump flake inputs; register Python projects as workspace members 2026-07-25 05:22:21 +08:00
lug fix(images): ship CA certificates for TLS 2026-08-01 04:41:21 +08:00
mirror-intel fix(images): ship CA certificates for TLS 2026-08-01 04:41:21 +08:00
monitor/g-storage docs(g-storage): document mihomo egress dependency and rule 2026-08-01 06:11:18 +08:00
rsync-gateway fix(images): ship CA certificates for TLS 2026-08-01 04:41:21 +08:00
rsyncd fix(images): ship CA certificates for TLS 2026-08-01 04:41:21 +08:00
scripts fix(secrets): decrypt with the host SSH key as age identity 2026-08-01 03:32:35 +08:00
secrets fix(sops): use SSH public keys as age recipients, not age1 conversions 2026-08-01 03:40:44 +08:00
.autocorrectrc chore(ci): manage all deps with Nix flakes (#527) 2025-09-27 00:07:13 +08:00
.editorconfig chore(ci): manage all deps with Nix flakes (#527) 2025-09-27 00:07:13 +08:00
.envrc chore(nix): load substituter with nixConfig 2026-07-26 04:35:15 +08:00
.gitignore feat(g-storage): integrate SOPS-encrypted host secrets 2026-08-01 05:02:52 +08:00
.gitmodules caddy: new frontend (#471) 2024-06-12 04:40:51 +08:00
.go-version refactor(git-backend): build image from Nix flake 2026-07-26 03:56:19 +08:00
.python-version chore(nix): bump flake inputs; register Python projects as workspace members 2026-07-25 05:22:21 +08:00
.sops.yaml fix(sops): use SSH public keys as age recipients, not age1 conversions 2026-08-01 03:40:44 +08:00
config.siyuan.yaml feat(lug): init git/flake-parts.git 2026-07-26 04:48:23 +08:00
config.zhiyuan.yaml lug(linuxliteos): exclude torrents 2026-06-24 05:11:17 +08:00
docker-compose.siyuan.yml fix(xray): run xtls image as root to read 0600 rendered config 2026-08-01 05:43:39 +08:00
docker-compose.yml feat(monitor): ship Caddy access logs to g-storage Loki via unified tunnel 2026-08-01 02:50:50 +08:00
docker-compose.zhiyuan.yml fix(xray): run xtls image as root to read 0600 rendered config 2026-08-01 05:43:39 +08:00
flake.lock refactor!: migrate to nix-snapshotter 2026-08-01 01:55:29 +08:00
flake.nix fix(loaders): realise the image's store paths before loading 2026-08-01 21:26:01 +08:00
frontend-image.nix fix(images): ship CA certificates for TLS 2026-08-01 04:41:21 +08:00
LICENSE add README 2020-11-02 23:00:21 +08:00
MAINTENANCE.md docs(maintenance): pin host toolchain; document sops 3.13.2 MAC bug 2026-08-01 03:49:47 +08:00
Makefile feat(make): add compose down/logs/ps wrappers for the mirror stack 2026-08-01 21:30:09 +08:00
PLAN.md refactor!: migrate to nix-snapshotter 2026-08-01 01:55:29 +08:00
postgresql.siyuan.conf lug: rsync-sjtug v4 (#409) 2023-08-22 06:45:16 +08:00
postgresql.zhiyuan.conf lug: rsync-sjtug v4 (#409) 2023-08-22 06:45:16 +08:00
pyproject.toml chore: add fail-on-change checks for caddy-gen/gateway-gen 2026-07-25 05:22:28 +08:00
README.md refactor!: migrate to nix-snapshotter 2026-08-01 01:55:29 +08:00
uv.lock chore: add fail-on-change checks for caddy-gen/gateway-gen 2026-07-25 05:22:28 +08:00

mirror-docker-unified

Nix-flake orchestration for all SJTUG mirror servers.

Docs

New Architecture

For more information, refer to our Wiki.

Container runtime

The Compose stack targets rootful containerd through nerdctl compose. Install nerdctl 2.3.1 or later and run BuildKit with its containerd worker. The root services must expose /run/containerd/containerd.sock and /run/buildkit/buildkitd.sock. The Makefile passes nerdctl's absolute path to sudo:

make up-siyuan
make up-zhiyuan

Site deployments render ignored plaintext files under ./secrets/rendered/ from the SOPS-backed ./secrets/siyuan/ or ./secrets/zhiyuan/ directory before running Compose. Use make secrets-siyuan or make secrets-zhiyuan to refresh those files without starting containers.

nerdctl 2.3.1 does not translate Compose's memswap_limit or the Zhiyuan device_read_bps/device_read_iops limits. The fields remain in the files for the Docker fallback, but rootful containerd does not enforce them.

Native Nix images

The mirror stack runs natively from Nix images (caddy, git-backend, rsyncd, clash, mirror-intel, rsync-gateway, frontend, lug) on hosts using nix-snapshotter. Build and load their OCI manifests into the rootful containerd mirror namespace with:

make nix-images
make nix-images-load
make nix-images-verify

After loading the images, start all services on one site with:

make nix-up-siyuan
# or
make nix-up-zhiyuan

These targets run the stack from Nix images with --no-build --pull never. The host must have the nix snapshotter registered with rootful containerd before running them.

The legacy logspout service needs the Docker Engine API and is therefore disabled by default (gated behind the docker-engine profile). Under the nerdctl-only runtime there is no Docker socket to attach to; logspout is retained only as a reference and is not started in production.

Project structure & maintenance

.
├── apache # apache dockerfile
├── caddy
├── caddy-gen # caddy configuration generator (for ./caddy)
├── clash # clash dockerfile (for secured connection with monitor node)
├── common # common network configuration
├── data # caddy & lug backend dist
├── docs # Documentation
├── frontend # lug frontend (Next.js)
├── gateway-gen # rsync-sjtug configuration generator (for ./rsync-gateway)
├── git-backend # git backend
├── integration-test # test
├── lug # lug backend dockerfile
├── mirror-intel # mirror-intel configuration
├── monitor/g-storage # g-storage Prometheus, Grafana, and alerting stack
├── rsync-gateway
├── rsyncd
├── scripts
├── secrets # SOPS-encrypted source secrets and ignored rendered runtime secrets
└── upstream

Python version, treefmt, pre-commit configurations are controlled by flake.nix (flake-parts, treefmt-nix, pre-commit-hooks) with Nix flakes.

See https://nixos.org/download/ or https://lix.systems/install/ for Nix installation manual.

License

Apache 2.0