Hosting · Operations

Operations

This page covers three routine tasks: keeping logs from filling the disk, planning disk space, and backing up one user's data. For deploying, backups and incidents, see the runbook.

Logs

The server writes its logs to standard output and standard error. What rotates them depends on how you run it.

systemd

With the manual VPS setup, logs go to the systemd journal. Read them with journalctl -u civility.

  1. Set a size and age limit in /etc/systemd/journald.conf.

    [Journal]
    SystemMaxUse=500M
    MaxRetentionSec=30day
    
  2. Restart journald.

    sudo systemctl restart systemd-journald
    

To check the journal's size, run journalctl --disk-usage. To delete entries older than 30 days once, run journalctl --vacuum-time=30d.

The journal removes old entries by itself, so the service needs no logrotate. Access logs that Caddy or nginx write to files do need it.

Docker

Docker's default json-file log driver never rotates. Set a limit for the service in your compose file:

services:
  civility:
    logging:
      driver: json-file
      options:
        max-size: '10m'
        max-file: '5'

This keeps at most 5 files of 10 MB each.

To set it for every container on the host, put this in /etc/docker/daemon.json and restart Docker:

{
  "log-driver": "json-file",
  "log-opts": { "max-size": "10m", "max-file": "5" }
}

On a hosting platform such as Fly, Render or Coolify, the platform collects the logs. Check its log retention setting.

Send logs to a collector

With OpenTelemetry on, you can send log lines to your collector and keep the terminal output empty:

OTEL_DENO=true OTEL_DENO_CONSOLE=replace civ api start

Disk space

Each user has two storage quotas, so the most the server can store is bounded.

Kind Limit Default
Change data maxDbBytesPerUser 100 MB
Blob storage maxBlobBytesPerUser 1 GB

Change data is in the SQLite database file. Blobs are in the blob directory or your S3 bucket.

  • Set the defaults in /admin/limits.
  • Raise or lower one user on their page in the admin panel.
  • See current totals on the admin Overview page.

Estimate the worst case

database size  ≤  number of users × change-data quota
blob storage   ≤  number of users × blob quota

For example, 100 users with the default quotas can use up to 10 GB of database and 100 GB of blobs. Leave extra room for SQLite's own overhead and its write-ahead log.

Pick default quotas that fit your disk for the number of users you expect, then raise individual users as needed.

When you run out

A server uses one SQLite file, so it runs as one process on one machine.

Problem What to do
Blobs fill the disk Move blobs to an S3 bucket. See Blob storage.
The database fills the disk Use a larger disk, or lower the change-data quota or retention in /admin/limits.
Requests are slow under load Use a machine with more CPU.

Back up a user's data

Use this when someone asks for a copy of their data.

The user can sign in. They back it up themselves: Settings → Your data (/settings/data), or from a terminal:

civ api backup --host https://your-server --email user@example.org

The user cannot sign in. You build the backup for them:

  1. Open the user in /admin/users.
  2. In the Account backup card, click Build backup.
  3. Reload the page after a moment and click Download.

No account password is needed. The backup is recorded in the audit log as a data_export entry for that account, with via: admin.

What the backup contains:

  • Everything the account holds: its apps and their change history, files, shares and profile.
  • App data exactly as stored. If an app encrypted its data, the backup has the encrypted data and not the app's keys.
  • No credentials. Sessions, API keys, sync tokens, password hashes and TOTP secrets are left out.

Building a backup from the admin panel needs blob storage to be set up. The page tells you if it is not. Backups are deleted 24 hours after they are built.

See the accounts spec for the backup file's format.

See also