HUB
Sign inSign up

paularlott/gossiper

By paularlott

•Updated 11 days ago

Clustered, multi-tenant Mercure hub: real-time updates over SSE, one static Go binary.

Image
Networking
Developer tools
0

928

paularlott/gossiper repository overview

⁠Gossiper

Gossiper is a clustered, multi-tenant Mercure⁠ hub. Publish an update to any node and every subscriber on a matching topic receives it, whichever node it is connected to.

  • Mercure 1.0 and draft-07: works with Symfony, API Platform, FrankenPHP apps, Laravel broadcasters and a browser EventSource.
  • Clustered: identical nodes behind a load balancer, no sticky sessions, no Redis.
  • Multi-tenant: each tenant has its own hub and keys, picked by host name, managed live through an admin API.
  • Fast for services: a streaming publish carries updates at more than ten times the rate of one POST each.
  • Small and safe: a static binary on distroless, running as a non-root user.

Images are built for linux/amd64 and linux/arm64.

⁠Quick start

docker run -d -p 8080:8080 -v gossiper-data:/data \
  -e MERCURE_PUBLISHER_JWT_KEY="$(docker run --rm paularlott/gossiper genkey)" \
  -e GOSSIPER_ANONYMOUS=true \
  -e GOSSIPER_HISTORY_DB=/data/history.db \
  paularlott/gossiper

The hub is at https://localhost:8080/.well-known/mercure. It serves HTTPS with a self-signed certificate, kept in /data/tls. To use your own certificate, set GOSSIPER_TLS_CERT and GOSSIPER_TLS_KEY. Behind a proxy that terminates TLS, set GOSSIPER_HTTP_ONLY=true instead.

⁠Configuration

Every setting is a GOSSIPER_* environment variable: the flag name in capitals, with dashes as underscores. For example, --max-publish-size becomes GOSSIPER_MAX_PUBLISH_SIZE. FrankenPHP's MERCURE_* variables work too.

VariablePurpose
MERCURE_PUBLISHER_JWT_KEYpublishers' JWT key (HMAC secret or PEM public key)
GOSSIPER_ANONYMOUSallow subscribers without a token
GOSSIPER_HISTORY_DBkeep the history across restarts (e.g. /data/history.db)
GOSSIPER_CLUSTER_KEY, GOSSIPER_CLUSTER_PEERSjoin nodes into a cluster (port 7946 tcp and udp)
GOSSIPER_ADMIN_LISTENserve the admin API and metrics on an internal address
GOSSIPER_LOG_FORMATjson (the image default) or console

⁠Image notes

  • State: lives in /data, owned by UID 65532.
  • Health check: /gossiper healthcheck checks readiness; the image's HEALTHCHECK runs it.
  • Licences: licence notices are in /licenses.

Tag summary

Content type

Image

Digest

sha256:bd4420fb0…

Size

7.8 MB

Last updated

11 days ago

docker pull paularlott/gossiper