A self-hosted local Sentry
I often need to experiment with monitoring settings and error/metric collection across various environments.
Rather than carving out a separate project in our shared Sentry,
I prefer to spin up my own local copy.
The deployment takes a while; on an “old” laptop it can take about ten minutes.
Setup and launch
Grab the source for the getsentry/self-hosted project:
scm https://github.com/getsentry/self-hosted -
cd $(scm last)
Make sure the compose plugin for docker is set up:
docker compose | head -2
Usage: docker compose [OPTIONS] COMMAND
You can use the ancient docker-compose if you’re really attached to it.
In the root of the resulting getsentry/self-hosted working copy, find the .env file. If the defaults work for you, move on to the install. If not,
copy its contents into .env.custom and tweak as needed.
The setting I most often change is SENTRY_BIND=9000 — the port the web
UI will be exposed on.
Run the install script. It doesn’t change anything on the filesystem; it
just builds and configures the docker images. Inspect it yourself if you’d like.
./install.sh --skip-user-prompt
Once the install finishes, create a superuser:
docker compose run --rm web \
createuser \
--superuser \
--email admin@localhost \
--password secret
Start the configured environment:
docker compose --env-file .env.custom up -d
Once all the containers are up, head to wherever your dockerd is running
(most likely localhost) and use the port from SENTRY_BIND (if you didn’t
change it, that’s 9000).
That’s it — your personal Sentry install is ready for experiments.