We self-host Sentry for the client stores we look after. The error and CSP reporting those stores send would cost about $2,700 a month on sentry.io, and about £30 on our own server, which is what makes it cheap enough for clients to opt in. The team gets error and CSP reporting, Core Web Vitals and session replays across every client from one place. I wrote up the first year in Is Self-Hosted Sentry Worth It?
What does self-hosted Sentry cost?
About £30 a month in hosting for 9 to 11 million events, as of November 2024:
| What | Figure |
|---|---|
| Ingest | 9 to 11 million events a month across clients |
| Hosting | about £30 a month for a Hetzner dedicated server |
| sentry.io calculator, same usage | about $2,700 a month (November 2024) |
The server is a 14-core i5-13500 with 64GB of RAM and two 500GB NVMe drives in RAID 0. The one-year review has the screenshots of both the usage and the calculator estimate.
How is it installed and kept up to date?
Sentry’s self-hosted release is a Docker Compose stack of over 50 containers, installed once by hand and managed by Ansible from then on. This is the core of the setup guide, pinned to the release that was current when I wrote it:
git clone https://github.com/getsentry/self-hosted.git /opt/sentry
cd /opt/sentry
git checkout 24.1.0
sudo ./install.sh --report-self-hosted-issues
docker compose restart
An update is a version bump in the playbook, committed to git; the pipeline runs the playbook, pulls the release onto the server and restarts the stack. Release notes get read first, because Sentry does ship hard stops and breaking changes that need config changes before the update.
How do CSP reports turn into Magento config?
As a pull request someone reviews. The stores report Content Security Policy violations to Sentry, and since we host it ourselves, that costs disk rather than quota. Some Go tooling exports recent reports through the Sentry API or a CSV export, drops known junk such as chrome-extension:// (the csp-wtf list is a good source), converts the rest into Magento’s csp_whitelist.xml format, merges it with the project’s existing config and opens the pull request.
The scripts are covered in Managing Magento 2 CSP_Whitelist.xml rules with Sentry. Only the export step talks to Sentry, so swapping report provider should only mean replacing that one script.
What went wrong
Disk. Sentry stores its data in Postgres, and reclaiming space with a full vacuum writes a new copy of the table before dropping the old one, so it needs free space to free space. Sentry’s built-in retention cleanup has been unreliable for us, and the server reached 95% early on.
The disk alert on this server now fires at 70% (about 300GB free) instead of the 85 to 90% we use elsewhere. By the time of the review it had only been triggered once or twice. The disk clean-up runbook covers getting out of the corner if it happens anyway.