Index by title
Architecture¶
Atlas is four services behind one gateway.
The gateway terminates TLS, authenticates the request, applies the tenant's rate limit and routes
to the service that owns the path. It holds no state beyond a short-lived token cache. The
identity service owns tenants, users, service accounts and API keys, and is the only thing that
writes to the identity database. The event bus carries every domain event; consumers are grouped
so that a slow consumer cannot hold up a fast one. The job runner executes anything that must not
happen inside a request: invoice generation, exports, webhook delivery.
Request path¶
- The gateway resolves the tenant from the host or the API key.
- It introspects the token against the identity service, with a cache keyed on the token hash.
- It applies the rate limit, which is a token bucket per tenant per route class.
- It forwards the request with a correlation id that every downstream log line carries.
Invariants¶
- Every write emits exactly one event, in the same transaction as the write.
- Every consumer is idempotent on the event id: replaying a day must change nothing.
- No service reads another service's database. Ever. The event bus exists so that it does not have to.
Coding standards¶
Formatting is not a matter of taste here: the formatter runs in CI and its output is the standard.
What a reviewer will actually ask about:
-
Errors carry context. An error that reaches a log without the tenant, the route and the
correlation id has wasted everybody's time.
-
No new database read across a service boundary. Add an event or an endpoint.
-
Every migration is reversible and every migration is safe to run while the old code is still
serving traffic. We deploy before we migrate, never the other way round.
-
Tests describe behaviour, not implementation. If renaming a private method breaks a test, the
test was wrong.
-
Public API changes need a documentation change in the same commit. The OpenAPI document is
generated, so this usually means an annotation.
Release process¶
Two-week cycles. The version is cut on a Tuesday, spends two days on staging with the replay suite
running against it, and goes to production on Thursday morning behind a flag that is opened to 5 %,
then 50 %, then everyone, over the following day.
A fix that must not wait for the cycle goes out as a patch release, which skips staging only if the
change is a single-line configuration value. Anything larger waits for the next morning window.
Rollback is a flag flip and takes under a minute, which is why every release must be able to run
against the previous schema. That constraint is the reason migrations are split into an additive
change now and a destructive change two releases later.
Runbook: the gateway is unhealthy¶
- Check the gateway's own health endpoint per region. A single unhealthy region is a routing problem;
all regions unhealthy is almost always the identity service or its database.
- Look at the token introspection latency graph. If it has climbed above 50 ms the cache is cold —
usually because a key rotation invalidated everything at once.
- If the identity database is the cause, fail over to the replica. The runbook for that is in the
infrastructure repository; it takes about ninety seconds and drops in-flight writes.
- If the event bus is lagging, the gateway will shed load by design. Do not disable the back-pressure
signal to make the graph look better.
- Write what you did in the incident issue while you are doing it, not afterwards.
Atlas Platform¶
The shared services every Qasaur product builds on. Start here: