Tenants & Teams in Environments
Esta página aún no está disponible en tu idioma.
Overview
Section titled “Overview”Greentic isolates workloads along a four-level identity chain: Global, Tenant, Team, User. Every runtime call carries a TenantCtx that threads tenant and team identity through routing, secret resolution, state, sessions, and telemetry. The Multi-Tenancy concept page covers the runtime model, the TenantCtx type, and bundle.yaml workspace configuration in detail. This page focuses on the operator side: how tenants and teams surface in a deployed environment, and what you configure to onboard them.
The system is deny-by-default everywhere. A new tenant or team directory starts with no access. Packs, flows, and nodes must be explicitly granted before they become available.
Three mechanisms carry tenant identity through an environment:
| Mechanism | Where it applies |
|---|---|
| Tenant selector on bundle deployments | Sets the (tenant, team) identity a deployment serves under. Drives routing and secret resolution scope. |
| Secret scoping | Secret paths embed <tenant>/<team> segments so each tenant receives its own credentials. |
.gmap access maps inside the bundle | Per-tenant and per-team allow/deny rules for packs, flows, and nodes. |
The tenant selector on deployments
Section titled “The tenant selector on deployments”When you deploy a bundle to an environment, the tenant selector determines which tenant and team identity the deployment operates under. Set it at deploy time with flags:
gtc op deploy --bundle ./app.gtbundle --env prod-eu \ --tenant acme --team supportOr in an environment manifest under the bundle’s route_binding:
"route_binding": { "path_prefixes": ["/"], "hosts": ["chat.example.com"], "tenant_selector": { "tenant": "acme", "team": "support" }}The tenant selector flows into two things:
- Ingress routing — the runtime’s deployment route table maps inbound requests by
(host, path)to a deployment and its associated tenant identity. Public traffic cannot choose a deployment or override the tenant. - Secret resolution scope — when the runtime resolves a
secret://reference, it uses the deployment’s tenant and team as the lookup scope. A deployment with--tenant acmeresolves secrets under theacmepath segment.
Tenant and team directories
Section titled “Tenant and team directories”Inside a bundle workspace, tenant and team scopes are expressed as directories:
<bundle_root>/ tenants/ <tenant>/ tenant.gmap teams/ <team>/ team.gmapNew directories are created by the operator tooling (the bundle wizard) with default-deny content. You can also create them by hand. A tenant directory without a .gmap file, or with only _ = forbidden, grants no access to any pack.
Access control with .gmap files
Section titled “Access control with .gmap files”.gmap files are line-oriented policy files that control which packs, flows, and nodes a tenant or team may use. They are not tenant metadata or configuration documents.
Each non-comment line follows the format:
<path> = <policy>Path shapes:
| Path | Matches |
|---|---|
_ | Everything (wildcard) |
<pack> | All flows and nodes in the named pack |
<pack>/_ | All flows in the named pack (wildcard variant) |
<pack>/<flow> | A specific flow |
<pack>/<flow>/<node> | A specific node |
Policies: public (allow) or forbidden (deny).
Evaluation rules:
- Most-specific match wins. A rule for
accounting/main/approvetakes precedence overaccounting/main, which takes precedence overaccounting, which takes precedence over_. - Same-specificity ties are resolved by last-line-wins within the file.
- Team rules overlay tenant rules. The runtime checks the team’s
.gmapfirst. If no matching rule is found, it falls back to the tenant’s.gmap.
Example
Section titled “Example”# Deny everything by default_ = forbidden
# Allow the weather demo packweather-demo = public
# Allow one flow in another packaccounting-invoice/main = public# The ops team also gets the admin flowaccounting-invoice/admin = public
# But not the delete node within itaccounting-invoice/admin/delete-record = forbiddenIn this example, a user in acme/ops can access weather-demo (inherited from the tenant), accounting-invoice/main (inherited), and accounting-invoice/admin (team override) — but not accounting-invoice/admin/delete-record (explicitly denied at the team level).
Helper commands
Section titled “Helper commands”For quick policy edits during development and demos, you can use the grant commands instead of editing .gmap files directly:
gtc op demo allow --bundle ./bundle --tenant acme --path weather-demogtc op demo allow --bundle ./bundle --tenant acme --team ops --path accounting-invoice/admingtc op demo forbid --bundle ./bundle --tenant acme --team ops --path accounting-invoice/admin/delete-recordThese commands edit the appropriate .gmap file for you.
Onboarding a tenant
Section titled “Onboarding a tenant”Follow these four steps to onboard a new tenant to an existing environment:
-
Create the tenant directory structure in the bundle workspace. Use the bundle wizard or create the directories and
.gmapfiles by hand:tenants/new-client/tenant.gmapteams/default/team.gmapStart each
.gmapwith_ = forbidden. -
Grant access to the packs, flows, or nodes the tenant should use. Edit the
.gmapfiles to addpubliclines, or use the helper commands:Terminal window gtc op demo allow --bundle ./bundle --tenant new-client --path support-agent -
Provision the tenant’s secrets under the tenant scope. Secret paths follow the pattern
<tenant>/<team|_>/<category>/<name>. See Secrets in Environments for details on supplying secret values.Terminal window gtc op secrets put --answers secrets-payload.jsonThe payload addresses secrets under the
new-clienttenant path, for examplenew-client/_/messaging-telegram/telegram_bot_token. -
Deploy the bundle with the tenant selector so that routing and secret resolution carry the tenant identity:
Terminal window gtc op deploy --bundle ./app.gtbundle --env prod-eu \--tenant new-client --team defaultOr include the
tenant_selectorin an environment manifest and apply it withgtc op env apply --answers manifest.json.
After deployment, the runtime routes requests to the new deployment under the new-client identity, resolves secrets within that tenant scope, and enforces the .gmap access policy.
Related Pages
Section titled “Related Pages”- Multi-Tenancy — runtime model,
TenantCtx,.gmapformat details, resolved manifests - Secrets in Environments — supplying and scoping secrets per tenant and team
- Secrets — declaration, runtime access, backends overview, redaction
- Cloud Deploy Environments — the admin-console self-service deploy surface (a managed layer above the CLI)