Skip to content

Production deployment ​

The fastest deployment path: no source code required. Images are published automatically on every release to GitHub Container Registry.

bash
curl -O https://raw.githubusercontent.com/lad-sapienza/BraDypUS/v5/bradypus.yml
docker compose -f bradypus.yml pull
docker compose -f bradypus.yml up -d

To pin a specific version:

bash
BDUS_VERSION=5.0.3 docker compose -f bradypus.yml up -d

See 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:

bash
docker compose -f docker-compose.prod.yml up -d --build

In 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:

VariableDefaultDescription
BRADYPUS_DEBUG0Set to 1 only for debugging
BRADYPUS_ALLOW_NEW_APP0Set 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_SAMESITELaxSameSite 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_PROXIESprivate ranges in the Compose files (10.0.0.0/8,172.16.0.0/12,192.168.0.0/16); unset otherwiseComma-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_INSENSITIVE0Set 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_WRITE60API-key writes per key per minute (0 = off)
BRADYPUS_RATE_KEY_READ300API-key reads per key per minute
BRADYPUS_RATE_KEY_IP120API-key requests per client address per minute
BRADYPUS_RATE_BAD_KEY_IP60Rejected credentials per client address per minute
BRADYPUS_RATE_LOGIN_IP30Failed logins per client address per 15 minutes
BRADYPUS_RATE_MCP_WRITE_ROWS500Records 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_NAMEBraDypUSSender 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:

yaml
# 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
ini
# php-uploads.ini
upload_max_filesize = 256M
post_max_size = 300M
memory_limit = 512M

Shared 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
# 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):

bash
# 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 --yes

Deleting 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:

bash
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.