Multi-tenancy

Several customers, subsidiaries or departments often use the same internal applications, and must not see each other. Meerkat keeps them apart at the door: each one is a tenant, and every request is made in exactly one of them.

Enterprise edition. More than one tenant is part of the Enterprise edition. The Community image serves a single tenant, which no screen ever names.

What a tenant holds

An administrator of a tenant manages its members, groups and group rules from the console, and nothing outside it.

A tenant in the console: its General page with its name, its owner and its working hours, and its Groups, Members, Group rules and Danger zone sections

Turning several tenants on

You need the Enterprise or evaluation image, and an account with the root capability.

  1. Open Application, General (/application/general) and turn on Several tenants. Off, a single tenant is managed under Application; on, each tenant is managed under Tenants.
  2. In the rail, open Tenants, then New tenant: type its name, choose its Group mode (Cumulative or Exclusive), and click Create. An account with the tenant creator capability can do this step too, and owns the tenants it creates.
  3. In the new tenant, open Groups to create its groups and tick the roles each one grants, then Members to tick the accounts that join it, with the admin badge for those who administer it.

To check: sign in as a person who is a member of two tenants. The sign-in asks which one to work in, and the user button then offers to switch.

Application, General: the Several tenants switch turned on, above the working hours every tenant inherits

At sign-in

A person with one membership is placed in that tenant without a question. A person with several chooses one, and can change later from the user button. In Enterprise, a group rule can make a directory group, a GitHub team or an OpenID Connect claim a membership at each sign-in.

The tenant chooser of a person who belongs to Acme Logistics and Acme Retail, opened here by an application of the other tenant

What your services receive

The tenant travels with the request, beside the identity and the roles, in the headers or the signed JWT the route sends. Route rules and per-endpoint rules are answered in that tenant. A service learns which tenant the caller works in as a fact, not as a parameter the caller chose.

For a route that sends a signed JWT with the facts username, email, roles, tenant and tenantid under those names, the service receives a payload such as:

{
  "iss": "https://meerkat-internal.shop.svc.cluster.local:7443",
  "sub": "usr_123",
  "aud": "orders",
  "iat": 1796083200,
  "exp": 1796083320,
  "username": "john",
  "email": "jdoe@example.com",
  "roles": "ROLE_A,ROLE_B",
  "tenant": "Acme",
  "tenantid": "tnt_123"
}

With the Headers mechanism, the same facts arrive as request headers under the names the route gives them, X-Tenant: Acme for instance.

Read more