- Jinja 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo/workflows | ||
| defaults | ||
| files | ||
| handlers | ||
| meta | ||
| tasks | ||
| templates | ||
| .gitignore | ||
| CHANGELOG.md | ||
| LICENSE | ||
| README.md | ||
Nextcloud Talk
Installs a Nextcloud Talk high-performance backend directly on the host - no Docker involved.
The stack consists of four services, each running as its own systemd unit under a dedicated, unprivileged system user: coturn (TURN server) and janus (WebRTC MCU) from distro packages, nats-server (message bus) from an upstream release binary, and signaling (nextcloud-spreed-signaling) built from source - the only component left without a package or binary release (see Building from source).
The recording service (nextcloud-talk-recording) is intentionally not part of this
role. Unlike the other four services, it is not naturally shareable across customers: it
runs a headless browser per active recording (bursty, resource-heavy, noisy-neighbor
prone), pulls in the heaviest dependency set of any Talk component (Firefox, geckodriver,
Xvfb, PulseAudio, ffmpeg), and it processes/stores actual meeting content, which is
better kept on each customer's own instance for data-locality reasons. It only needs
network reach to this backend's [clients] internalsecret, not co-location.
Requirements
- Debian/Ubuntu host (apt-based) with systemd.
- TLS certificates provisioned by the acme role, group-readable by
ssl-cert(see Certificate access). - Outbound internet access at deploy time: nats-server is fetched as a release binary, and the Go toolchain + signaling server source are fetched and built on the host (see Building from source).
Variables
Required
| Variable | Description |
|---|---|
talk_ip |
Public IP of the host. Used as coturn's advertised external-ip and by Janus for NAT mapping. |
talk_url |
Public domain the signaling server is reachable on (no protocol prefix). |
talk_static_secret |
TURN static authentication secret shared between coturn and the signaling server. openssl rand -hex 32 |
talk_recording_secret |
Internal secret a customer-side recording service uses to authenticate to the signaling server. openssl rand -hex 32 |
talk_api_key |
TURN API key sent by the signaling server when requesting credentials. openssl rand -base64 16 |
talk_hashkey |
Session HMAC signing key for the signaling server. openssl rand -hex 32 |
talk_blockkey |
Session AES-256 block key for the signaling server (must be 16, 24, or 32 bytes). openssl rand -hex 16 |
talk_backends |
List of Nextcloud backends. Each entry requires url and secret. See Backends. |
talk_listening_ip (optional, defaults to talk_ip) is the local IP coturn actually
binds its sockets to. Only set this when talk_ip isn't directly present on a local
interface - e.g. the host sits behind NAT/port-forwarding (a firewall DNATing the
public IP to this host's private address). Binding directly to talk_ip in that case
fails at coturn startup with "Cannot assign requested address". When set, Janus also
gathers ICE candidates only on this address (--ice-enforce-list): on a multi-homed
host every other interface would be advertised under the same --nat-1-1 public IP,
but the firewall only forwards to this one.
talk_coturn_extra_listening_ips (optional, default []) adds further local IPs coturn
listens on, e.g. the internal interface that internal clients resolve the TURN host to.
Relays stay on talk_listening_ip (set as coturn's relay-ip), the address the
firewall forwards the relay ports to.
Versions
| Variable | Default | Description |
|---|---|---|
talk_nats_version |
2.14.10 |
nats-server release to install. |
talk_spreed_version |
2.2.0 |
nextcloud-spreed-signaling release to build. |
talk_go_build_version |
1.27.0 |
Go toolchain used only to build the signaling server. |
Janus's version isn't a role variable - it comes from whatever your distro packages (see Janus version below).
Paths
| Variable | Default | Description |
|---|---|---|
talk_cert_file |
/etc/ssl/{{ talk_url }}/fullchain.pem |
TLS certificate (full chain). |
talk_cert_key |
/etc/ssl/{{ talk_url }}/privkey.pem |
TLS private key. |
talk_version_path |
/usr/local/lib/talk-versions |
Tracks which version of each built component is installed. |
Ports
| Variable | Default | Description |
|---|---|---|
talk_spreed_port |
443 |
Port the signaling server listens on. |
talk_coturn_port |
3478 |
coturn TURN/STUN port. |
talk_coturn_tls_port |
5349 |
coturn TLS port. |
talk_coturn_min_port |
49152 |
coturn UDP relay port range start. |
talk_coturn_max_port |
65535 |
coturn UDP relay port range end. |
talk_janus_ws_port |
8188 |
Janus WebSocket API port. Bound to 127.0.0.1 only - never exposed externally. |
talk_janus_rtp_min_port |
10000 |
Janus RTP media port range start. |
talk_janus_rtp_max_port |
10500 |
Janus RTP media port range end. |
Security
| Variable | Default | Description |
|---|---|---|
talk_coturn_user_quota |
100 |
Max concurrent relay allocations per user. 0 = unlimited (not recommended). |
talk_coturn_total_quota |
1200 |
Max total concurrent relay allocations system-wide. 0 = unlimited. |
Resource limits
Enforced via systemd's MemoryMax= - a hard cap that invokes the OOM killer on the
unit's cgroup when breached, the same semantics as Docker's mem_limit before it. Per
systemd.resource-control(5),
this requires the unified cgroup v2 hierarchy; on legacy cgroup v1 systemd accepts the
setting but doesn't enforce it, silently, with no error. Current Debian/Ubuntu and
systemd-based LXC containers default to cgroup v2, but verify on the actual target rather
than assume it.
| Variable | Default | Description |
|---|---|---|
talk_coturn_memory |
256M |
Memory limit for coturn. |
talk_nats_memory |
128M |
Memory limit for nats-server. |
talk_janus_memory |
1G |
Memory limit for Janus. |
talk_spreed_memory |
256M |
Memory limit for the signaling server. |
Usage
Minimal setup:
talk_ip: "203.0.113.10"
talk_url: "signaling.example.com"
talk_static_secret: "{{ vault_talk_static_secret }}"
talk_recording_secret: "{{ vault_talk_recording_secret }}"
talk_api_key: "{{ vault_talk_api_key }}"
talk_hashkey: "{{ vault_talk_hashkey }}"
talk_blockkey: "{{ vault_talk_blockkey }}"
talk_backends:
- url: https://cloud.example.com
secret: "{{ vault_talk_backend_secret }}"
Backends
talk_backends is a list of Nextcloud instances the signaling server will accept
connections from. Each entry requires a url (Nextcloud base URL) and a secret (the
shared secret configured in Nextcloud's Talk signaling settings).
talk_backends:
- url: https://cloud.example.com
secret: "{{ vault_talk_backend_secret }}"
- url: https://other.example.com
secret: "{{ vault_talk_other_secret }}"
Certificate access
coturn (as turnserver) and the signaling server (as signaling) read talk_cert_file
and talk_cert_key directly - there is no container mount to smooth over permissions.
This role adds both users to the ssl-cert group; the acme role (or however certs are
provisioned) must own the private key root:ssl-cert with mode 0640 (or wider) for
either service to start.
Janus version
Janus is installed from your distro's janus package rather than built from source, so
its version tracks whatever your target release ships (e.g. Debian bookworm has 1.1.2,
trixie/sid has a newer 1.4.x) instead of the 1.3.0 the previous Docker image pinned.
This is a deliberate trade for having no compiler toolchain on this host at all; if you
need an exact Janus version this role no longer gets you there - building from source
(as a previous revision of this role did) or installing your own .deb are the
alternatives.
The distro package also ships with plugins/transports the previous Docker build never
even compiled in (notably the HTTP transport and Nanomsg, both enabled by default).
templates/janus.transport.http.jcfg.j2 and templates/janus.transport.nanomsg.jcfg.j2
explicitly disable both, so the actual exposure matches what ran before - only the
WebSockets transport, bound to loopback.
Building from source
Only the signaling server has no current package or binary release, so it's the one
component this role still builds on the host, gated by a version marker under
talk_version_path - re-running the role only rebuilds it when talk_spreed_version
actually changes. The build happens in a fresh directory under /tmp (via
ansible.builtin.tempfile, not a role variable - there's nothing to configure for a
directory that never outlives a single build), removed again in an always: block so it
is cleaned up even if the build fails partway through.
Build-time packages (make, protobuf-compiler) are left installed afterwards rather
than auto-removed, since forcibly apt autoremove-ing them risks pulling in unrelated
packages the host also needs. If you want a leaner long-term footprint, consider building
it in CI and shipping the binary as an artifact instead - tasks/build_signaling.yml
translates directly.
nats-server is likewise left at its upstream stock config, matching exactly what the previous Docker-based deployment ran.
Firewall
Docker previously managed the relevant iptables rules for published ports implicitly.
Running natively, opening these on the host firewall is now this role's caller's
responsibility:
talk_coturn_port(TCP+UDP) andtalk_coturn_tls_port(TCP+UDP) - public.talk_coturn_min_port-talk_coturn_max_port(UDP) - public, coturn relay.talk_janus_rtp_min_port-talk_janus_rtp_max_port(UDP) - public, Janus media.talk_spreed_port(TCP) - public.talk_janus_ws_port(TCP) and NATS (4222/TCP) - both explicitly bound to127.0.0.1in their own config (not just left to a firewall), so no firewall action is required.
Uninstall
To stop and remove every service, package, binary, config, systemd unit and system user this role created (irreversible):
talk_uninstall: true