Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Fix missing region in replica primary node (#28832)

Joshen Limb36c9f86b3c0
diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants.ts b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants.ts
index ef07cde26c1..36c994eeb44 100644
--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants.ts
+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants.ts
@@ -40,6 +40,11 @@ export const AWS_REGIONS_COORDINATES: { [key: string]: [number, number] } = {
SOUTH_ASIA: [72.88, 19.08],
OCEANIA: [151.2, -33.86],
SOUTH_AMERICA: [-46.38, -23.34],
+
+ // CENTRAL_EU_2: To find,
+ // EAST_US_2: [-83, 39.96],
+ // NORTH_EU: To find,
+ // WEST_EU_3: [2.35, 48.86],
}
export const FLY_REGIONS_COORDINATES: { [key: string]: [number, number] } = {
diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.utils.ts b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.utils.ts
index be22cf22df4..acb575bbb54 100644
--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.utils.ts
+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.utils.ts
@@ -6,10 +6,12 @@ import type { LoadBalancer } from 'data/read-replicas/load-balancers-query'
import type { Database } from 'data/read-replicas/replicas-query'
import {
AVAILABLE_REPLICA_REGIONS,
+ AWS_REGIONS_COORDINATES,
NODE_ROW_HEIGHT,
NODE_SEP,
NODE_WIDTH,
} from './InstanceConfiguration.constants'
+import { AWS_REGIONS, AWS_REGIONS_KEYS } from 'shared-data'
// [Joshen] Just FYI the nodes generation assumes each project only has one load balancer
// Will need to change if this eventually becomes otherwise
@@ -48,9 +50,27 @@ export const generateNodes = ({
}
: undefined
- const primaryRegion = AVAILABLE_REPLICA_REGIONS.find((region) =>
- primary.region.includes(region.region)
- )
+ // [Joshen] We should be finding from AVAILABLE_REPLICA_REGIONS instead
+ // but because the new regions (zurich, stockholm, ohio, paris) dont have
+ // coordinates yet in AWS_REGIONS_COORDINATES - we'll need to add them in once
+ // they are ready to spin up coordinates for
+ const primaryRegion = Object.keys(AWS_REGIONS)
+ .map((key) => {
+ return {
+ key: key as AWS_REGIONS_KEYS,
+ name: AWS_REGIONS?.[key as AWS_REGIONS_KEYS].displayName,
+ region: AWS_REGIONS?.[key as AWS_REGIONS_KEYS].code,
+ coordinates: AWS_REGIONS_COORDINATES[key],
+ }
+ })
+ .find((region) => primary.region.includes(region.region))
+
+ // [Joshen] Once we have the coordinates for Zurich and Stockholm, we can remove the above
+ // and uncomment below for better simplicity
+ // const primaryRegion = AVAILABLE_REPLICA_REGIONS.find((region) =>
+ // primary.region.includes(region.region)
+ // )
+
const primaryNode: Node = {
position,
id: primary.identifier,