SecuroSecuro

Production Deployment

Deploy Securo to a production server with Docker Compose, HTTPS, backups, and updates.

This guide covers deploying Securo to a production server. If you're just trying Securo locally, see the Installation guide instead.

Production vs Development

Securo ships with two Docker Compose files:

FileUse CaseImages
docker-compose.ymlDevelopmentBuilds from source, hot reload
docker-compose.prod.ymlProductionPre-built images from GHCR

For production, always use docker-compose.prod.yml. It pulls optimized pre-built images from GitHub Container Registry instead of building from source.

Server Requirements

  • A Linux server (Ubuntu 22.04+ recommended) with at least 2 GB RAM (the stack runs six containers)
  • Docker Engine and Docker Compose plugin installed. Podman works too: use podman-compose 1.6.0 or newer, older versions silently break the compose variable interpolation, which manifests as CORS and login-callback failures
  • A domain name (optional, but recommended for HTTPS)

The fastest path on a fresh server is the one-line installer, which does everything in the next two sections for you (including installing Docker and generating .env): curl -fsSL https://usesecuro.com/install.sh | bash

Deployment Steps

1. Install Docker

On your server, install Docker using the official script:

curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER

Log out and back in for the group change to take effect.

2. Clone and Configure

git clone https://github.com/securo-finance/securo.git
cd securo

Create a .env file with a strong secret key:

echo "SECRET_KEY=$(openssl rand -hex 32)" > .env

Setting SECRET_KEY yourself is recommended, so you can keep it with your backups. If you leave it out, Securo generates a unique key on the first start and keeps it in the database.

If you want bank sync or exchange rates, add those keys too:

PLUGGY_CLIENT_ID=your-client-id
PLUGGY_CLIENT_SECRET=your-client-secret
OPENEXCHANGERATES_APP_ID=your-app-id

3. Start Securo

docker compose -f docker-compose.prod.yml pull
docker compose -f docker-compose.prod.yml up -d

Verify all containers are running:

docker compose -f docker-compose.prod.yml ps

Set FRONTEND_URL for Any Non-Localhost Access

If Securo will be reached at anything other than http://localhost:3000 (a LAN IP, a domain, a tunnel), set FRONTEND_URL in .env to that exact public URL before people log in:

FRONTEND_URL=http://192.168.1.50:3000

This one variable drives CORS, bank-sync OAuth callbacks, OIDC redirect defaults, and passkey origins. Skipping it is the most common cause of "login works on the server but not from my laptop" reports. Restart after changing it: docker compose -f docker-compose.prod.yml up -d

To change the published ports, set FRONTEND_PORT and BACKEND_PORT in .env. On a hardened server you can keep the backend off the public interface entirely with BACKEND_PORT=127.0.0.1:8000; the frontend proxies /api to the backend internally, so nothing outside needs port 8000.

Setting Up HTTPS

For production, you should put Securo behind a reverse proxy with TLS. Here's a minimal example using Caddy (which handles HTTPS automatically):

# Install Caddy
sudo apt install -y caddy

Edit /etc/caddy/Caddyfile:

securo.yourdomain.com {
    reverse_proxy localhost:3000
}

Restart Caddy:

sudo systemctl restart caddy

Caddy will automatically obtain and renew a Let's Encrypt certificate. Update your .env to reflect the public URL:

FRONTEND_URL=https://securo.yourdomain.com

Then restart Securo: docker compose -f docker-compose.prod.yml up -d

Proxies and Rate Limiting

The backend rate-limits login and other sensitive endpoints per client address. Behind a reverse proxy every request arrives from the proxy, so the backend has to be told how many proxies to trust before reading the real client address from X-Forwarded-For. The production Compose file already sets TRUSTED_PROXY_HOPS=1 for the bundled nginx; add one per extra proxy in front of it (Caddy in front of the bundled nginx is 2). Setting it higher than the real number of hops lets a client forge its address, so count carefully.

The header is only read past a proxy whose address is in TRUSTED_PROXY_NETWORKS, which by default covers loopback and the private ranges (127.0.0.0/8,::1/128,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,fc00::/7). A public visitor who reaches the backend or frontend port directly is then keyed by its own address, whatever X-Forwarded-For it sends. Callers inside those ranges still count as proxies, so if untrusted LAN or VPN clients share them, or Docker shows direct callers as the bridge gateway, set it to your proxies' own addresses only (comma-separated networks or single addresses), or keep the backend port closed.

The bundled nginx resolves the backend through the platform's DNS at startup, which works on Docker, Podman and Kubernetes alike. If your platform needs a specific resolver, set NGINX_RESOLVER on the frontend service.

If you run Traefik instead of wiring your own proxy, the frontend service supports its labels as an opt-in: set TRAEFIK_ENABLE=true and TRAEFIK_NETWORK=<the network Traefik listens on> (optionally TRAEFIK_RESOURCE_NAME, unique per deployment). Off by default, so existing setups are untouched.

Other Tuning Knobs

Set these in .env when the defaults do not fit your setup:

VariableDefaultWhat it does
BANK_SYNC_MIN_INTERVAL_HOURS4Minimum hours between automatic bank syncs per connection. Raise it for banks that cap unattended access to four fetches a day
OPENEXCHANGERATES_APP_IDnoneEnables automatic currency conversion with a free Open Exchange Rates key. Rates are fetched on demand when foreign-currency transactions are created; without a key, cross-currency amounts fall back to a 1:1 rate with a visual warning
TZhost timezoneThe startup default for the application timezone when no value has been saved in Admin Settings: Securo follows TZ, then the host timezone, then UTC, so an existing installation keeps behaving as before until someone picks a timezone in Admin Settings → Date and time
FRONTEND_DIST_PATHnoneOff by default. Point it at a built frontend (the dist folder from npm run build) and the backend serves the app itself on its own port, without the frontend container. Health checks should then use /api/health

The application timezone (the one that decides which day "today" is for balances, budgets, due dates and scheduled work) is set in the admin settings and follows an IANA name like America/Sao_Paulo; individual workspaces can override it, see Workspaces.

Storing Attachments in S3

By default, attachments are files in the attachments volume. To keep them in an S3-compatible bucket instead (AWS S3, MinIO, Garage and others), create a private bucket and set in .env:

STORAGE_PROVIDER=s3
STORAGE_S3_BUCKET=securo-attachments
STORAGE_S3_REGION=garage
STORAGE_S3_ENDPOINT_URL=https://s3.example.com
STORAGE_S3_ADDRESSING_STYLE=path
STORAGE_S3_ACCESS_KEY=...
STORAGE_S3_SECRET_KEY=...
  • For AWS S3, leave out STORAGE_S3_ENDPOINT_URL and use STORAGE_S3_ADDRESSING_STYLE=auto. MinIO and Garage usually need path
  • Leave out both keys to use the SDK's own credential chain (an IAM role, for example). STORAGE_S3_SESSION_TOKEN is there for temporary credentials
  • The bucket also holds invoice attachments and logos. Knowledge files of the AI agents stay on local storage
  • The regular backend image already supports it; nothing extra to install
  • Securo never creates the bucket or changes its policies. Downloads still go through Securo's own authorized routes, so the bucket stays private: no public access, no browser credentials, no CORS policy
  • HTTPS certificates are always verified, and an http:// endpoint is refused unless you set STORAGE_S3_ALLOW_INSECURE_HTTP=true. Use that only for local development: the files travel unencrypted

The backend, the Celery worker and the MCP server all read and write attachments, so they need the same storage settings. The bundled Compose files already pass them to all three from .env; if you run the processes another way (a direct install, Kubernetes), set them on each one. After changing .env, run docker compose up -d (or docker compose -f docker-compose.prod.yml up -d) so the containers are recreated with the new values.

Bucket Permissions

  • AWS S3: grant s3:GetObject, s3:PutObject and s3:DeleteObject on the bucket's objects, plus s3:ListBucket on the bucket itself. Without ListBucket, a missing file answers 403 instead of 404
  • Garage: Garage has its own bucket permissions. Give a dedicated application key read and write on the bucket; owner permission is not needed

Moving Existing Attachments

Files already in the attachments volume are not moved for you, and the setting applies to every attachment at once (a file does not remember where it was stored). To move them:

  1. Stop the backend, the worker and the MCP server, so nothing writes new files during the copy
  2. Copy the contents of the attachments directory into the bucket, keeping each file's path inside the volume as its object key. Invoice attachments and logos come along, since they live in the same directory
  3. Check that the number of objects and their contents match the volume
  4. Set STORAGE_PROVIDER=s3 and the other settings, then start everything again. No database migration is needed

Keep the original volume until you have checked the files in the app. To go back to local storage later, copy the objects uploaded since the switch back into the volume as well, or those files are lost.

Backing Up the Bucket

In S3 mode the attachments are no longer in the attachments volume, so the volume backup does not cover them: back up the bucket alongside PostgreSQL, with your provider's backup tools or by copying it to another bucket or disk. Bucket replication is not a backup (a deletion is replicated too), and a database-only restore brings back the records without the files.

Testing Against an S3 Server

The backend's unit tests do not need an S3 server. An optional integration test runs a real round trip (upload, content type, download and deletion) against a server you choose. Point it at a dedicated test bucket, since it writes and deletes test objects under a random prefix, and give the variables only to the test process. From a checkout of the Securo repository:

SECURO_S3_TEST_ENDPOINT=https://s3.example.com \
SECURO_S3_TEST_REGION=garage \
SECURO_S3_TEST_BUCKET=securo-storage-tests \
SECURO_S3_TEST_ACCESS_KEY=test-key \
SECURO_S3_TEST_SECRET_KEY=test-secret \
uv run --directory backend --extra dev pytest tests/test_s3_storage_integration.py -v

The test is skipped when any of these variables is missing. SECURO_S3_TEST_SESSION_TOKEN is optional, for temporary credentials.

Backups

From inside the app, Download backup (in the user menu) downloads the active workspace as a zip of plain JSON, every account, transaction and rule, optionally encrypted with a password (AES-256, opens in any standard archiver). The steps further down are the server-side backup of the whole instance, which is what you restore the whole server from.

Managed Backups in the App

The Backups page (from the Backup dialog, or /backups) works on the active workspace:

  • Run backup writes a ZIP on the server, with the configuration (categories, payees, rules, budgets, recurring bills, goals, products and invoice settings), the data (accounts, transactions, assets, invoices, attachment files and the rest), or both. Download ZIP gives you the same file directly
  • Schedule and retention creates one daily or weekly, keeps the latest N (10 by default) and can also drop the ones older than a number of days. A worker checks the schedules every hour
  • Restore takes a stored backup or an uploaded ZIP (a password-protected one asks for its password), shows what it holds, and restores it into a new workspace by default. Restoring over the current workspace replaces its matching data in one transaction and asks you to type RESTORE
  • Backups leave out sign-in data, passkeys, provider credentials and bank tokens, so a restored workspace needs its bank connections set up again

Running, scheduling and restoring need a workspace role that can write; viewers can list and download. The server writes the ZIPs to /app/data/backups inside the containers, which the production Compose file maps to ./data/backups on the host. Set BACKUP_HOST_PATH in .env to keep them somewhere else (BACKUP_HOST_PATH=/srv/securo/backups), and include that folder in your own off-site copies.

Database Backup

Export the PostgreSQL database to a SQL file:

docker compose -f docker-compose.prod.yml exec db \
  pg_dump -U postgres securo > backup-$(date +%Y%m%d).sql

Database Restore

docker compose -f docker-compose.prod.yml exec -T db \
  psql -U postgres securo < backup-20260401.sql

Attachments and Other Volumes

The database is not the whole story: uploaded transaction attachments live in the attachments volume, and the agents knowledge base (if you enabled the optional AI feature) lives in agent_knowledge. A database-only restore silently loses every uploaded file, so back these up too:

docker run --rm -v securo_attachments:/data -v "$(pwd)":/backup alpine \
  tar czf /backup/attachments-$(date +%Y%m%d).tar.gz -C /data .

Restore by extracting into the volume the same way:

docker run --rm -v securo_attachments:/data -v "$(pwd)":/backup alpine \
  tar xzf /backup/attachments-20260401.tar.gz -C /data

If you store attachments in S3, they are in the bucket instead: see Backing Up the Bucket.

Automated Backups

Add a cron job for daily backups (cron runs with a minimal PATH, so use the absolute docker path):

crontab -e
0 3 * * * cd /path/to/securo && /usr/bin/docker compose -f docker-compose.prod.yml exec -T db pg_dump -U postgres securo > /backups/securo-$(date +\%Y\%m\%d).sql

Updating

Update the compose file, pull the latest images and restart:

cd /path/to/securo
git pull
docker compose -f docker-compose.prod.yml pull
docker compose -f docker-compose.prod.yml up -d

git pull comes first because a new version can change docker-compose.prod.yml (new or optional services, new settings); the images and the compose file should come from the same version. Your .env is not tracked by git, so it stays as it is.

The database migrations run automatically on startup (alembic upgrade head), so schema changes are applied during the update. Take a database backup before updating, and check the releases page for the notes of what changed.

Updating to v0.20.0

  • If your install never set its own SECRET_KEY (or still had change-me-in-production or dev-secret-change-in-production), Securo generates a unique key on the first start and keeps it in the database. Everyone is signed out once, and password reset or verification links sent before the update stop working. Saved bank credentials, LLM keys and plugin secrets keep working: they are re-encrypted under the new key
  • External MCP tokens created without your own AGENTS_MCP_JWT_SECRET stop working, because they were signed with a public key. Create a new one under Agents → Connections → External MCP access
  • To roll back to v0.19.x afterwards, first set SECRET_KEY to the value stored in the instance_secrets table, or saved credentials won't open

Updating to v0.21.0

  • Managed backups are written inside the containers to /app/data/backups, which the compose file maps to ./data/backups on the host. Set BACKUP_HOST_PATH to keep them somewhere else (see Managed Backups in the App)
  • The assistant chat is rate limited per IP with AGENTS_CHAT_RATE_LIMIT_PER_MINUTE (30 by default, 0 turns it off). Rate limits now trust X-Forwarded-For only from proxies inside TRUSTED_PROXY_NETWORKS, which defaults to the private ranges, so the shipped Compose and Traefik setups need no change
  • Signing out of an OIDC sign-in now also ends the provider session. Set OIDC_LOGOUT_URL if your provider does not publish an end_session_endpoint (see Security)

Monitoring

Check logs for any issues:

# All services
docker compose -f docker-compose.prod.yml logs -f

# Backend only
docker compose -f docker-compose.prod.yml logs -f backend

# Last 100 lines
docker compose -f docker-compose.prod.yml logs --tail 100

Check the health endpoint:

curl http://localhost:8000/api/health

Troubleshooting

Containers keep restarting: Check logs with docker compose -f docker-compose.prod.yml logs backend. Common causes: not enough RAM, port conflicts (fix with FRONTEND_PORT/BACKEND_PORT), or, on Podman, podman-compose older than 1.6.0.

Login or CORS errors from another machine: FRONTEND_URL is missing or doesn't match the URL in the browser. See the section above.

Database connection refused: The database container might not be ready yet. It has a health check, but on slow servers it may take longer. Wait 30 seconds and try again.

Out of disk space: Docker images and volumes can consume significant space. Clean up old images with docker system prune.

Permission denied on attachments: The attachments volume needs to be writable by the container user. Check volume permissions with docker compose -f docker-compose.prod.yml exec backend ls -la /app/data/.

On this page