OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
fix(self-hosting): upgrade migrates BULLBOARD_* credentials to ADMIN_*
Carl-Gerhard Lindesvärd5d619d3c4cd7
diff --git a/self-hosting/cli/src/doctor/checks.ts b/self-hosting/cli/src/doctor/checks.tsindex fa909f5f9..94cdbc985 100644--- a/self-hosting/cli/src/doctor/checks.ts+++ b/self-hosting/cli/src/doctor/checks.ts@@ -29,11 +29,15 @@ const REMOVED_ENV_VARS = ['CHART_VALUES_LOOKBACK_DAYS',] as const;-// Renamed in 2.0; a pre-2.0 .env may still carry only the old name.+// An older .env may still carry only the old name. The NEXT_PUBLIC_* trio was+// renamed in 2.0; BULLBOARD_* became ADMIN_* when the worker merged into the+// api, and without ADMIN_* the queue UI no longer mounts at all.const RENAMED_ENV_VARS = [['NEXT_PUBLIC_DASHBOARD_URL', 'DASHBOARD_URL'],['NEXT_PUBLIC_API_URL', 'API_URL'],['NEXT_PUBLIC_SELF_HOSTED', 'SELF_HOSTED'],+ ['BULLBOARD_USERNAME', 'ADMIN_USERNAME'],+ ['BULLBOARD_PASSWORD', 'ADMIN_PASSWORD'],] as const;const BUNDLED_KAFKA_HOST = 'op-rp:';@@ -466,7 +470,7 @@ export const renamedEnvVars: Check = (install) => {severity: 'error',title: `Old variable names in .env: ${present.map(([oldName]) => oldName).join(', ')}`,detail:- 'Renamed in 2.0. Their values are moved to the new names unless those are already set.',+ 'These were renamed. Their values are moved to the new names unless those are already set.',fix: (target) => {for (const [oldName, newName] of present) {const value = target.env.get(oldName);diff --git a/self-hosting/cli/test/doctor-edge.test.ts b/self-hosting/cli/test/doctor-edge.test.tsindex 7e16acaed..4f7d59f81 100644--- a/self-hosting/cli/test/doctor-edge.test.ts+++ b/self-hosting/cli/test/doctor-edge.test.ts@@ -146,6 +146,21 @@ describe('env renames', () => {expect(env.has('NEXT_PUBLIC_API_URL')).toBe(false);});+ test('BULLBOARD_* credentials become ADMIN_*, so the queue UI keeps mounting', () => {+ const dir = v1Copy();+ editEnv(dir, (text) =>+ text+ .replace(/^ADMIN_USERNAME=.*\n/m, '')+ .replace(/^ADMIN_PASSWORD=.*\n/m, '')+ .concat('BULLBOARD_USERNAME="ops"\nBULLBOARD_PASSWORD="hunter2"\n')+ );+ const { env } = fixed(dir);+ expect(env.get('ADMIN_USERNAME')).toBe('ops');+ expect(env.get('ADMIN_PASSWORD')).toBe('hunter2');+ expect(env.has('BULLBOARD_USERNAME')).toBe(false);+ expect(env.has('BULLBOARD_PASSWORD')).toBe(false);+ });+test('a missing API_URL is a manual step that suggests the bundled-Caddy address', () => {const dir = v1Copy();editEnv(dir, (text) => text.replace(/^API_URL=.*\n/m, ''));