Skip to content

Rename onpremise to self-hosted in configs #30528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 9, 2021
Merged

Conversation

chadwhitacre
Copy link
Member

Big things to think about here are backcompat for both getsentry and self-hosted users. Customizations? Plugins? FE? BE?

@chadwhitacre chadwhitacre requested a review from a team as a code owner December 9, 2021 12:21
@chadwhitacre chadwhitacre requested review from a team December 9, 2021 12:21
Base automatically changed from cwlw/remove-remote-newsletter to master December 9, 2021 12:22
@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2021

size-limit report

Path Base Size (81cc160) Current Size Change
src/sentry/static/sentry/dist/entrypoints/app.js 52.88 KB 52.88 KB +0.02% 🔺
src/sentry/static/sentry/dist/entrypoints/sentry.css 70.88 KB 70.88 KB 0%

@chadwhitacre
Copy link
Member Author

k so I'm gonna ignore those codecov reds. 👀

The visual diff though seems actually relevant, let me make sure I understand what this is doing ...

@@ -20,7 +20,8 @@ def get_default_context(request, existing_context=None, team=None):
"URL_PREFIX": options.get("system.url-prefix"),
"SINGLE_ORGANIZATION": settings.SENTRY_SINGLE_ORGANIZATION,
"PLUGINS": plugins,
"ONPREMISE": settings.SENTRY_ONPREMISE,
"ONPREMISE": settings.SENTRY_SELF_HOSTED, # deprecated, use ...
"SELF_HOSTED": settings.SENTRY_SELF_HOSTED, # ... this instead
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these contexts? What consumes them?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduced in #3350 so Django templates can vary:

{% if ONPREMISE %}<a href="/out/">{% trans "Migrate to SaaS" %}</a>{% endif %}

We're not using this anymore, but if we remove this then we should probably remove SINGLE_ORGANIZATION as well, but I want to be conservative here so I am leaving these in.

# for now, but in the rest of _this_ codebase we should reference
# SENTRY_SELF_HOSTED.
SENTRY_ONPREMISE = True # deprecated, use ...
SENTRY_SELF_HOSTED = SENTRY_ONPREMISE # ... this instead
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the risky part. We need to make sure that getsentry (and I guess whatever goofy third-party stuff exists out in the wild) doesn't break. As we can see, SENTRY_ONPREMISE defaults to true, and probably nothing but getsentry overrides that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not too important for this pr, but if we want to remove SENTRY_ONPREMISE we should also check with the single tenant team to see whether they set this variable differently as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call @wedamija. This came up at #30528 (comment) as well, and I've put single-tenant on the pile at getsentry/self-hosted#796 to make sure it isn't forgotten. Close one!

href: LINKS.FORUM,
to: `${organizationSettingsUrl}support`,
};
const supportText = isOnPremise ? t('Community Forums') : t('Contact Support');
const supportText = isSelfHosted ? t('Community Forums') : t('Contact Support');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I should update the forums link as well to keep up with getsentry/self-hosted#1151, but that's out of scope for this repo.

@@ -7,12 +7,12 @@ import DefaultSettings from 'sentry/plugins/components/settings';
type Props = DefaultSettings['props'];

type State = DefaultSettings['state'] & {
showOnPremisesConfiguration?: boolean;
showSelfHostedConfiguration?: boolean;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ancient plugin has a few config values that are only relevant on self-hosted. This is the source of the screenshots that changed.

@@ -123,7 +123,7 @@ def get_config(self, project, **kwargs):
},
]

if settings.SENTRY_ONPREMISE:
if settings.SENTRY_SELF_HOSTED:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ancient plugin. See settings.tsx.

@@ -153,7 +153,8 @@ def get_client_config(request=None):
"statuspage": _get_statuspage(),
"messages": [{"message": msg.message, "level": msg.tags} for msg in messages],
"apmSampling": float(settings.SENTRY_FRONTEND_APM_SAMPLING or 0),
"isOnPremise": settings.SENTRY_ONPREMISE,
"isOnPremise": settings.SENTRY_SELF_HOSTED, # deprecated, use ...
"isSelfHosted": settings.SENTRY_SELF_HOSTED, # ... this instead
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second-riskiest part. getsentry does consume the isOnPremise config key in some places. Third-party JavaScript (plugins?) might as well. Preserve the key!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will we be removing isOnPremise after getsentry is updated?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to, but I'm not sure how much impact that has on self-hosters. Probably not much? I'd like to at least get one release out with both keys and a notice in the changelog, then remove "sometime" after that. Thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd imagine it shouldn't affect them, if they are customizing their install, they shouldn't have a need to differentiate between the two? But otherwise sounds good

Copy link
Member Author

@chadwhitacre chadwhitacre Dec 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean the default is true. Nobody except us in SaaS should need to change the default. Also yes, like you say, nobody in the wild building their own plugins or whatever should need to vary their behavior on whether this config is true or false, realistically they would just always deliver whatever behavior they're building for their custom app/plugin. I think I'm convinced that we can remove this sooner rather than later (meaning, at the earliest, after getsentry is updated and 21.12.0 goes out).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm ... single-tenant, though ... 🤔

Copy link
Member Author

@chadwhitacre chadwhitacre Dec 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, PR needed there as well!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted on getsentry/self-hosted#796. 👍

Copy link
Member

@billyvg billyvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code wise this seems good, I think it'd be good to get a review from @getsentry/ecosystem too though

Copy link
Contributor

@NisanthanNanthakumar NisanthanNanthakumar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 changes to the sessionstack plugin look good!

Copy link
Member

@wedamija wedamija left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be wise to split out the FE/BE pieces of this pr. Deploy the BE piece first then the FE, that way we make sure we don't have any issues during deploy.

# for now, but in the rest of _this_ codebase we should reference
# SENTRY_SELF_HOSTED.
SENTRY_ONPREMISE = True # deprecated, use ...
SENTRY_SELF_HOSTED = SENTRY_ONPREMISE # ... this instead
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not too important for this pr, but if we want to remove SENTRY_ONPREMISE we should also check with the single tenant team to see whether they set this variable differently as well.

@chadwhitacre chadwhitacre merged commit 31ad2a9 into master Dec 9, 2021
@chadwhitacre chadwhitacre deleted the cwlw/rename-configs branch December 9, 2021 20:30
chadwhitacre added a commit that referenced this pull request Dec 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants