openboxes / openboxes-devops

Infrastracture as Code artifacts for OpenBoxes.
3 stars 1 forks source link

OBPIH-6731 Unify Sentry Projects #74

Closed EWaterman closed 5 days ago

EWaterman commented 1 month ago

https://pihemr.atlassian.net/browse/OBPIH-6731

We currently have one Sentry project for each of our environments. Sentry now recommends that we create one project for the backend and one for the frontend, and then create environments within those. I restructured vault_rimu to account for this.

I changed:

sentry_dsn:
  obdev1: https://...@.ingest.us.sentry.io/...
  obdev2: https://...@.ingest.us.sentry.io/...
  ...

to:

sentry:
    environments:
      obdev1:
        name: obdev1
        legacy: true
        dsn:
          backend: https://...@.ingest.us.sentry.io/...
      obdev3:
        name: obdev3
        legacy: false
        dsn:
          backend: https://...@.ingest.us.sentry.io/...
          frontend_web: https://...@.ingest.us.sentry.io/...
    ...

which will add the SENTRY_ENVIRONMENT, SENTRY_DSN_FRONTEND_WEB, and SENTRY_DSN_BACKEND environment variables to the /var/lib/tomcat7/bin/setenv.sh and /var/lib/tomcat85/bin/setenv.sh files.

jmiranda commented 1 month ago

One small caveat: As far as I remember, any of the servers that are still running the old stack (like obdev1) cannot use the new DSN format. So we need to use the "legacy" format for those servers. I know there was a discussion about this (probably in an OBS ticket) but I cannot find the ticket.

With that said, feel free to test out the new DSN format on those servers just to either prove me wrong or document the behavior I'm remembering.

Secondly, we should have a plan to migrate the other servers to the new DSN. And if we cannot maintain the OBNAV DSN in play then we should have a discussion about that as well.

EWaterman commented 2 weeks ago

This is ready for re-review. See the sentry.properties changes in https://github.com/openboxes/openboxes/pull/4898/files#diff-6f19ba8de923c2d9f20664ce59ef3df7454961589594685224b416e4201d9ab1 for where these env variables are used

EWaterman commented 1 week ago

I'll add some Sentry docs to your PR to describe how people can go about configuring it.

This PR isn't the end of what I want to do with Ansible. I'd love (as you said) to really open us up to a wider range of configuration options (with preference to yaml, followed by environment variables) for not just Sentry but our system overall.

jmiranda commented 1 week ago

Yup exactly. I know we have a few tickets scattered around that highlight the need for overrides in config files, system properties and environment variables. Let me know if we need to consolidate those a little better.