Production deployment
Pre-built images from GHCR (recommended)
The fastest deployment path: no source code required. Images are published automatically on every release to GitHub Container Registry.
curl -O https://raw.githubusercontent.com/lad-sapienza/BraDypUS/v5/bradypus.yml
docker compose -f bradypus.yml pull
docker compose -f bradypus.yml up -dTo pin a specific version:
BDUS_VERSION=5.0.3 docker compose -f bradypus.yml up -dSee Deploy with pre-built images for the full guide.
Build from source
If you have cloned the repository and want to build the images locally:
docker compose -f docker-compose.prod.yml up -d --buildIn production, the node container (Vite dev server) is replaced by a static Nginx container serving the pre-built dist/ files.
Environment variables
Set these in docker-compose.prod.yml or via a .env file:
| Variable | Default | Description |
|---|---|---|
BRADYPUS_DEBUG | 0 | Set to 1 only for debugging |
BRADYPUS_ALLOW_NEW_APP | 0 | Set to 1 temporarily to create the first app |
BRADYPUS_CORS_ORIGIN | — | Space-separated allowed origins for cross-origin API access (credentials are allowed for exactly these origins, never *) |
BRADYPUS_COOKIE_SAMESITE | Lax | SameSite of the session cookie that lets the browser show protected files: Lax, Strict, or None for a front-end on another site (needs HTTPS and BRADYPUS_CORS_ORIGIN; over plain HTTP it falls back to Lax). Behind a TLS-terminating proxy list the proxy in BRADYPUS_TRUSTED_PROXIES so X-Forwarded-Proto: https is believed |
BRADYPUS_TRUSTED_PROXIES | private ranges in the Compose files (10.0.0.0/8,172.16.0.0/12,192.168.0.0/16); unset otherwise | Comma-separated IPs/IPv4 CIDRs of the proxies in front of the API. Only then X-Forwarded-For is read, to tell clients apart for rate limits |
BRADYPUS_ACCENT_INSENSITIVE | 0 | Set to 1 to ignore accents in text search (Σερηνε finds Σερῆνε, perche finds perché). SQLite needs PHP intl (in the official image), PostgreSQL the unaccent extension; see Accents, case and indexes |
BRADYPUS_RATE_KEY_WRITE | 60 | API-key writes per key per minute (0 = off) |
BRADYPUS_RATE_KEY_READ | 300 | API-key reads per key per minute |
BRADYPUS_RATE_KEY_IP | 120 | API-key requests per client address per minute |
BRADYPUS_RATE_BAD_KEY_IP | 60 | Rejected credentials per client address per minute |
BRADYPUS_RATE_LOGIN_IP | 30 | Failed logins per client address per 15 minutes |
BRADYPUS_RATE_MCP_WRITE_ROWS | 500 | Records written or deleted through MCP per API key per hour |
RESEND_API_KEY | — | API key for Resend, used to send password-reset and self-registration emails. One key covers every application on this instance. Leave unset to keep those features reported as unavailable instead of failing silently — see Login & authentication. |
MAIL_FROM_ADDRESS | — | Sender address for those emails. Must be on a domain verified in your Resend account. |
MAIL_FROM_NAME | BraDypUS | Sender display name. |
File uploads
The bdus-api image ships with upload_max_filesize = 64M / post_max_size = 72M (PHP's own defaults are 2M / 8M — too small for photos). The bdus-app frontend sets client_max_body_size 100m to match.
To allow larger files, bind-mount your own PHP config over the shipped one and raise client_max_body_size on every proxy in front:
# in the api service of docker-compose.prod.yml / bradypus.yml
volumes:
- ./php-uploads.ini:/usr/local/etc/php/conf.d/zz-bradypus.ini:ro# php-uploads.ini
upload_max_filesize = 256M
post_max_size = 300M
memory_limit = 512MShared hosting (PHP-only)
For hosts that support PHP but not Docker, follow the Manual installation guide and upload the files via SFTP/SSH.
SQLite on shared hosting
SQLite databases are stored as files in projects/{app}/db/. They can be downloaded and uploaded like any other file, making backups and migrations trivial.
HTTPS
Always run BraDypUS behind HTTPS in production. JWT tokens are transmitted in headers — without HTTPS they are exposed in transit.
When using a reverse proxy (Nginx, Caddy, Traefik), set the X-Forwarded-Proto header so BraDypUS knows the connection is over HTTPS. The backend trusts this header when building absolute URLs (e.g. the OAuth redirect_uri), so the proxy must set it explicitly and overwrite any value supplied by the client. The bundled bdus-app frontend already forwards it unchanged to the API.
The frontend container also sends baseline response headers (X-Content-Type-Options, X-Frame-Options, Referrer-Policy). Add Strict-Transport-Security — and a Content-Security-Policy if you maintain one — on the outer proxy, where TLS is terminated.
# Nginx example — proxy to a BraDypUS container exposing port 80
server {
server_name myapp.example.com;
location / {
proxy_pass http://127.0.0.1:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}Rate limits and client addresses. BraDypUS limits API-key requests and failed logins per client address. The address PHP sees is that of the proxy in front of it: with the bundled frontend container, always the container's own. The Compose files therefore set BRADYPUS_TRUSTED_PROXIES to the private ranges (10.0.0.0/8,172.16.0.0/12,192.168.0.0/16), which covers the frontend container and an outer proxy on your LAN; X-Forwarded-For is then read from the right, skipping trusted proxies, so an address forged by a client is never believed. Add the proxy's address if it is outside those ranges. Without the variable (running the API on its own, with no Compose file) every client behind a proxy shares one address. A public form that posts to the API is best also limited in nginx (limit_req_zone, client_max_body_size), which stops abuse before PHP.
Deleting old records (retention)
Deleting a record in the interface keeps a full copy of it in the version history, and every edit adds another: contact data would stay in the database after the record is gone. To delete or anonymise records after a time, with their history, run bin/purge-records.php. "Older than" is measured on a date field of the table (records have no creation date of their own, so give the table a date field such as the date of the request):
# 1. look: counts, writes nothing
docker compose exec -u www-data api php bin/purge-records.php \
--app edr --table richieste --date-field data_richiesta --older-than 365
# 2. keep the records but blank the personal fields (and purge the history that holds them)
docker compose exec -u www-data api php bin/purge-records.php \
--app edr --table richieste --date-field data_richiesta --older-than 365 \
--anonymize-fields email,telefono --yes
# or delete them altogether
docker compose exec -u www-data api php bin/purge-records.php \
--app edr --table richieste --date-field data_richiesta --older-than 730 --yesDeleting removes the record's plugin rows, links, stratigraphic relations and map data too; files attached to it are unlinked but stay on disk. A purge cannot be undone: take a backup first (bdus backup with bdus-ops). Run again, an anonymisation finds nothing left to do, so it can be scheduled (cron) as is. The log keeps only the counts.
Data persistence
All application data (SQLite databases, uploaded files, configuration, backups) lives in the projects/ directory inside the bdus-api container. Both Compose files map this directory to a persistent Docker named volume called projects_data, so data survives container restarts and image updates.
To find where Docker stores the volume on disk:
docker volume inspect $(docker volume ls -q | grep projects_data)For backup and restore commands, see the Data persistence section of the pre-built images guide.
WARNING
On Docker Desktop (Mac / Windows) the volume lives inside the Docker VM and is not directly accessible from the host filesystem. Use docker run --rm -v projects_data:/data alpine ... to read or write files inside the volume.