SHADE is young: 0.1.0-next.2 is a pre-release, and 0.1.0 isn't out yet.

SHADE
Run SHADE

Usage limits

An operator who runs instances for others can cap what each one uses: storage, the database, entries, team members, users, emails a day, queued jobs and API requests (decision 0004 point 15). Each limit is a number in the instance's environment. None is set by default, and an empty one means no limit.

They are not licence keys. Nothing is signed, nothing calls home, and nothing in the code names a plan. Whoever runs the server can change or remove a limit; a client who leaves runs without any.

The variables

Set them on every application of the instance (admin, public and worker), with the same values.

VariableWhat it caps
SHADE_LIMIT_STORAGE_MBMedia (originals and their sizes) plus modules' private files, in megabytes.
SHADE_LIMIT_DATABASE_MBThe database's size as Postgres reports it, in megabytes. Only what the team creates is refused.
SHADE_LIMIT_ENTRIESEntries in every collection, modules' own included.
SHADE_LIMIT_TEAM_MEMBERSActive team members. API tokens are not team members.
SHADE_LIMIT_ACCOUNTSAccounts.
SHADE_LIMIT_EMAILS_PER_DAYEmails sent per day, in the site's time zone.
SHADE_LIMIT_QUEUED_JOBSJobs waiting or running. Only modules' new jobs are refused.
SHADE_LIMIT_API_REQUESTS_PER_MONTHRequests to the content API and the account API. Counted and shown only, never refused.

Each is a whole number from 1. Anything else stops the container at start with the variable's name. No admin screen, setting or token changes a limit: the admin only shows them.

At a limit

New things are refused; nothing is ever deleted. Reading, editing, publishing and deleting always work, and deleting is how a client makes room. A limit lowered below what an instance already has refuses only what is new.

  • Storage: new uploads, replaced or cropped files that grow, and modules' private files.
  • Database: entries, media and team members that the team creates. Visitors' orders, form submissions and sign-ups go on, so a full database never loses a customer's order.
  • Entries, team members, users: creating one more. A sign-up on the site gets 409 with the key limits.errors.users, so the site can say so.
  • Emails: an email over the day's limit is logged as Over the limit and not sent. SHADE's own account and security mail (sign-in and reset links, invitations, alerts, backups) always goes.
  • Queued jobs: a module adding a job is refused. Jobs already waiting run, and SHADE's own work (email, search) is never refused.

The team gets a refusal that names the limit and says to ask whoever runs the server to raise it.

How it is counted

Storage, team members and users are counted exactly, when something is added. The database size, entries, emails today and queued jobs come from a count the worker takes every 5 minutes, so a few minutes' worth can pass a limit. When that count is more than 10 minutes old (the worker is down, or maintenance mode holds its tasks), or is from before midnight for emails today, SHADE counts those limits when something is added instead, until the worker counts again. That count holds no lock through the send, so emails sent at the same moment can each still see room: the emails-per-day limit can be passed by as many as are sent at once. API requests are counted per hour in Redis by every container and added up by the worker.

Entries and media in the trash still count, toward entries, storage and the database, until they are deleted forever (from the Trash, or by retention after its period): deleting makes room only then.

Watching it

  • In the admin: Settings shows a Usage card to those who may read the settings: each limit as used, its maximum and a bar, or "no limit". At 80% and at 100% of a limit a banner shows on every screen, and the A usage limit is nearly or fully reached alert rule emails the admins once per limit and level a day, however often the use moves between 80% and 100% (and not about 80% after it reached 100% that day).
  • In your metrics: shade_limit_used and shade_limit_max per limit (Metrics), so you watch every instance without being an admin of any.

CPU, memory, processes, disk quotas and a bucket's own quota are left to Docker, Coolify and the bucket: they limit those better than SHADE could measure them.