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
Support for Self-hosted Multi-Org Deployments (Enterprise Only) #1706
Conversation
Your preview environment pr-1706-bttf has been deployed. Preview environment endpoints are available at: |
@@ -106,8 +106,7 @@ export default function InAppHelp() { | |||
className="btn btn-premium font-weight-normal my-2 w-100" | |||
onClick={() => setUpgradeModal(true)} | |||
> | |||
Start {isCloud() ? "Free" : "Enterprise"} Trial{" "} | |||
<GBPremiumBadge /> | |||
Start Free Trial <GBPremiumBadge /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Higher up in this file we set const showUpgradeModal = config && !hasCommercialFeature("livechat") && isCloud();
and we are only showing this section if showUpgradeModal is true, so this check is superfulous.
|
||
// Default to true, false only if explicitly set to "false" | ||
export const ALLOW_SELF_ORG_CREATION = | ||
process.env.ALLOW_SELF_ORG_CREATION !== "false"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We check for truthy/falsy values all over the place in this file. We should add a helper function to parse a string into a boolean so we're able to properly support things like 0
, 1
, true
, false
, TRUE
, FALSE
, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I fell like that is a refactor that should be separate from this PR.
packages/front-end/pages/api/init.ts
Outdated
cloud: !!IS_CLOUD, | ||
cloud: IS_CLOUD === "true", | ||
isMultiOrg: IS_MULTI_ORG === "true", | ||
allowSelfOrgCreation: ALLOW_SELF_ORG_CREATION !== "false", // Default to true, false only if explicitly set to "false" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, we should have a "parse env string as boolean" function in the shared package and use it both here and the back-end
Deploy preview for docs ready! ✅ Preview Built with commit 6a0cf09. |
Features and Changes
Adds a IS_MULTI_ORG env var.
Changes many of the locations where we check for IS_CLOUD or isCloud to instead check to see if it is a multi-org installation.
Testing
Test sign up flow:
Add the following env vars to /packages/front-end/.env.local AND /packages/back-end/.env.local
IS_MULTI_ORG=true
ALLOW_SELF_ORG_CREATION=false
Remove mongo dir.
Restart mongo.
Restart app.
Sign up first user.
Look in LeftNav and see no Settings->Admin
In MongoCompass add
superAdmin: true
for the first user.See the admin screen.
In private browser:
Register a new user.
See message that they can't create an org without admin.
Modify packages/front-end/components/Auth/CreateOrganization.tsx to not care about ALLOW_SELF_ORG_CREATION
Enter a new org name and submit.
See error message from the back-end that they can't create an org without an admin.
Revert packages/front-end/components/Auth/CreateOrganization.tsx
See message in front-end again that the can't create an org without an admin.
Remove ALLOW_SELF_ORG_CREATION=false from .env.local files
Enter a new org name and submit and see them join the new org.
Go to http://localhost:3000/settings/team and see that the orphaned user list is not there.
Testing IS_CLOUD=true:
Set to IS_CLOUD=true
Set SSO_CONFIG=prod's SSO_CONFIG
Set IS_MULTI_ORG=true
Remove ALLOW_SELF_ORG_CREATION
Restart servers.
In private browser:
Register a new user
Create a new org with that user
In super user window, invite new user to an org as an admin
Back in private window go to settings->team and see that they don't see the orphaned users
In super user window go to /admin and create a new organization.