Markk116 cdedab3302 Add test suite, stats command, and fix runtime stack-overflow crash
- Bump urus to v0.2.2 (v0.2.1 -> v0.2.2) and smarm to v0.6.0, pulling in
  a urus fix (pushed alongside this commit) that spawns per-connection
  actors with a 256 KiB stack via smarm's RFC 019 SpawnOpts instead of
  the runtime's bare 64 KiB default. Without it, any request that hit
  fetch_asset_handler's in-handler gzip decompression (i.e. any client
  not sending Accept-Encoding: gzip) blew the actor's guard page and the
  connection died with no response - reproduced 5/5 runs before the fix,
  0/5 after.

- Add `ccc stats`: active/archived package and version counts, total
  gzipped bytes stored, and the resolved db path. Useful for a quick
  sanity check before/after a deploy.

- Add a real test suite, which is what caught the crash above:
    - src/store.rs unit tests: schema init/idempotency, create/add/
      archive success and error paths, gzip round-trip, upsert
      semantics, stats aggregation.
    - tests/cli.rs: black-box tests against the compiled `ccc` binary
      covering usage/exit codes and the full create/add/archive/stats
      lifecycle.
    - tests/server.rs: boots `ccc serve` as a real subprocess and drives
      it over raw TCP (no HTTP client dependency) - boot-without-
      crashing, asset serving both compressed and decompressed, 404s,
      package listing incl. archived-package hiding, and repeated
      sequential requests against one long-lived process.

27/27 tests passing (12 unit + 9 CLI + 6 server).
2026-08-08 22:42:37 +02:00
2026-08-08 16:36:22 +02:00
2026-08-08 16:36:22 +02:00

C3 - Cached Content Conduit

My super simple CDN built for distributing my own (text) content.

Running in Docker

docker compose up -d

The runtime image is distroless (no shell, no package manager, ~24MB), so managing packages happens via docker exec running the ccc binary directly rather than an interactive shell:

docker compose exec ccc /usr/local/bin/ccc create demo

To add a file, it needs to exist inside the container first. Drop it in the ./staging dir, which is bind-mounted to /staging:

cp app.js staging/
docker compose exec ccc /usr/local/bin/ccc add demo /staging/app.js 1.0.0

(Alternatively docker cp a file straight into the container if you'd rather not use the staging mount.)

License

AGPL-3.0-only - see LICENSE. If you run a modified version of this as a network service, you must make the modified source available to its users.

S
Description
C3 - Cached Content Conduit My super simple CDN built for distributing my own (text) content.
Readme AGPL-3.0
99 KiB
Languages
Rust 94.2%
Python 4.5%
Dockerfile 1.3%