Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3ca1a41
fix: disable broker fsync bypass and qualify historical measurements
feat7 Nov 3, 2026
641fbe2
docs: design self-hosted deployment integrations and expanded experim…
feat7 Nov 3, 2026
246a318
docs: plan the approved self-hosted ingestion expansion
feat7 Nov 3, 2026
6d658ca
feat: generate safe self-hosted deployment configuration
feat7 Nov 3, 2026
a7df666
feat: deploy the collector behind HTTPS with private dependencies
feat7 Nov 3, 2026
9f43b3c
feat: expose safe operation diagnostics and verified recovery procedures
feat7 Nov 3, 2026
6198dbf
fix: compare visibility timestamps within the deployment clock
feat7 Nov 3, 2026
f3f2728
feat: provide reusable Python and Node ingestion clients
feat7 Nov 3, 2026
0a0fc3e
feat: demonstrate durable application delivery with a transactional o…
feat7 Nov 3, 2026
8125bba
chore: exclude local outbox databases from source and builds
feat7 Nov 3, 2026
840a534
test: preserve deployment cleanup after evidence failures
feat7 Nov 3, 2026
dc55909
fix: make expanded ingestion measurements reproducible and commit-aware
feat7 Nov 3, 2026
f5219f6
fix: report delayed observation as a benchmark limit
feat7 Nov 3, 2026
4965b14
feat: run reproducible self-hosted ingestion studies and recovery exp…
feat7 Nov 3, 2026
dccf4b3
bench: independently audit study artifacts and timing populations
feat7 Nov 3, 2026
713ddb8
bench: preserve and audit the complete COPY-writer reference study
feat7 Nov 3, 2026
213e4cc
perf: use atomic batch INSERT after the measured database comparison
feat7 Nov 3, 2026
45315d3
bench: record corrected self-hosted ingestion experiments
feat7 Nov 3, 2026
c0fbc62
docs: illustrate deployment integration and ingestion tradeoffs clearly
feat7 Nov 4, 2026
a0bc5d9
fix: reject duplicate API key mappings before server startup
feat7 Nov 4, 2026
9252894
docs: explain self-hosted ingestion and measured operating behavior
feat7 Nov 4, 2026
802ce89
fix: bound Python delivery attempts across DNS connections and TLS
feat7 Nov 4, 2026
bb4a970
docs: record final verification review and implementation decisions
feat7 Nov 4, 2026
801345a
docs: record authorized pull request integration
feat7 Nov 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@ tests
examples
scripts
bin
**/.env
**/.env.*
**/backups
**/private
.archify
.worktrees
**/*.db
**/*.db-*
**/*.sqlite
**/*.sqlite-*

**/.venv
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permissions:
jobs:
verify:
runs-on: ubuntu-24.04
timeout-minutes: 15
timeout-minutes: 30
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-go@v5.5.0
Expand All @@ -21,5 +21,9 @@ jobs:
- uses: actions/setup-node@v4.4.0
with:
node-version: '24'
- run: python3 -m unittest discover -s examples/checkout -p 'test_*.py'
- run: node --test examples/checkout/*.test.mjs
- run: python3 -m unittest discover -s examples/outbox -p 'test_*.py'
- run: python3 -m unittest discover -s benchmarks -p 'test_*.py'
- run: scripts/test-integration.sh
- run: make demo DEMO_FLAGS=-cleanup
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,18 @@ bin/
*.log
coverage.*
.DS_Store
# Self-hosted private runtime/configuration data
**/backups/
**/private/
.archify/
# Local application outbox databases and journals
**/*.db
**/*.db-*
**/*.sqlite
**/*.sqlite-*
# Private environment variants; checked-in examples remain public.
**/.env.*
!**/.env.example

# Optional local figure-generation environment
**/.venv/
7 changes: 5 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ Keep the collector small and its claims reproducible.

1. Read [the delivery contract](docs/delivery.md).
2. Add a behavioural regression test before changing a failure path.
3. Run make test, go vet ./..., and make test-integration.
3. Run `make test`, `go vet ./...`, `go build ./...` and `make test-integration`.
Run the Python/Node suites when changing examples or artifact auditing; see
[development](docs/development.md).
4. Explain the resulting behaviour and verification in the pull request.

Integration tests create and destroy only their own isolated Compose projects.
Do not reset a shared database, weaken durability for a benchmark, or add a
performance claim without its raw results and environment metadata.
performance claim without its raw results and environment metadata. Keep timing studies sequential, commit the measured code first and
retain limited/unknown outcomes. Figure edits use [source/data and visual checks](docs/figures/README.md).
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Local service, demonstration and experiment commands.
.PHONY: help up down logs test test-integration
help:
@echo "make up | down | logs | test | test-integration | demo | demo-recovery | bench-db | bench-pipeline"
@echo "make up | down | logs | test | test-integration | demo | demo-recovery | bench-db | bench-pipeline | bench-study | bench-study-smoke"
up:
docker compose up -d --build --wait
down:
Expand All @@ -26,3 +26,9 @@ bench-db:
.PHONY: bench-pipeline
bench-pipeline:
go run ./cmd/bench -mode pipeline $(BENCH_FLAGS)

.PHONY: bench-study bench-study-smoke
bench-study:
go run ./cmd/bench -mode study $(STUDY_FLAGS)
bench-study-smoke:
go run ./cmd/bench -mode study -smoke $(STUDY_FLAGS)
144 changes: 70 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,99 +1,95 @@
# IngestKit

**What does an event collector actually guarantee when a dependency fails?**

IngestKit is a small Go pipeline that makes that question testable. Send a stable
UUID over HTTP, acknowledge it through Redpanda, and persist it in PostgreSQL.
Stop the database, kill the consumer after a commit, or fail quarantine delivery:
the tests check the resulting IDs and source offsets.

[Read the engineering article](docs/article.md) · [Run the experiments](benchmarks/README.md) · [Delivery contract](docs/delivery.md)

~~~mermaid
flowchart LR
A[Application] -->|JSON + stable UUID| B[Go API]
B -->|acknowledged append| C[Redpanda]
C --> D[Go consumer]
D -->|COPY staging + merge| E[(PostgreSQL)]
D -->|malformed envelope| F[Quarantine topic]
E -. transaction commits before offset .-> C
~~~
A self-hosted event collector for trusted application backends. Send JSON over
HTTPS, buffer it in Redpanda, and store it in PostgreSQL with stable event IDs.
The repository includes copyable clients, a transactional outbox, failure tests
and reproducible experiments.

**HTTP 202 means broker acknowledgement. PostgreSQL storage is asynchronous.**
Retry uncertain delivery with the same UUID and content; storage keeps one row
per `(tenant_id,event_id)` and retains the first stored content.

<a href="docs/assets/deployment.svg"><picture><source media="(max-width:600px)" srcset="docs/assets/deployment-mobile.svg"><img src="docs/assets/deployment.svg" alt="A backend sends HTTPS to Caddy; API, broker, consumer and PostgreSQL run privately on one Compose host."></picture></a>

[Deployment](deploy/README.md) · [Application integration](docs/integration.md) ·
[Operations](docs/operations.md) · [Engineering article](docs/article.md)

## Try it
## Deploy

Requires Docker with Compose v2+ and Go 1.24+. Start with the isolated checkout
demo; it prints the three accepted IDs and verifies each stored row:
Use a Linux host with Git, Docker/Compose 2.24.4+, OpenSSL and curl. Point your
own hostname at it and make ports 80/443 reachable. Replace `events.example.com`
below with that hostname. Go is built inside Docker.

~~~sh
git clone https://github.com/feat7/ingestkit.git
cd ingestkit
make demo
make demo-recovery
deploy/configure.sh events.example.com
docker compose --env-file deploy/.env -f deploy/compose.yml up -d --build --wait
~~~

The recovery demo stops PostgreSQL, accepts events through the broker, then
restores the database and reconciles the same IDs. Runs have separate projects,
ports and volumes. They stop their services and preserve volumes; each prints
its evidence directory and a command to clean up only that run. Use
`DEMO_FLAGS=-cleanup` for disposable runs.
Configuration is generated into ignored `deploy/.env` with mode 0600 and fresh
secrets; existing files are never overwritten. Only Caddy publishes ports.
See the [deployment guide](deploy/README.md) for DNS, resources and certificate
prerequisites. Public certificate issuance requires working DNS/reachability;
the automated HTTPS tests use a trusted private CA.

For an interactive stack:
## Send and verify

For the initial generated key mapping, load the key without printing it and send
the three checkout events:

~~~sh
make up
curl --fail-with-body http://localhost:8080/v1/events \
-H 'Authorization: Bearer local-demo-key' \
INGESTKIT_API_KEY=$(sed -n 's/^API_KEYS={"\([0-9a-f]*\)":"default"}/\1/p' deploy/.env)
curl --fail-with-body https://events.example.com/v1/events/batch \
-H "Authorization: Bearer $INGESTKIT_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"event_id":"00000000-0000-4000-8000-000000000001","event_type":"order_completed","occurred_at":"2026-11-03T00:00:00Z","payload":{"order_id":"order-1","amount":25}}'
docker compose exec postgres psql -U ingestkit -d ingestkit_test \
-c 'SELECT event_id,event_type,payload FROM ingestkit.events;'
make down
~~~
--data-binary @examples/checkout/events.json
unset INGESTKIT_API_KEY

**202 means broker acknowledgement; storage happens afterward.** A failed or
timed-out HTTP request can still have delivered some records. Retry the same
IDs. Storage keeps the first event for each `(tenant_id,event_id)` pair.
[Python and Node callers](examples/checkout/README.md) show the HTTP contract
without installing a generated SDK.
docker compose --env-file deploy/.env -f deploy/compose.yml exec -T postgres \
psql -U ingestkit_admin -d ingestkit -c \
"SELECT tenant_id,event_id,event_type FROM ingestkit.events ORDER BY persisted_at DESC LIMIT 10;"
~~~

## Evidence, including the awkward result
Allow the consumer time to catch up before checking SQL. Repeating these fixed
UUIDs still stores three logical events for the initial tenant. Use fresh UUIDs
for new business events. Stop with the following command; named data volumes remain:

On a shared M1 Max / OrbStack setup, three steady runs each accepted and stored
10,000 distinct events at an offered 1,000 events/s. HTTP ACK p95 was 27–31ms;
receipt-to-visible-storage p95 was 73–85ms, including SQL polling. Burst
repetitions varied more. These are load points, **not a maximum-capacity claim**.
~~~sh
docker compose --env-file deploy/.env -f deploy/compose.yml down
~~~

The database comparison also found batch INSERT faster than the service's
COPY/staging/merge path at batch size 100: median 0.492s versus 1.011s for
10,000 unique submissions. Staging and replay handling have costs. All samples,
settings, source revision and caveats are in [the local results](benchmarks/results/local-2026-11-03/README.md).
## Integrate

![Database timings and storage visibility for every measured repetition](docs/assets/experiments.svg)
Copy the standard-library [Python or Node client](docs/integration.md) into a
backend. For durable application delivery, run the [order/outbox example](examples/outbox/README.md):
business state and the serialized event are saved in one SQLite transaction,
then a separate dispatcher sends pending work with stable IDs. Keys stay in
trusted backend configuration. See the [API reference](docs/api.md) for limits,
responses and permanent versus uncertain failures.

~~~sh
make test
make test-integration
make bench-db
make bench-pipeline
~~~
## Inspect the evidence

Tests cover strict envelopes, byte limits, bounded publishing, tenant-scoped
deduplication, database/broker outages, the database-commit/offset-commit crash
window, quarantine failures, rebalance and shutdown. Integration checks use real
isolated services and fail if their setup is missing.
The [corrected HTTPS study](benchmarks/results/selfhost-2026-11-04/README.md)
records 25 configurations with three measured repetitions: database batching,
payloads, duplicates, HTTP load, concurrency and three recovery scenarios.
All acknowledged IDs reconciled with stored content; generator limits and
ambiguous outcomes remain explicit. These local runs do not establish maximum
capacity. Batch INSERT had the lower median than COPY/staging/merge in all 11 DB
configurations, so the deployed writer now uses atomic batch INSERT.

## Scope
To try an isolated local walkthrough, use Docker and Go 1.24+:

This is an engineering reference, with reusable HTTP examples and a small store
implementation. The local broker has one replica and finite retention. Disk/host
loss and outages beyond retention are outside the tested recovery assumptions.
There is no unconditional zero-loss, exactly-once or production-readiness claim.
Deployment hardening, row-level database isolation and business payload schemas
are outside this reference.
~~~sh
make demo DEMO_FLAGS=-cleanup
make demo-recovery DEMO_FLAGS=-cleanup
~~~

The old compiler, generated SDKs, installers and event-specific endpoints were
removed. Existing external releases and legacy data were preserved; legacy data
is not automatically imported. Small workloads may be better served by direct
PostgreSQL writes.
[Development and tests](docs/development.md) · [Experiment controls](benchmarks/README.md) ·
[Delivery semantics](docs/delivery.md) · [Architecture](docs/architecture.md)

[Architecture](docs/architecture.md) · [Development and configuration](docs/development.md) · [Contributing](CONTRIBUTING.md) · [Apache 2.0 license](LICENSE)
This is a single-host deployment with one broker replica and finite log retention.
It does not protect against losing the host/disk or a recovery gap beyond retained
data. PostgreSQL rows have no automatic expiry; the operator owns backups, disk
monitoring and retention. It provides ingestion and replay-safe storage, without
an analytics UI, schema compiler or database row-level tenant policies.
Loading
Loading