Setting Up a Local Snuba Development Environment for Sentry Monitoring
This guide walks through cloning the Sentry and Snuba repositories, installing macOS system dependencies, configuring Python and Rust toolchains, launching Docker containers for ClickHouse, Kafka and Redis, running Snuba migrations, and finally starting the dev server to query events via a local UI.
Clone Repositories
git clone https://github.com/getsentry/sentry.git
git clone https://github.com/getsentry/snuba.gitInstall System Dependencies (macOS example)
Install Xcode command‑line tools and run the Brewfile in the sentry directory.
xcode-select --install
cd sentry
brew bundle --verboseIf Docker Desktop is already running, comment out the line cask 'docker' in the Brewfile.
Build Toolchain
Sentry requires pre‑built Python wheels for Linux (manylinux1) and macOS 10.15+. On other platforms install the Rust toolchain (see https://www.rust-lang.org/tools/install) so that binary modules can be compiled.
Python Environment
pyenv is installed by the Brew bundle. Create a virtual environment and activate it.
make setup-pyenv
python -m venv .venv
source .venv/bin/activate
which python # should point to $HOME/.pyenv/shims/pythonStart Sentry Services (excluding Snuba)
source .venv/bin/activate
sentry devservices up --exclude=snubaDocker pulls and starts containers for Postgres, ClickHouse, Zookeeper, Kafka and Redis. Verify with docker ps.
Configure Snuba
cd snuba
make pyenv-setup
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip==21.1.3
make developRun Snuba Migrations
snuba migrations list # shows pending migration files
snuba migrations migrate --force # applies all migrationsVerify ClickHouse Tables
docker exec -it sentry_clickhouse clickhouse-client
select count() from sentry_local;The query returns 0, confirming the tables are reachable.
Inspect Snuba Entities
snuba entities list
# discover, events, groups, …, transactions, sessions, …Start Development Server
snuba devserverOpen http://localhost:1218/events/snql in a browser to view the simple SnQL UI.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
