Pomentumgraphos

One graph, many services

Several services need the same connected data, and none of them should hold the database.

Platform teams6 stepsTested

Step through it, animated →

The situation

For teams whose services share connected data: dependencies, assets, a knowledge graph. Once several services need it, each one ends up holding database credentials, writing its own Cypher, and solving bulk loading, indexing and isolation on its own.

Step by step

  1. Problem 1. Every service holds the database

    The orders service and the catalogue service each connect to PostgreSQL with a connection string of their own and write their own Cypher.

    Each solves bulk loading, indexing and isolation on its own.

    Database credentials in services: one per service · What a service can reach: what its login allows · Revoking a service: —

  2. With graphos 2. One service owns the graph

    Only graphos-api connects to the database. An admin gives each service an account of its own (POST /v1/users with kind: service), and a grant on each tenant it needs (POST /v1/grants).

    A level says how far a grant goes: read, write, maintain or owner, each including the ones before it.

    Database credentials in services: none

  3. How it works 3. A token that lasts 15 minutes

    A service signs in with POST /v1/auth/login and gets an access token that lasts 900 seconds by default. The Python client signs in again by itself before it runs out.

    So a leaked token is useful for minutes, not months.

  4. How it works 4. Typed HTTP to its own tenant

    Every call is typed HTTP with the token as a bearer; the tenant is in the address. The orders service writes to acme, the catalogue service reads sales.

    The contract is published as OpenAPI, versioned under /v1.

    What a service can reach: the tenants it is granted

  5. With graphos 5. Another tenant: refused before any SQL

    When the catalogue service calls acme, which it has no grant on, the answer is 403, given before any SQL runs. A tenant that isn't registered answers 404.

  6. With graphos 6. The database has no door of its own

    The database has no published port and sits on an internal network that only graphos-api joins, which connects as an unprivileged role. Consumers never see a connection string and cannot send SQL.

    Disabling a service's account, or resetting its secret, stops its tokens at once on every replica.

    Revoking a service: at once, on every replica

What graphos does here

graphos-api
The one service that connects to the database.
Tenant
Each tenant its own graph, reached only with a grant.
Users, grants and sign-on
Service accounts, levels per tenant, 15-minute tokens.
Audit log
One line per request, naming the account that made it.

What shows it: Tested

Tested: graphos's tests check that every operation declares its access and needs its level and no more, that a service account can create tenants and owns them, and that disabling a user or resetting its secret stops its tokens at once. The example 05_tenant_pool.py runs several tenants side by side. The services and tenant names drawn are examples.

In graphos's latest release and covered by graphos's automated tests; no result is measured for it here.

Try it

The usage guide shows users, service accounts and grants, then writing and reading a first tenant.

Read the usage guide

Related use cases