How to Self-Host Kodera with Docker Compose: Architecture, PostgreSQL, Matrix Synapse, and OIDC
Self-hosting gives your organisation operational control. It also makes your team responsible for identity, availability and recovery. Start with a reproducible staging environment.
Prepare the release to deploy
This guide is a deployment planning walkthrough. Hosted Kodera Community is open at community.kodera.io, and the desktop deployment assistant currently validates inputs rather than installing an instance. The interactive npx create-kodera generator does write the skeleton of a Community instance: Docker Compose files, reverse-proxy TLS termination, Synapse room policy and fresh local secrets. Use the Community profile and documentation shipped with the release you evaluate as the authority for exact service names, supported versions and configuration.
Prepare a Linux host with Docker Engine and the Compose plugin, persistent storage, DNS names and HTTPS termination. Choose the Matrix server identity carefully before creating users. A single node is simple to understand but has a shared failure domain: a host outage can interrupt every service. Size storage and memory from a representative workload, including attachments and concurrent calls.
Map the service boundaries
The intended single-node architecture combines the Kodera control plane, PostgreSQL, Matrix Synapse and the room-policy module. PostgreSQL stores durable service state; Synapse handles Matrix messaging. The policy module enforces room access rules at the messaging boundary. Keep database access private, separate service credentials and verify that the policy module matches the selected server release.
LiveKit provides the audio and video transport. TURN relays help clients connect through restrictive networks. Treat media reachability as a separate acceptance test: a successful HTTPS page load does not prove that UDP media or TURN works. Configure the public addresses, certificates and firewall rules documented for the chosen deployment.
Connect an external identity provider
The Community profile does not supply an identity provider. Prepare a compatible external OIDC provider, such as Keycloak, and a dedicated client configuration for each relying service. Record the issuer, client identifiers, allowed redirect URIs and claim mapping. Keep client secrets in the deployment’s secret store and require exact HTTPS redirect URIs.
Configure authentication according to the release’s trust model. When Synapse authenticates directly through OIDC, its provider configuration and callback URL must match the identity provider. Do not assume one client registration automatically configures every service. Test a normal sign-in, denied access, account removal and recovery for an administrator before inviting colleagues.
Bring up staging and test the actual journey
Run npx create-kodera to generate that configuration, or populate it from the release’s example templates and fresh local secrets. Validate the Compose configuration without printing resolved secrets into shared logs. With the correct profile selected, docker compose config --quiet validates the model; docker compose up -d --wait starts services and waits for their health checks. A healthy container is a starting point, not a complete readiness verdict.
Test two accounts: sign in, join an allowed room, refuse an unauthorised room, exchange a message, reconnect and place a call from another network. Verify documents and extensions only when they are enabled in that release. Record the image digests and configuration revision so the same environment can be recreated.
Automate backups and practise recovery
Schedule PostgreSQL backups together with the durable media, configuration and server signing keys required to restore service identity. Encrypt backup storage, restrict access and keep a copy outside the host’s failure domain. Choose retention and recovery objectives explicitly; an automated job must alert on failed or missing backups.
Restore into an isolated environment before calling the backup process reliable. Check account access, room history, attachments and identity continuity. For upgrades, read the release notes, test migrations on a restored copy and plan rollback around database compatibility. Monitor disk capacity, database health, authentication failures and call connectivity. Self-hosting succeeds when a colleague can follow the recovery procedure without the original installer.