What this is about
A new customer means four things to the platform, and they come into being in four different places:
| What | Where |
|---|---|
| the tenant’s record | in the CIAS database |
| possibly an organization | in Keycloak |
| a database with its schema | wherever CDMS keeps its data |
| the people’s accounts with their roles | in Keycloak, plus user records in CIAS |
There is no shared transaction across all four. So CIAS records every step on its own, which is what makes a half-finished customer recognizable and repairable.
The whole path in one picture
The normal case: a platform administrator creates the tenant, CDMS and CIAS run in the same process, and the data layer is set to MULTI.
sequenceDiagram
autonumber
participant A as Admin
participant C as CIAS
participant CDB as CIAS database
participant P as CDMS persistence
participant TDB as Tenant DB
participant K as Keycloak
participant U as Client of nordbau
A->>C: POST /cias/admin/tenants {key: nordbau, type: STATIC}
C->>C: check the caller's role
C->>CDB: transaction 1 – key free? store as PENDING / IN_PROGRESS
CDB-->>C: stored
C->>P: provision nordbau
P->>TDB: CREATE DATABASE nordbau
P->>TDB: bring the schema up to the models
TDB-->>P: done
P-->>C: provisioned
C->>CDB: transaction 2 – PROVISIONED, then ACTIVE
C-->>A: 200 with the tenant
Note over A,K: now the people get access
A->>C: create or invite a person, grant roles
C->>K: account, membership, roles
C->>CDB: user record
Note over U,TDB: the first request
U->>C: POST /api/rest/crm/customer/query + token
C->>C: check the token, resolve the tenant
C->>C: is nordbau served?
C->>U: answer from the tenant DB
Three things about this shape are deliberate:
- Store the intention first. If the process dies afterwards, at least something recognizable is there: a tenant in
IN_PROGRESSwith a start time. - Provision without an open transaction. Creating and migrating a database can take a while. Inside a transaction, CIAS would hold a connection and its locks for that long.
- Store the outcome afterwards, success as well as failure, each in its own short transaction.
The stations up to the first request
-
CIASRecordIs the key free and valid?↳ no refused, nothing is created
-
CDMSProvisioningIs the database there with its schema?↳ no rollout
FAILED, the tenant is not served — a retry is possible -
CIASStandingIs the tenant
ACTIVEand inside its validity window?↳ no the gate refuses every request -
KeycloakAccessDoes the person's token name exactly this tenant?↳ no the filter chain refuses before CDMS is reached
-
CIASTenant gateIs nordbau served today?↳ no refused, without revealing why
- The request reaches CDMS and reads from the database of nordbau
The last three stations run on every request, not only the first. Details under The tenant check in both operating modes.
The variants
When: A platform administrator creates it, usually because a contract has been signed.
-
1Admin→CIAS
POST /cias/admin/tenantswith key, type and display nameOnly a platform administrator. A tenant administrator may not create tenants — that is exactly the line that separates customers from one another. -
2CIAScreates no organization in KeycloakFor a dynamic tenant, the field
externalOrganizationIdpoints at an organization that already exists there. -
3CIAS→CDMSprovisions the database and activates the tenant
Result: The tenant is there and empty. People arrive separately, by being created or invited.
When: A company signs itself up, and the assignment is set to founding a new tenant.
-
1User→CIASfills in the form, company name included
-
2CIAS→Emailsends the confirmation link; nothing happens until it is clicked
-
3CIAS→Keycloakcreates the organization first, its alias is the tenant key
-
4CIASthen creates the tenant, type
DYNAMIC, referring to the organization — database included -
5CIAS→Keycloakmakes the person a member, sets their tenant attributes and grants the founder roles
Result: Tenant, organization and first person come into being in one go. Details under What happens on completion.
When: CDMS and CIAS run in the same process.
The request to provision nordbau is a method call. In MULTI CDMS creates the database and migrates the schema; in SINGLE there is nothing to do and provisioning reports success right away.
Result: If provisioning fails, operations find out while creating the customer and not the customer on their first request.
When: CIAS is a service of its own, without CDMS persistence in the process.
CIAS has no tenant databases and therefore provisions nothing; provisioning reports success right away, and at start it is stated once that this installation provisions nothing. The database is created by the CDMS service on the first request for this tenant, provided creating one is approved there.
Result: The tenant is active immediately, and the customer's first request takes longer. Where creating is not approved, it fails.
Where the database comes from
| CDMS persistence in the same process? | Operating mode | What happens at creation |
|---|---|---|
| yes | MULTI | CDMS creates database and schema right away |
| yes | SINGLE | nothing — there is only the one database |
| no | – | nothing. The CDMS service creates it on the first request |
Which database an access hits and when it is created is under Databases, pools, migration and Databases and schemas.
The states along the way
| Standing | Rollout | What is going on |
|---|---|---|
PENDING | IN_PROGRESS | Provisioning is running. The tenant is not served |
PENDING | FAILED | Provisioning failed. A retry is possible |
ACTIVE | PROVISIONED | Normal operation |
SUSPENDED | PROVISIONED | Suspended, the data stays |
If everything succeeds, the tenant is immediately active; you only see PENDING while provisioning runs or after it failed. The full lifecycle is under The lifecycle of a tenant, the creation itself under Create and provision a tenant.
If the process dies between the two transactions, the tenant stays in IN_PROGRESS, and the retry accepts only FAILED. There is a timer for that, which marks abandoned provisionings FAILED after a deadline. It comes with the starter and is off there by default; the standalone CIAS service switches it on.
From the tenant to the first request
A created tenant is not enough. A person’s request has to name this tenant, and where it does that from depends on the tenant’s type:
- The account carries the attributes
tenantandallowedTenants - The attribute is the membership
- Roles are granted globally
- The organization's alias in the token names the tenant
- Membership is membership in the organization
- Roles are granted in the organization and appear in the organization claim
After that the path is the same for both: the filter chain resolves the tenant, the tenant gate asks CIAS whether it is served and remembers the answer briefly. Only then does the request reach CDMS. The whole path is under From login to the data.