getsentry / self-hosted

Sentry, feature-complete and packaged up for low-volume deployments and proofs-of-concept
https://develop.sentry.dev/self-hosted/
Other
7.77k stars 1.75k forks source link

feat(relay): Forward /api/0/relays/* to inner relays #3144

Closed iambriccardo closed 3 months ago

iambriccardo commented 3 months ago

This PR updates the nginx configuration to forward to inner relays all requests that go to /api/0/relays/*. The rationale behind this change is that we don't want any more such endpoints to be hit in Sentry (for example when fetching project configs since in https://github.com/getsentry/sentry/pull/72926 we removed the support to return the reduced configuration).

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.01%. Comparing base (05fa62a) to head (3c75977).

:white_check_mark: All tests successful. No failed tests found.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #3144 +/- ## ======================================= Coverage 99.01% 99.01% ======================================= Files 3 3 Lines 203 203 ======================================= Hits 201 201 Misses 2 2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

stayallive commented 3 months ago

@iambriccardo when deploying this change the relay container simply stops working because it can't connect to the relay container. Isn't the inner relay trying to retrieve the project config from itself now?

Dav1dde commented 3 months ago

@stayallive can you try switching the upstream in the Relay config from:

https://github.com/getsentry/self-hosted/blob/da06c0f230454b91fada3980ba2e1e012cedf1d2/relay/config.example.yml#L2

to upstream: "http://sentry:9000/"?

Dav1dde commented 3 months ago

Actually nvm, the sentry is just the Nginx upstream, so should be fine: https://github.com/getsentry/self-hosted/blob/da06c0f230454b91fada3980ba2e1e012cedf1d2/nginx/nginx.conf#L74-L77

Relay should connect to Sentry directly 🤔

stayallive commented 3 months ago

I see, my relay is connecting to nginx though... this might have changed in the past... let me correct that!

stayallive commented 3 months ago

Okay, user error here. Sorry!

I think a few (hundred) releases ago there was some other issue that was solved by connecting relay through nginx, but that has long been not needed anymore and was forgotten to revert. Seems to all be working now connecting straight to sentry! Thanks for the hint!