Self-hosted Sentry sends events through Kafka. Point it at a Kafka cluster with the cluster’s bootstrap name, a user and the CA bundle, and Sentry’s installer creates the topics it needs.
Before you start
- A Kafka cluster (4.3 or later). Topics are created automatically by default
(
autoCreateTopics), as Sentry expects. - A user with the
readWriteoradminpreset, such assentry, used below. Its Secret holdsbootstrapServers,usernameandpassword. - The CA bundle on the hosts running Sentry’s containers.
Settings
Self-hosted Sentry’s own external Kafka patches (optional-modifications/patches/external-kafka)
point every service at the cluster and turn off the bundled Kafka. Apply them, then make three
changes the patches need for a Kafka that takes a username and password. This is tested with
self-hosted Sentry 26.10.1.
-
Apply the patches, from the self-hosted checkout:
for p in .env config.example.yml sentry.conf.example.py docker-compose.yml; do patch -p0 < optional-modifications/patches/external-kafka/$p.patch done -
In
sentry/sentry.conf.example.py(copied tosentry.conf.pyby the installer), give the SASL and CA settings""as their default instead ofNone, and remove the two client-certificate lines (ssl.certificate.locationandssl.key.location): the cluster uses a username and password, not client certificates. -
In the same file, put the options under
common, so consumers and the admin client get them too:KAFKA_CLUSTERS["default"] = {"common": DEFAULT_KAFKA_OPTIONS} -
In
.env, set the cluster’s bootstrap servers and the user, with the security protocol in lowercase (Sentry’s uptime checker accepts only lowercase):KAFKA_BOOTSTRAP_SERVERS=kafka-….us-west-1.ezghcompute.com:9093 KAFKA_SECURITY_PROTOCOL=sasl_ssl KAFKA_SASL_MECHANISM=SCRAM-SHA-512 KAFKA_SASL_USERNAME=sentry KAFKA_SASL_PASSWORD=<password from the user's Secret> KAFKA_SSL_CA_LOCATION=/etc/ssl/certs/ca-certificates.crtIn
relay/config.example.yml(copied torelay/config.ymlby the installer), set the same servers, user and password inprocessing.kafka_config, withssl.ca.location/etc/ssl/certs/ca-certificates.crt. -
Trust the CA bundle with Sentry’s custom CA feature: put it in
certificates/as a.crtfile and install withSETUP_CUSTOM_CA_CERTIFICATE=1. On a first install, runsetup-custom-ca-certificate.shbeforeinstall.sh, so Snuba’s image trusts the bundle when the installer first starts it, and add thedocker-compose.override.ymlit prints.
A user with the readWrite preset is enough for the installer and every Sentry service.
Over the plaintext port, use port 9092 and
KAFKA_SECURITY_PROTOCOL=sasl_plaintext, in .env and in Relay’s settings.
Topics
Sentry’s topics are listed on the cluster’s Topics tab, as Created by app. Snuba creates its
43 topics, including events, transactions, outcomes and snuba-commit-log, with a replication
factor of 1; the topics Sentry creates as it runs take the cluster’s defaults. The cluster keeps every
topic as it was created.
On a replicated cluster, raise Snuba’s topics to three copies after the install, so they keep serving when a node is out of service: Raise to 3 copies on the Topics tab, or
ezgh hosted-queues clusters raise-replication <cluster>