Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

MultiTenant

Thilo Planz edited this page Feb 29, 2012 · 2 revisions

Multi-tenant mode

v7files can operate in a multi-tenant mode, where the same instance can be used to connect to a separate MongoDB database for each tenant. This makes it easy to completely isolate the tenants from each other, and also calculate each tenant's resource use (they will not share storage).

Multiple endpoints

If there are only a few tenants and they do not need to be added on-the-fly, an alternative to the full multi-tenant mode is configuring multiple endpoints. As almost all configuration options can be specified on a per-endpoint-basis, this allows for greater degree of customization as well. For example, they could all use different authentication providers (in multi-tenant mode, they would all use the same endpoint configuration).

Note that you can also combine multiple endpoints with multiple tenants(multi-tenant mode is also configurable for each endpoint).

Multiple tenants

In multi-tenant mode the same endpoint is made available for multiple tenants. Each tenant is assigned a separate MongoDB database, so that all data stored is kept isolated from other tenants.

Path-based multi-tenant mode

You can place an endpoint in multi-tenant mode by setting the configuration option v7files.tenants:

# "path"-based multi-tenant mode uses the first path segment of the endpoint url
# as the tenant name (= database name), the document root will start after that
v7files.tenants = path

When you do this, the first URL path component in the endpoint's context is used as the tenant name. The file path starts after that.

Example

webdav.endpoints = /webdav
/webdav.v7files.tenants = path

A request GET /webdav/charly/docs/a.txt will access /docs/a.txt in the database assigned to tenant charly.

Mapping tenants to databases

For now, the tenant name is used as the database name.

A tenant is only valid if the database already exists and has the v7files metadata collection (so that getting some random HTTP requests does not result in creating new databases).

Clone this wiki locally