sintoniadocs
Deployment and operations

Backend deployment

Java, PostgreSQL, configuration and persistence.

On this pageBuildConfigurationMedia and operationsImage architectureDatabase migrations with FlywayPublic channelsStable installation identityV16 upgradeV17 upgradeHistory and Android alerts update (V19)Session lifetime / Session durationRustFS storage update

Run from sintonia-backend, originally backend/. POM and Docker builds require only this checkout.

Build#

Java 25 and Maven compatible with the POM are required. Use PostgreSQL 17 and persistent storage in production; H2 is a development default.

sh
mvn test
mvn package
java -jar target/sintonia-0.1.0.jar
docker build -t registry.example.com/sintonia/backend:0.1.0 .

Configure the process environment before execution. Port 8080 is the default. Schema initialization/updates occur at startup; rehearse releases on a staging database and take a consistent backup before schema changes. Reverting the JAR alone does not roll back migrations.

The container runs as UID 10001 and requires writable persistent /app/data:

sh
docker run --name sintonia-backend --env-file .env \
  -p 127.0.0.1:8080:8080 -v sintonia-instance:/app/data \
  registry.example.com/sintonia/backend:0.1.0

Keep the runtime environment file outside Git. For the complete application stack, use the deployment repository's production Compose, not its local example.

Configuration#

SettingRequired configuration
DATABASE_URLReachable PostgreSQL JDBC URL
DATABASE_USER, DATABASE_PASSWORDDatabase account and secret
DEPLOYMENT_MODEselfhost or saas
ALLOWED_ORIGINS, FRONTEND_URLExact frontend HTTPS origin and email-link URL
UPLOAD_DIRECTORY, WEBHOOK_KEY_FILEPersistent /app/data/uploads and /app/data/webhook.key in the image
LIVEKIT_URLPublic WSS endpoint reachable by clients
LIVEKIT_API_KEY, LIVEKIT_API_SECRETMatching LiveKit credentials
SMTP settings and MAIL_FROMReal SMTP provider, credentials, authentication and STARTTLS policy
ADMIN_SETUP_TOKENRandom secret for the first administrative activation

SaaS additionally requires WEBHOOK_ENCRYPTION_KEY, 32 random bytes encoded in Base64. Selfhost may use a generated persistent webhook-key file. Email is required for verification, account recovery and protected operations; Mailpit is development-only.

Behind a trusted proxy, use SERVER_FORWARD_HEADERS_STRATEGY=framework, TLS and SSO_COOKIE_SECURE=true. Cross-site SAML POSTs may require SSO_COOKIE_SAME_SITE=none; validate the IdP over HTTPS. Preserve /events as WebSocket. The provided Caddyfile proxies the complete API origin.

Media and operations#

Use a public WSS hostname rather than an internal Docker name. Leave TURN_URLS empty when LiveKit supplies authenticated TURN. For an external coturn, configure TURN_URLS, TURN_SHARED_SECRET and optionally TURN_FORCE_RELAY=true; production needs TURN/TLS and trusted certificates. Shared secrets must never enter frontend builds.

Back up PostgreSQL, encrypted files, webhook encryption material and installation configuration consistently. User recovery backups and corporate custody do not replace operational backups. Operators do not know user recovery passwords. Rehearse restoration in isolation and preserve UUIDs/device identities across upgrades.

Check GET /api/health, login/device authorization, messages, SMTP links, uploads and two-device calls. Health only proves the process responds. This version requires one backend replica because its event/session backplane is not distributed. Separating database and media machines does not implement application-level horizontal scaling.

Image architecture#

Build for the destination server architecture, such as linux/amd64 or linux/arm64, using native CI or a validated multi-platform builder. A build on an ARM Mac does not automatically produce an AMD64 image. Pin base-image tags/digests in your release as well.

Database migrations with Flyway#

Spring Boot runs Flyway before making the backend available. SQL migrations live in src/main/resources/db/migration: V1__initial_schema.sql creates/reconciles the initial schema and V3__remembered_mfa_devices.sql adds remembered MFA devices. Java migration one.sintonia.migration.V2__Normalize_channel_names incorporates legacy channel-name normalization. spring.sql.init.mode=never disables recurring schema.sql execution.

Empty databases receive every version. A pre-Flyway installation without flyway_schema_history is adopted only if its tables and structural fingerprint match Sintonia and there are no unknown tables in the schema. The backend records baseline 0, then runs all versions, currently V1–V12. The legacy marker prevents repeated channel renaming. Unrecognized databases are rejected; do not enable automatic baseline to bypass this check. Use a dedicated application schema.

Back up PostgreSQL, uploads and operational keys before upgrading. Rehearse on an isolated copy with no outgoing mail/webhook jobs. Check versions/success in flyway_schema_history and backend health after startup. Never edit applied migrations: add V4, V5, etc. Flyway validates SQL file checksums; keep the Java migration immutable too. clean is disabled. Do not use repair to hide mismatches. Rolling back the JAR does not roll back the database: plan a corrective migration or restore a tested backup.

Public channels#

Set PUBLIC_CHANNEL_MANAGED_KEYS=true for immediate history access in new public channels. Keys are managed by the installation under its persistent operational key; the operator can access content. Private/DM/group conversations remain E2EE. Existing E2EE channels are not silently converted. Read the public-channel protection guide and preserve the key in backups.

V4 adds message/thread cursor indexes. V5 stores only server-managed public-channel keys, encrypted under the operational key. This does not enable federation or corporate custody. The client prioritizes the active conversation with parallel requests, synchronizes other channels in batches of three, and uses a 30-second fallback refresh with background key distribution limited to one cycle per minute. Presence events no longer reload the whole catalog.

Stable installation identity#

Set INSTANCE_IDENTITY_ORIGIN to the exact origin used by previous clients, and preserve it across updates. /api/health returns identityOrigin; clients keep using the page/entered address for network requests and this identifier for device keys, QR, recovery backups and saved sessions. Existing DigitalOcean installs default to https://API_DOMAIN, local installs to http://localhost:8080. Do not clear storage or rotate identities to change the login UI. Keep an existing IdP backendOrigin/redirect URI reachable.

For aliases, clients fetch canonical health without credentials and require the accessed origin in its clientOrigins list (from ALLOWED_ORIGINS). Explicitly list web/client aliases; do not use a wildcard. An unrelated server cannot obtain a saved session or device identity by claiming another identityOrigin.

V16 upgrade#

Flyway V16 runs automatically before requests are served. Back up PostgreSQL and the uploads volume together, including UPLOAD_DIRECTORY/stickers for encrypted personal collections. The migration distinguishes explicit meeting closure from scheduled end times and preserves histories, identities and backups. Upgrade the backend before clients; a rollback to an older schema requires restoring a compatible backup.

V17 upgrade#

Back up the database and volumes consistently first. Flyway V17 adds read receipts, temporary meeting rings and indexes without deleting content, keys or identities. Existing individual notification read markers are preserved without inferring a contiguous watermark. Upgrade the backend before clients to provide discovery, custody-console and audit APIs. No database reset is needed. Rollback requires a compatible backend/schema or backup restoration.

History and Android alerts update (V19)#

Update the backend before the APK/web. Flyway V19 adds device/session-bound notification grants without deleting data. The updated Android APK offers a foreground notification connection with a persistent system notification, subject to Doze/battery/force-stop restrictions; Firebase is not required. Terminated iOS apps still need APNs. Validate delivery on real hardware. Conversation history uses pages of at most 100 and a day filter in the conversation menu.

Session lifetime / Session duration#

SESSION_DURATION_DAYS=30 controls the renewable window for authorized-device sessions. SESSION_MAX_DAYS=90 is the total lifetime; use 1 <= duration <= maximum <= 365. Flyway V25 adds creation/absolute-limit metadata without replacing credentials, device identities or recovery backups. Only a still-valid session on an authorized device can renew. Reductions persist and do not revive after later increases. MFA remembered-login deadlines, revocation, blocked accounts and disabled providers remain enforced. Short federation grants and meeting admissions keep their own lifetimes. The five-minute servlet session belongs to the SSO handshake and is not the account's API session.

Removing an employee only in the IdP does not provide real-time deprovisioning of an already-issued Sintonia session; disable the local account for immediate blocking. Use the installation lifetime policy and organization's account lifecycle procedures accordingly. Deploy both the backend and app updates: the client also verifies account expiry before discarding login on an operation-specific 401.

RustFS storage update#

Compose defaults to private RustFS/S3 for blobs and worker recordings. Standalone execution retains OBJECTS_PROVIDER=filesystem; set S3 configuration explicitly to change. Keep old volumes throughout verified copying. See the full guide.

Search channels, QR codes, uploads, security…

↑ ↓ navigate ↵ open result