Sentry is a neat little program to report crashes. And it's the only thing available for flutter. So how do you selfhost this without a nightmare ?

First of all: Sentry is ~32 Containers. And it likes to eat a lot of RAM for doing nothing. Because who doesn't need multiple time series databases - especially if all you wanted was crash reports.

Anyway I disgress, let's get it starting. All of this assumes debian 11. I won't cover the nginx/apache setup, only wrangling the docker compose stuff.


Clone sentry somewhere. Probably sudo useradd sentry and then go to /home/sentry and perform a

git clone

Now if you've done that, edit the .env file as you like. My recommendation is to change the docker-compose.yml:


Otherwise clickhouse will eat a lot of RAM for nothing, and your machine alerts might annoy you.


Now we need docker compose. If you have that, you just run

# allow user sentry to run docker compose commands
sudo usermod -a -G docker sentry
# run stuff as user sentry
sudo -u sentry -g sentry bash
# install things
# start a test run inside the sentry user and setup prompted stuff
docker compose up

I didn't use -d here on purpose, kill it with Ctrl + C if that works and let us automate this.

Auto start

To automate the startup and updates, we want a new service file:

# /etc/systemd/system/sentry.service
Description=Sentry Host

# prevent prompts, not perfect but works
ExecStartPre=/home/sentry/self-hosted/ --report-self-hosted-issues --skip-commit-check --skip-user-creation
ExecStart=/usr/bin/docker compose up -d --remove-orphans
ExecReload=/usr/bin/docker compose up -d --remove-orphans
ExecStop=/usr/bin/docker compose down


Reload the systemd daemon and start it:

sudo systemctl daemon-reload
sudo systemctl start sentry

Afterwards you can check that it's running and check the logs:

sudo systemctl status sentry
sudo journalctl -u sentry -e

If you see something like[1648810]: cp: cannot create regular file 'postgres/wal2json/': Permission denied

Then make sure that /home/sentry is fully owned by the sentry user:

sudo chown -R sentry:sentry /home/sentry

If all of this works, enable this for the next boot:

sudo systemctl enable sentry

Auto reloading

All of this is fine, but unless you auto-restart your VM every couple days, you might wanna restart this. Systemd timers to the rescue.

Let's create a restart unit:

# /etc/systemd/system/sentry_restart.service
Description=Sentry restart

ExecStart=/bin/systemctl restart sentry

And a timer unit to run this job:

# /etc/systemd/system/sentry_restart.timer
# or choose any other time frame for restarts


Now enable it we run

sudo systemctl enable sentry_restart.timer
sudo systemctl start sentry_restart.timer


The gist is to run the, run sentry once for the manual stuff and then automate it via systemd units and a restart timer. Also you can't skip the, running docker compose pull + up will end in tears.