Skip to content

Commit e09133f

Browse files
committed
docs: update build and CI docs for the CPM flow
- README drops the submodule bootstrap and `build.sh setup` for the trilogy. - ci-architecture documents the shared ~/.cache/moqx cache and how it is keyed. - release replaces the `.moxygen-release` tag file with the MOXYGEN_REV pin, so a release/* branch must freeze on a v*-tagged rev. - Repo paths are linked from the root so they resolve wherever they are rendered.
1 parent 68e3b83 commit e09133f

4 files changed

Lines changed: 124 additions & 97 deletions

File tree

README.md

Lines changed: 37 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
[![ci main](https://github.com/openmoq/moqx/actions/workflows/ci-main.yml/badge.svg)](https://github.com/openmoq/moqx/actions/workflows/ci-main.yml)
88
[![Latest release](https://img.shields.io/github/v/release/openmoq/moqx?display_name=tag&sort=semver&logo=github)](https://github.com/openmoq/moqx/releases/latest)
9-
[![License](https://img.shields.io/github/license/openmoq/moqx)](LICENSE)
9+
[![License](https://img.shields.io/github/license/openmoq/moqx)](/LICENSE)
1010
[![Last commit](https://img.shields.io/github/last-commit/openmoq/moqx)](https://github.com/openmoq/moqx/commits/main)
1111
[![Open issues](https://img.shields.io/github/issues/openmoq/moqx)](https://github.com/openmoq/moqx/issues)
1212
[![Open PRs](https://img.shields.io/github/issues-pr/openmoq/moqx)](https://github.com/openmoq/moqx/pulls)
@@ -22,66 +22,55 @@ The OpenMOQ Relay — a MoQT relay server based on
2222

2323
## Architecture
2424

25-
For the underlying moxygen library architecture (session model, data plane,
26-
threading, transport abstraction), see
27-
[deps/moxygen/ARCHITECTURE.md](deps/moxygen/ARCHITECTURE.md).
25+
`MoqxRelay` is a hard fork of moxygen's
26+
[`MoQRelay`](https://github.com/openmoq/moxygen/blob/main/moxygen/relay/MoQRelay.h),
27+
so the relay core can evolve independently while the lower-level moxygen pieces
28+
stay libraries:
2829

29-
`MoqxRelay` is a hard fork of moxygen's `MoQRelay`. We copy the relay core into
30-
moqx so we can evolve it independently (threading model, custom cache miss
31-
handling, chained caches, etc.) while still using moxygen's lower-level
32-
building blocks as libraries:
30+
- **MoQForwarder** — fan-out engine
31+
- **MoqxCache** — object cache
32+
- **MoQSession / MoQServer / MoQRelaySession** — session/server infrastructure.
3333

34-
- **MoQForwarder** — fan-out engine, used as-is from moxygen for now. May need
35-
to fork in the future to accommodate threading model differences.
36-
- **MoqxCache** — object cache, hard-forked from moxygen. Customizable for moqx-specific functionality.
37-
and chained cache support may be upstreamed to openmoq/moxygen or maintained
38-
in our fork.
39-
- **MoQSession / MoQServer / MoQRelaySession** — session and server
40-
infrastructure, used as libraries.
34+
`MoqxRelayServer` extends `MoQServer` to wire `MoqxRelay` in as the
35+
publish/subscribe handler. For moxygen's own architecture, see its
36+
[ARCHITECTURE.md](https://github.com/openmoq/moxygen/blob/main/ARCHITECTURE.md).
4137

42-
`MoqxRelayServer` extends `MoQServer` to wire up `MoqxRelay` as the publish/subscribe
43-
handler and create `MoQRelaySession` instances for incoming connections.
38+
## Quick Start
4439

45-
## Documentation
40+
Standard CMake preset build (CMake 3.23+, C++20, Ninja).
4641

47-
- [docs/metrics.md](docs/metrics.md) — Prometheus metrics reference
42+
```bash
43+
scripts/install-system-deps.sh # toolchain + system libs
44+
scripts/configure.sh --moxygen prebuilt-with-fallback # get a moxygen, configure
45+
scripts/build.sh # cmake --build build/default
46+
scripts/test.sh # ctest over build/default
47+
```
4848

49-
## Design Documents
49+
`build.sh` and `test.sh` are thin wrappers that add a job count derived from
50+
cores and free RAM ([/scripts/lib/jobs.sh](/scripts/lib/jobs.sh)).
5051

51-
- [design/ci-architecture.md](design/ci-architecture.md) — CI pipelines, upstream sync, auto-deploy
52-
- [design/configuration.md](design/configuration.md) — relay config file reference
53-
- [design/gummy-bear.md](design/gummy-bear.md) — cache and forwarding design
54-
- [design/hot-reloading.md](design/hot-reloading.md) — hot config reload
55-
- [design/miss-handler.md](design/miss-handler.md) — cache miss handling
52+
Profiles (`default` | `san` | `tsan`) are each script's first argument and map to
53+
`build/<profile>`. `--moxygen` picks where moxygen comes from:
5654

57-
## Quick Start
55+
| Goal | Command |
56+
|------|---------|
57+
| Build it | `scripts/configure.sh --moxygen prebuilt-with-fallback && scripts/build.sh` |
58+
| Download only, never compile moxygen | `scripts/configure.sh --moxygen prebuilt && scripts/build.sh` |
59+
| Compile moxygen / any rev or platform | `scripts/configure.sh --moxygen from-source && scripts/build.sh` |
60+
| Local moxygen checkout | `scripts/configure.sh --moxygen from-source --moxygen-dir /path && scripts/build.sh` |
5861

59-
> **Prerequisite: CMake 3.22+ is required.** All current targets ship a
60-
> new-enough version out of the box: Ubuntu 22.04+, Debian 12+, recent
61-
> macOS Homebrew. Verify with `cmake --version`. `build.sh` aborts early
62-
> if cmake is missing or too old (override with `MOQX_SKIP_CMAKE_CHECK=1`
63-
> if you know what you're doing).
62+
The three modes, the raw-cmake equivalents, and how to pick:
63+
[/BUILD.md](/BUILD.md#how-dependencies-work).
6464

65-
```bash
66-
git clone https://github.com/openmoq/moqx.git && cd moqx
67-
git submodule update --init --recursive
68-
sudo deps/moxygen/standalone/install-system-deps.sh # system libs (both modes)
65+
Pins live in [/cmake/dependencies.cmake](/cmake/dependencies.cmake).
6966

70-
./scripts/build.sh setup # download prebuilt deps (~1 min)
71-
./scripts/build.sh # build
72-
./scripts/build.sh test # test
73-
```
67+
`ccache` is used automatically when it is on `PATH`.
7468

75-
System libraries are needed in **both** dependency modes — the moxygen
76-
tarball ships folly/fizz/mvfst/proxygen statically, but its CMake config
77-
still does `find_dependency(fmt, Glog, ...)` and folly itself transitively
78-
needs OpenSSL/Boost. `build.sh setup`'s system-dep check only fires when
79-
falling back to source, but the build step needs the libs regardless.
69+
## Docs
8070

81-
See [BUILD.md](BUILD.md) for full build and test instructions (dependency
82-
modes, sanitizer profiles, Docker), and [RUNNING.md](RUNNING.md) for relay
83-
operations.
71+
- Build [/BUILD.md](/BUILD.md) · Run [/RUNNING.md](/RUNNING.md) · Metrics [/docs/metrics.md](/docs/metrics.md)
72+
- Design: [/design/](/design)
8473

8574
## License
8675

87-
Apache 2.0 — see [LICENSE](LICENSE).
76+
Apache 2.0 — see [/LICENSE](/LICENSE).

docs/ci-architecture.md

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# CI and Automation
22

3-
This document describes the CI pipelines, upstream sync, submodule management,
4-
artifact publishing, and relay deployment across the openmoq organization.
3+
This document describes the CI pipelines, upstream sync, dependency-revision
4+
management, artifact publishing, and relay deployment across the openmoq
5+
organization.
56

67
## Cross-Repo Dependency
78

@@ -12,7 +13,7 @@ artifact publishing, and relay deployment across the openmoq organization.
1213
│ ci main ──► snapshot-latest release (tarballs, all platforms)
1314
│ │ │
1415
└─────────────────────────┼───────────────────────────────────┘
15-
submodule SHA pins which tarball
16+
MOXYGEN_REV (cmake/dependencies.cmake) pins the rev
1617
1718
┌─────────────────────────────────────────────────────────────┐
1819
│ moqx (application) │
@@ -23,8 +24,25 @@ artifact publishing, and relay deployment across the openmoq organization.
2324
└─────────────────────────────────────────────────────────────┘
2425
```
2526

26-
moqx's `deps/moxygen` submodule pins a moxygen commit. `setup-deps-release.sh`
27-
downloads the matching pre-built tarball from moxygen's release.
27+
moqx pins a moxygen commit via `MOXYGEN_REV` in
28+
[`cmake/dependencies.cmake`](/cmake/dependencies.cmake). At configure time CPM
29+
fetches that moxygen source and [`cmake/FetchMoxygenPrebuilt.cmake`](/cmake/FetchMoxygenPrebuilt.cmake)
30+
downloads the matching prebuilt install tarball from moxygen's release.
31+
32+
Build and test lanes run `configure.sh --moxygen prebuilt-with-fallback`, so a pin
33+
with no published tarball costs a slow from-source lane rather than a red one. The
34+
modes themselves are in [/BUILD.md](/BUILD.md#how-dependencies-work).
35+
36+
The images do the same, in [`docker/Dockerfile`](/docker/Dockerfile)'s `moxygen`
37+
stage. That stage copies the pin and the build system but not `src/`, so its layer
38+
key changes only on a `MOXYGEN_REV` bump, and a registry-backed buildx cache makes
39+
a source-only push reuse it.
40+
41+
Both image targets, `relay` and `interop-client`, take their moxygen from that one
42+
stage, so they cannot disagree about which moxygen they carry.
43+
44+
`version release` is the exception and stays strict: a versioned artifact must
45+
ship a published, digest-verified dependency, not whatever a runner compiled.
2846

2947
## End-to-End Flow
3048

@@ -118,10 +136,13 @@ Promotes `snapshot-latest` artifacts to a versioned `vX.Y.Z` release (no rebuild
118136
| Job | Runner | Purpose |
119137
|-----|--------|---------|
120138
| check-format | ubuntu-latest (trixie) | clang-format-19 check |
121-
| linux | ubuntu-22.04 | Build + test (from-release tarball) |
122-
| asan debug | self-hosted (linode) | ASAN/UBSAN build + test |
139+
| linux | ubuntu-22.04 | Build + test (prebuilt tarball, from-source fallback) |
140+
| asan (moqx TUs, prebuilt deps) | self-hosted (linode) | ASan/UBSan on moqx TUs, build + test |
123141

124-
Format check must pass before build runs.
142+
Format check must pass before build runs. The fully-instrumented from-source
143+
san/tsan stacks build nightly in the `sanitizers` workflow
144+
([sanitizers.yml](/.github/workflows/sanitizers.yml), also manually
145+
dispatchable against any branch).
125146

126147
### 2. `ci main` — Build, Publish, Release, Deploy, Notify
127148

@@ -136,12 +157,12 @@ check-format + build ──► publish (Docker) ──► release ──► depl
136157
- Deploy automatically updates moqx-main.ci.openmoq.org with the new image
137158
- Notify sends Slack + email with per-job status
138159

139-
### 3. `moxygen sync` — Automated submodule update
160+
### 3. `moxygen sync` — Automated dependency-revision update
140161

141162
**Trigger:** `repository_dispatch` from moxygen + manual | **Time:** <1 min
142163

143164
- Checks for blocking `sync-moxygen/*` PR (one at a time)
144-
- Updates `deps/moxygen` submodule to dispatched SHA
165+
- Bumps `MOXYGEN_REV` in `cmake/dependencies.cmake` to the dispatched SHA
145166
- Creates PR with dual identity (bot creates, PAT approves)
146167
- Notifies on block or failure
147168

@@ -218,3 +239,11 @@ All build jobs use ccache:
218239
- **~35-50%** hit rate after upstream sync (many changed files)
219240
- **~65-80%** on incremental builds (typical PR or small change)
220241
- Warm cache cuts moxygen build time roughly in half
242+
243+
Build jobs also cache `~/.cache/moqx` (CPM source clones + the prebuilt moxygen
244+
install, ~680 MB of downloads per configure otherwise), keyed on the dependency
245+
pins — a pin bump refetches once, every other run configures offline.
246+
247+
The from-source fallback prefix is not cached: it is multiple GB per lane against a
248+
10 GB LRU budget, and `actions/cache` saves at job end, so the run that triggers the
249+
fallback would miss anyway. ccache absorbs the repeat cost instead.

docs/perf-tracking.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ surfaced via:
1515
- **PR comments** — comparison table, optionally posted to a PR when a run sets
1616
the `pr` input (otherwise the same report lives in the step summary)
1717

18-
Primary workflow: [`.github/workflows/perf-test.yml`](../.github/workflows/perf-test.yml)
18+
Primary workflow: [`.github/workflows/perf-test.yml`](/.github/workflows/perf-test.yml)
1919

2020
## Triggering
2121

@@ -169,13 +169,13 @@ The workflow stages a Pages artifact (`perf-out/`) and deploys it with
169169

170170
| File | Purpose |
171171
|------|---------|
172-
| `scripts/perf/perf-test-ci.sh` | CI orchestration (deploy, run, collect) |
173-
| `scripts/perf/perf-results-to-json.sh` | Parse client output → JSON |
174-
| `scripts/perf/perf-compare.py` | Regression detection + markdown |
175-
| `scripts/perf/perf-test.sh` | Underlying test runner (unchanged) |
176-
| `scripts/perf/perf-metrics.sh` | Prometheus metrics poller (unchanged) |
177-
| `.github/workflows/perf-test.yml` | Standalone perf workflow (run, compare, stage, deploy) |
178-
| `status/index.html` | Dashboard shell (copied to Pages artifact root) |
172+
| [`scripts/perf/perf-test-ci.sh`](/scripts/perf/perf-test-ci.sh) | CI orchestration (deploy, run, collect) |
173+
| [`scripts/perf/perf-results-to-json.sh`](/scripts/perf/perf-results-to-json.sh) | Parse client output → JSON |
174+
| [`scripts/perf/perf-compare.py`](/scripts/perf/perf-compare.py) | Regression detection + markdown |
175+
| [`scripts/perf/perf-test.sh`](/scripts/perf/perf-test.sh) | Underlying test runner |
176+
| [`scripts/perf/perf-metrics.sh`](/scripts/perf/perf-metrics.sh) | Prometheus metrics poller |
177+
| [`.github/workflows/perf-test.yml`](/.github/workflows/perf-test.yml) | Standalone perf workflow (run, compare, stage, deploy) |
178+
| [`status/index.html`](/status/index.html) | Dashboard shell (copied to Pages artifact root) |
179179
| `perf-out/perf/index.json` | Generated run manifest in Pages artifact |
180180
| `perf-out/perf/run-*.json` | Generated per-run result files |
181181

0 commit comments

Comments
 (0)