An event-driven system spread over two tribble clusters, built to exercise the platform the way a customer would: several services, two data stores, scheduled jobs, private networking inside a cluster and public HTTPS between clusters.
This repo holds the picture and the documentation. The code lives in the service repos listed below.
Follow the numbers:
- An event arrives. A producer POSTs JSON to Vector, the only way in.
- Vector stores it. Every event becomes one row in the
eventstable. Nothing else writes to that database. - The reconciler reads. It starts every minute, reads the events, works out what each process should do next, and exits. It keeps no state of its own.
- It runs a workflow. For a step that needs work done, it calls an n8n webhook in the other cluster and waits for the answer.
- n8n queues and executes. The webhook processor puts the job on Redis and a worker picks it up.
- The workflow reports back. It posts its result to Vector as a new event, which lands in the same table (step 2).
- The reconciler records its progress the same way: as events posted to Vector. On its next run it reads them back and carries on from there.
So there is one loop: everything that happens is an event, and every event goes through Vector into one table.
| cluster | service | kind | reachable from | built from |
|---|---|---|---|---|
| us-west-2 | Vector | always running | internet (basic auth) | tribble-example-vector |
| us-west-2 | Postgres (events) |
data store, with a volume | its cluster only | platform template |
| us-west-2 | Reconciler | scheduled, every minute | nothing calls it | tribble-example-reconciler |
| us-west-2 | Migrate | scheduled job | nothing calls it | tribble-example-reconciler |
| pdx1-metrics3 | n8n main | always running | internet (login) | tribble-example-n8n |
| pdx1-metrics3 | n8n webhooks | always running | internet (token) | tribble-example-n8n |
| pdx1-metrics3 | n8n workers | always running, 2 replicas | nothing calls them | tribble-example-n8n |
| pdx1-metrics3 | Postgres (n8n) | data store, with a volume | its cluster only | platform template |
| pdx1-metrics3 | Redis | job queue | its cluster only | platform template |
Two rules follow from the platform:
- Inside a cluster apps reach each other by an internal name on a private network.
- Between clusters there is no private network. The two calls that cross (4 and 6) go over public HTTPS and carry credentials.
The sample process, check_site, checks that a website answers.
sequenceDiagram
autonumber
participant P as Producer
box us-west-2
participant V as Vector
participant DB as Postgres (events)
participant R as Reconciler
end
box pdx1-metrics3
participant N as n8n
end
P->>V: site_check_requested (domain)
V->>DB: insert
Note over R: next run, within a minute
R->>DB: read new events
R->>V: check_site_opened
R->>N: run the site-check workflow
N-->>R: answer (status, ok)
R->>V: check_site_checked
N->>V: site_check_reported
V->>DB: insert (all three)
Note over R: next run
R->>DB: read, find site_check_reported
R->>V: check_site_reported (cycle complete)
A run that starts before Vector has written the previous run's events repeats a step. Every step is safe to repeat, so the cost is a second call, not a wrong result.
| repo | what it is |
|---|---|
| tribble-example-vector | Vector's image and config: HTTP in, Postgres out |
| tribble-example-reconciler | the reconciler, the process definitions, the events schema, the n8n workflow |
| tribble-example-n8n | n8n's image for all three roles |
| tribble-example-kafka | a single-node Kafka, built but not part of the system yet |
Each app is built by tribble from its repo and rebuilt when the repo changes.
| n8n in queue mode | running |
| Vector and Postgres | running; Vector accepts and rejects requests as it should |
| Reconciler | running every minute, nothing to do yet |
The site-check workflow in n8n |
not imported yet |
| One event through the whole loop | not run yet |
| Kafka between Vector and the reconciler | deferred |
- Postgres, not MySQL. Vector can write to Postgres and cannot write to MySQL.
- No Kafka for now. With one consumer that polls every minute, a table does the job of the log. Kafka stays a later test of the platform, not a need of the system.
- The reconciler never writes to the database. It posts events like every other producer, so there is one way in and one writer.
- Two clusters on purpose. The split is there to test how apps in different clusters work together, not because the system needs it.