How to install/upgrade to v10 on a Swarm cluster?

Hi, first of all, thanks for the amazing product that is Sentry, we have been using the 9.1.2 self-hosted version on our Swarm cluster for a while now and it’s been very helpful to improve the way we detect and handle errors!

I wanted to tackle the upgrade to v10 today, but was a bit thrown off by the new way of doing things. Am I right thinking that using the install.sh script would only ever work if it ran from the machine the current Sentry instance is running on, with it being already deployed only with docker-compose and nothing else?

If that’s the case, I reckon I’m not the first and won’t be the last to wonder how to install and upgrade Sentry v10 on a Swarm or k8s cluster. I initially thought I’d be able to just build my image with our custom configs in a GitLab-CI pipeline, and then simply update the image on our cluster, letting Sentry do the rest when it comes to migrations and all other stuff (like what GitLab is doing in its Omnibus package for instance), but I guess I was mistaken?

Nonetheless, Sentry really is a good product, and we are more than happy to tackle things a bit more manually to make it work. It seems a few unofficial Heml charts have already been published, but we are actually looking for a solution for a Swarm stack. Moreover, it would be great if we were able to migrate our existing 9.1.2 instance without losing any data or configuration.

Is someone willing to help a bit with this task? This topic could probably be helpful for others who are facing the same issue. Even just a global overview of the workflow we should implement, like steps to run from CI, how to deploy, handle migrations and so on, would be tremendously helpful.

Yup, this is the case unless you are using a remote Docker daemon. But the script mostly assumes local access.

Yup, you are neither the first nor the last person :slight_smile:

This is also correct. All of the migration and other set up stuff is handled by the install script, not the Sentry image. I was entertaining the idea of Sentry running migrations automatically but couldn’t find an efficient and safe way to check this at every start up so shelved the idea.

Happy to say that this is possible. It’s just not a solution we provide out of the box.

I don’t have direct experience with Swarm or k8s but the steps are not that complicated. The very first thing I’d do is to replicate the cluster of services from the docker-compose.yml file and bring them up with the correct configuration to make sure they can talk to each other. It’s probably wise to try this with a fresh installation first. This would likely entail porting your custom config files over to the new ones (or vice-versa, porting the changes for v10 to your config).

This would also include running snuba bootstrap and snuba migrate commands so it can create necessary Kafka topics and Clickhouse tables. The details of this command is inside the install.sh file.

After that, upgrade the Postgres instance to 9.6 with the data migration. install.sh uses the tianon/postgres-upgrade:9.5-to-9.6 image for this but you can do it however you prefer.

Finally, you’d need to run sentry upgrade on the sentry image with all services connected and volumes mounted so the event data can be safely migrated to Clickhouse. If you have too many old events or large events, you may need to tune some settings in Kafka and rerun this step so make sure you have a back up before proceeding.

After this step, you should have a perfectly running, migrated Sentry 10 instance and any future upgrades should be easier.

Hope this helps. Apologies for the late response and happy to answer any questions you may have.