Skip to content

Commit addc2ff

Browse files
committed
wip mt
1 parent 7cfb8f3 commit addc2ff

File tree

1 file changed

+49
-6
lines changed

1 file changed

+49
-6
lines changed

application/configuration/multitenancy.md

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Resource sharing and isolation:
2121
- Database: table prefixing per tenant.
2222
- Cache: key prefixing per tenant.
2323
- Storage: tenants configure their own “Site storage” and “Upload storage” in application settings.
24-
- Sessions: only Redis is supported as backend.
24+
- Sessions: only Redis is supported as the backend.
2525
- Tenant ID: unique, up to 16 characters.
2626
- Tenant hostname: unique, up to 255 characters.
2727

@@ -35,24 +35,67 @@ To enable tenants, set the following environment variables. You must provide an
3535
CHEVERETO_ENABLE_TENANTS=1
3636
CHEVERETO_ENCRYPTION_KEY=your_encryption_key
3737
CHEVERETO_PROVIDER_NAME=your_provider_name
38+
CHEVERETO_PROVIDER_URL=your_provider_url
39+
```
40+
41+
### SaaS context
42+
43+
The Chevereto SaaS context is a special mode for service providers offering Chevereto as a service to multiple customers. When running Chevereto in a SaaS context, the system alters functionality and display that otherwise would allow tenants to interfere with each other or the host system. In particular, it affects the following features:
44+
45+
- Self-upgrade capabilities
46+
- HTTP cron trigger
47+
- License key management
48+
- System information display (database version, PHP info, FFmpeg, etc.)
3849

39-
If you want to run Chevereto in SaaS context, also set:
50+
To run Chevereto in a SaaS context set:
4051

4152
```plain
4253
CHEVERETO_CONTEXT=saas
4354
```
4455

4556
### Environment variables
4657

47-
Use plans and tenant configurations to define resource limits and environment variables on a per-tenant basis. Use `CHEVERETO_TENANT_ENFORCED` to define a JSON object with environment variables that will be late enforced (overridden) on runtime to all tenants.
58+
Define resource limits and environment variables per tenant via plans and tenant configurations. To enforce overrides at runtime for all tenants, set `CHEVERETO_TENANT_ENFORCED` to a JSON object.
59+
60+
Precedence (highest to lowest):
61+
62+
- `CHEVERETO_TENANT_ENFORCED` (runtime enforced, not stored)
63+
- Tenant `env` (encrypted at rest), `limits`
64+
- Plan `env` (encrypted at rest), `limits`
65+
- Global defaults/environment
4866

4967
```plain
5068
CHEVERETO_TENANT_ENFORCED='{"CHEVERETO_MAX_UPLOAD_SIZE":"20M"}'
5169
```
5270

71+
**Tip:** When using yaml you can define `CHEVERETO_TENANT_ENFORCED` multi-line as:
72+
73+
```yaml
74+
CHEVERETO_TENANT_ENFORCED: >
75+
{
76+
"CHEVERETO_CONTEXT":"saas",
77+
"CHEVERETO_ENABLE_BULK_IMPORTER":"0",
78+
"CHEVERETO_ENABLE_CDN":"0",
79+
"CHEVERETO_ENABLE_DEBUG":"0",
80+
"CHEVERETO_ENABLE_LOCAL_STORAGE":"0",
81+
"CHEVERETO_ENABLE_NEWS_CHECK":"1",
82+
"CHEVERETO_ENABLE_PHP_PAGES":"0",
83+
"CHEVERETO_ENABLE_POWERED_BY_SETTING":"1",
84+
"CHEVERETO_ENABLE_FORCE_POWERED_BY_FOOTER":"0",
85+
"CHEVERETO_ENABLE_PUP_CUSTOM_URL":"0",
86+
"CHEVERETO_ENABLE_UPDATE_CHECK":"0",
87+
"CHEVERETO_ENABLE_UPDATE_HTTP":"0",
88+
"CHEVERETO_ENABLE_UPLOAD_URL":"0",
89+
"CHEVERETO_ENABLE_SERVICE_MODERATECONTENT":"0",
90+
"CHEVERETO_MAX_LISTING_ITEMS_PER_PAGE":"48",
91+
"CHEVERETO_MAX_CACHE_TTL":"3600",
92+
"CHEVERETO_MIN_STORAGES_ACTIVE":"1"
93+
}
94+
```
95+
5396
### Initializing the multi-tenant system
5497
55-
Then, initialize the multi-tenant database system:
98+
Initialize the multi-tenant database (run once after enabling multitenancy):
5699
57100
```sh
58101
app/bin/tenants -C init
@@ -81,7 +124,7 @@ This creates plan `1` named “Basic Plan” with a maximum of `10000` tags and
81124

82125
### Editing a tenant plan
83126

84-
Use [plan:edit](../../application/reference/cli.md#edit-tenant-plan) to change the name, limits, or environment of an existing plan. Affected tenants will inherited the updated plan settings; the system re-caches them automatically.
127+
Use [plan:edit](../../application/reference/cli.md#edit-tenant-plan) to change the name, limits, or environment of an existing plan. Affected tenants will inherit the updated plan settings; the settings are re-cached automatically.
85128

86129
```sh
87130
app/bin/tenants -C plan:edit \
@@ -100,7 +143,7 @@ app/bin/tenants -C plan:list
100143

101144
### Deleting a tenant plan
102145

103-
Use [plan:delete](../../application/reference/cli.md#delete-tenant-plan) by plan ID. Affected tenants will lose the inherited plan settings; the system re-caches them automatically.
146+
Use [plan:delete](../../application/reference/cli.md#delete-tenant-plan) by plan ID. Affected tenants will lose the inherited plan settings; the settings are re-cached automatically.
104147

105148
```sh
106149
app/bin/tenants -C plan:delete --id 1

0 commit comments

Comments
 (0)