Skip to content

Connect Sentry

Run self-hosted Sentry on a Kafka cluster over SASL_SSL.

Updated View as Markdown

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 readWrite or admin preset, such as sentry, used below. Its Secret holds bootstrapServers, username and password.
  • 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.

  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
  2. In sentry/sentry.conf.example.py (copied to sentry.conf.py by the installer), give the SASL and CA settings "" as their default instead of None, and remove the two client-certificate lines (ssl.certificate.location and ssl.key.location): the cluster uses a username and password, not client certificates.

  3. 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}
  4. 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.crt

    In relay/config.example.yml (copied to relay/config.yml by the installer), set the same servers, user and password in processing.kafka_config, with ssl.ca.location /etc/ssl/certs/ca-certificates.crt.

  5. Trust the CA bundle with Sentry’s custom CA feature: put it in certificates/ as a .crt file and install with SETUP_CUSTOM_CA_CERTIFICATE=1. On a first install, run setup-custom-ca-certificate.sh before install.sh, so Snuba’s image trusts the bundle when the installer first starts it, and add the docker-compose.override.yml it 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>

See Topics and consumer groups.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close