# Set limits and retention

Source: https://dropshelf.ai/docs/self-host/configure/limits-and-retention

Set the instance-wide limits on deploys, members and tokens, the retention choices members get, and how many versions each drop keeps.

These settings apply to the whole dropshelf instance. They bound what one deploy may carry, what each
member may own, how long drops and tokens live, and how many earlier versions each drop keeps. This
page is for the operator who chooses them.

The defaults suit most instances. Each block on this page goes in the server's configuration file.
On a Helm install, put it under `config:` in your values file. Sizes are binary, so `100MB` is
100 MiB.

## Prerequisites [#prerequisites]

- Access to the server's configuration, or to the Helm values.

## Size one deploy [#size-one-deploy]

Four limits bound one deploy, shown here at their defaults:

```yaml
deploy:
  maxZipBytes: 100MB
  maxFiles: 5000
  maxFileBytes: 25MB
  maxTotalBytes: 500MB
```

- `maxZipBytes` is the largest compressed upload.
- `maxFiles` is the most files in one deploy.
- `maxFileBytes` is the largest one file may be, uncompressed.
- `maxTotalBytes` is the largest all the files may be together, uncompressed.

Every upload passes through the proxy and waits in the spool volume, so raise those with
`maxZipBytes`. The proxy's body size must exceed `maxZipBytes`. The chart's 2Gi spool covers four
concurrent 100 MB uploads, four being `deploy.maxConcurrentDeploys` per replica, plus the files they
unpack to.

To allow 200 MB uploads on a Helm install, raise all three, and the pod's ephemeral storage request
with the spool:

```yaml
config:
  deploy:
    maxZipBytes: 200MB
ingress:
  nginx:
    proxyBodySize: 210m
volumes:
  spool:
    sizeLimit: 4Gi
resources:
  requests:
    ephemeral-storage: 14Gi
```

The [configuration reference](/docs/reference/configuration#deploy) lists the other `deploy` keys.

## Limit what each member owns [#limit-what-each-member-owns]

Two limits apply to each member:

```yaml
limits:
  maxDropsPerUser: 100
  maxLiveBytesPerUser: 5GB
```

- `maxDropsPerUser` is the most live drops one member may own. It defaults to `100`.
- `maxLiveBytesPerUser` is the most bytes one member's live versions may hold across their drops. It
  defaults to `0`.

`0` means no limit for either. The byte limit counts the version each drop serves and uploads still
running. Kept versions and drafts do not count, so history costs members nothing. Admins are exempt
from both. A transfer by an admin, or an admin's publish to another member's drop, is not held to
that member's limits either.

## Set token lifetimes [#set-token-lifetimes]

Personal access tokens get a default and a longest lifetime:

```yaml
tokens:
  defaultTTL: 90d
  maxTTL: 365d
```

`defaultTTL` applies when a request names no lifetime, and may not exceed `maxTTL`. A request for
longer than `maxTTL` is shortened to it, not refused. `maxTTL` also ends every agent sign-in through
OAuth, however often the agent refreshes it. Both take any duration, such as `12h`. The
[configuration reference](/docs/reference/configuration#tokens) has both keys.

## Choose retention presets [#choose-retention-presets]

Every drop expires after its retention unless its owner keeps it Forever. These settings decide
which lifetimes members get:

```yaml
retention:
  default: 30d
  presets: [1d, 7d, 30d]
  maxCustom: 365d
  allowForever: true
```

- `default` is how long a new drop lives when its owner chooses nothing.
- `presets` are the lifetimes the dashboard offers as choices.
- `maxCustom` is the longest lifetime a member may enter under **Custom**.
- `allowForever` decides whether members may keep a drop Forever.

Every value is a whole number of days, `1d` or more. `default` and each preset may not exceed
`maxCustom`. A short default keeps the instance tidy, and `allowForever: false` makes every drop
expire. The [configuration reference](/docs/reference/configuration#retention) has the rules.

## Allow private drops [#allow-private-drops]

A private drop opens for its owner and admins, and nobody can be added to it. Private drops are off
by default. To offer them, set:

```yaml
visibility:
  allowPrivate: true
```

Turn it on only once every replica runs a release that knows private drops. A replica that does not
would open them to everyone on the drop's list. [Upgrade dropshelf](/docs/self-host/operate/upgrade)
covers rolling releases.

## Reserve names [#reserve-names]

A drop's name becomes its address, so some names are kept back. The default list holds 26 names:
`www`, `api`, `admin`, `mail`, `static`, `assets`, `docs`, `status`, `auth`, `login`, `logout`,
`signin`, `sso`, `oauth`, `account`, `accounts`, `secure`, `security`, `password`, `mcp`, `cli`,
`dropshelf`, `help`, `support`, `it` and `hr`.

A list in `slugs.reserved` replaces the default rather than adding to it. To reserve more names,
copy the default list and add yours:

```yaml
slugs:
  reserved: [www, api, admin, mail, static, assets, docs, status, auth, login, logout, signin, sso,
    oauth, account, accounts, secure, security, password, mcp, cli, dropshelf, help, support, it, hr,
    intranet, payroll]
```

The [configuration reference](/docs/reference/configuration#slugs) has the key.

## Keep earlier versions and drafts [#keep-earlier-versions-and-drafts]

Each drop keeps some earlier versions as rollback targets, and some drafts. Two counts decide how
many:

```yaml
deploy:
  keepHistory: 5
  keepDrafts: 5
  supersededGracePeriod: 1m
```

- `keepHistory` is how many versions that were once live each drop keeps besides the live one.
- `keepDrafts` is how many drafts, versions that were never live, each drop keeps. It is counted apart
  from `keepHistory`.
- `supersededGracePeriod` is how long a version beyond those counts stays before its files are purged.

`keepHistory: 0` keeps no earlier published versions, and it leaves drafts to `keepDrafts`.
`keepDrafts: 0` purges each draft once the grace period has passed, which turns drafts off. A purged
version stays listed in the dashboard, but nobody can preview or publish it.

Kept versions and drafts use space in the object store, though they do not count against
`limits.maxLiveBytesPerUser`.

## What members see [#what-members-see]

Members meet these limits in the dashboard and through the API:

- **A deploy over a deploy limit** is refused, and the message names the limit. For a folder, the
  dashboard checks the file count and sizes before it uploads.
- **A member at `maxDropsPerUser`** has a new drop refused. Nothing warns them before, and deleting a
  drop frees a slot at once.
- **A member over `maxLiveBytesPerUser`** has the upload or publish refused, and the message gives the
  limit and the bytes in use.
- **Retention** offers the presets, **Custom** up to `maxCustom`, and **Forever** only when
  `allowForever` is `true`.
- **Private** appears among the visibility choices only when `allowPrivate` is `true`.

## Confirm it worked [#confirm-it-worked]

Open **Admin > Settings**. Its **Configuration** shows the effective settings, so check the values
you changed there.

## Next steps [#next-steps]

- [Turn on optional features](/docs/self-host/configure/features)
- [Administer dropshelf](/docs/self-host/operate/administration)
- [Upgrade dropshelf](/docs/self-host/operate/upgrade)
- [Configuration reference: limits](/docs/reference/configuration#limits)
- [Helm chart values](/docs/reference/helm-values)
