Enforce website storage quotas on ext4 web nodes #33

Merged
parkel merged 3 commits from feature/website-storage-quotas into main 2026-11-21 14:20:21 +01:00
2 changed files with 44 additions and 0 deletions
Showing only changes of commit 2f85d88ea8 - Show all commits

No files matched your search

+5
View File
@@ -216,6 +216,11 @@ The same worker measures allocated space in a website's document root. Use
**Measure website storage** on a deployed hosting account and reload the page
to see the latest result. [Website storage measurement](development.md#measure-website-storage)
To enforce hard limits, prepare a dedicated ext4 volume with user quotas for
the managed sites. Use **Change storage limit** on the deployed account to
apply the hosting plan's default or choose a per-site value.
[Website storage quotas](development.md#apply-a-website-storage-limit)
## Enable HTTPS for hosted websites
Once a site is active, obtain the website certificate with Certbot on the
+39
View File
@@ -35,6 +35,10 @@ new mailbox requested under the plan. The account page shows each mailbox's
assigned limit. Leave the field blank to omit a Coulobre storage limit.
[Configure Dovecot quota enforcement](#enforce-mailbox-storage-limits)
Set **Website storage limit (MiB)** to supply the initial value when an
operator applies a website quota from the account page.
[Apply a website storage limit](#apply-a-website-storage-limit)
Changing or reassigning a plan preserves existing databases and mailboxes. If
the new limit is at or below current usage, the panel blocks additional
requests of that type. Changing the plan's storage limit applies to new
@@ -914,6 +918,41 @@ Reload the page to see the result and timestamp. The account shows the most
recent successful result even if a later attempt fails. Customers and
resellers can see measurements on their assigned accounts.
### Apply a website storage limit
Mount a dedicated ext4 filesystem with user quotas at `/srv/coulobre/web`.
For a new filesystem, the `mke2fs` options `-O quota -E quotatype=usrquota`
create the user quota metadata. Use the `usrquota` mount option. The web node
expects document roots on this volume without nested mounts. Check whether
user quotas are active with
`sudo quotaon -p -u /srv/coulobre/web`.
[ext4 mount options](https://www.kernel.org/doc/html/v7.0/admin-guide/ext4.html)
On the local installation, open a deployed hosting account and select
**Change storage limit** under **Website storage**. An operator with **Can
change site storage limit** can apply the hosting plan's default or enter
another value in MiB. Clear the field to remove the space limit. The page
shows the last confirmed limit and any pending update.
On a separate web node, apply a limit using the deployed site manifest.
```sh
sudo /opt/coulobre/bin/coulobre-web-node set-storage-limit \
coulobre-web-plan-1.json --limit-mib 1024
sudo /opt/coulobre/bin/coulobre-web-node storage-limit coulobre-web-plan-1.json
```
Use `--unlimited` with `set-storage-limit` to remove the space limit. Linux
enforces a hard quota on bytes charged to the site's system user anywhere
on that filesystem. A lower limit can block new writes while existing
files are retained. The CLI reports the enforced limit and charged usage.
The panel's website measurement reports allocated space in the document root.
[Linux quota API](https://man7.org/linux/man-pages/man2/quotactl.2.html)
The local web socket accepts the same update as JSON with
`"operation": "set_storage_limit"`, the deployment manifest under `"site"`,
and a positive integer or `null` under `"limit_mib"`.
## Install SFTP keys on a web node
Generate an Ed25519 key on the computer that will connect and choose a