Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion apps/docs/content/guides/database/custom-postgres-config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,32 @@ supabase --experimental \
postgres-config delete --config shared_buffers,work_mem
```

By default, changing the configuration, whether by updating or deleting, causes the database and all associated read replicas to restart. You can use the `--no-restart` flag to prevent this behavior, and attempt to reload the updated configuration without a restart. Refer to the Postgres documentation to determine if a given parameter can be reloaded without a restart.
By default, CLI v2 (≥ 2.0.0) checks the parameter’s context and requests the correct action (reload or restart):

- If the setting can be reloaded (`pg_settings.context = 'sighup'`), then the Management API will detect this and apply the change with a configuration reload.
- If the setting requires a restart (`pg_settings.context = 'postmaster'`), then both the primary and any read replicas will restart to apply the change.

To check whether a parameter can be reloaded without a restart, see the [Postgres docs](https://www.postgresql.org/docs/current/runtime-config.html).

You can verify whether changes have been applied with the following checks:

```bash
supabase --version;
```

```sql
-- Check whether the parameters were updated (and if a restart is pending):
select name, setting, context, pending_restart
from pg_settings
where name in ('max_slot_wal_keep_size', 'shared_buffers', 'max_connections');
```

```sql
-- If the timestamp hasn’t changed, no restart occurred
select pg_postmaster_start_time();
```

You can also pass the `--no-restart` flag to attempt a reload-only apply. If the parameter cannot be reloaded, the change stays pending until the next restart.

<Admonition type="note" label="Read Replicas and Custom Config">

Expand Down
6 changes: 3 additions & 3 deletions apps/docs/content/guides/realtime/authorization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ To enforce private channels you need to disable the 'Allow public access' settin

Realtime uses the `messages` table in your database's `realtime` schema to generate access policies for your clients when they connect to a Channel topic.

By creating RLS polices on the `realtime.messages` table you can control the access users have to a Channel topic, and features within a Channel topic.
By creating RLS policies on the `realtime.messages` table you can control the access users have to a Channel topic, and features within a Channel topic.

The validation is done when the user connects. When their WebSocket connection is established and a Channel topic is joined, their permissions are calculated based on:

Expand Down Expand Up @@ -373,9 +373,9 @@ When using Postgres Changes with RLS, database records are sent only to clients

## Updating RLS policies

Client access polices are cached for the duration of the connection. Your database is not queried for every Channel message.
Client access policies are cached for the duration of the connection. Your database is not queried for every Channel message.

Realtime updates the access policy cache for a client based on your RLS polices when:
Realtime updates the access policy cache for a client based on your RLS policies when:

- A client connects to Realtime and subscribes to a Channel
- A new JWT is sent to Realtime from a client via the [`access_token` message](/docs/guides/realtime/protocol#access-token)
Expand Down
8 changes: 6 additions & 2 deletions apps/studio/components/grid/SupabaseGrid.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,14 @@ export function useLoadTableEditorStateFromLocalStorageIntoUrl({
}

export const handleCopyCell = (
{ column, row }: { column: CalculatedColumn<any, unknown>; row: any },
{
mode,
column,
row,
}: { mode: 'SELECT' | 'EDIT'; column: CalculatedColumn<any, unknown>; row: any },
event: CellKeyboardEvent
) => {
if (event.code === 'KeyC' && (event.metaKey || event.ctrlKey)) {
if (mode === 'SELECT' && event.code === 'KeyC' && (event.metaKey || event.ctrlKey)) {
const colKey = column.key
const cellValue = row[colKey] ?? ''
const value = formatClipboardValue(cellValue)
Expand Down
4 changes: 1 addition & 3 deletions apps/studio/components/grid/components/grid/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ export const Grid = memo(
}
}

const removeAllFilters = () => {
onApplyFilters([])
}
const removeAllFilters = () => onApplyFilters([])

return (
<div
Expand Down
71 changes: 53 additions & 18 deletions apps/studio/data/projects/new-project.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,142 +31,177 @@ export const instanceSizeSpecs: Record<
cpu: '2-core',
priceHourly: 0.01344,
priceMonthly: 10,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.FLY.id],
cloud_providers: [
PROVIDERS.AWS.id,
PROVIDERS.AWS_K8S.id,
PROVIDERS.AWS_NIMBUS.id,
PROVIDERS.FLY.id,
],
},
small: {
label: 'Small',
ram: '2 GB',
cpu: '2-core',
priceHourly: 0.0206,
priceMonthly: 15,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.FLY.id],
cloud_providers: [
PROVIDERS.AWS.id,
PROVIDERS.AWS_K8S.id,
PROVIDERS.AWS_NIMBUS.id,
PROVIDERS.FLY.id,
],
},
medium: {
label: 'Medium',
ram: '4 GB',
cpu: '2-core',
priceHourly: 0.0822,
priceMonthly: 60,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.FLY.id],
cloud_providers: [
PROVIDERS.AWS.id,
PROVIDERS.AWS_K8S.id,
PROVIDERS.AWS_NIMBUS.id,
PROVIDERS.FLY.id,
],
},
large: {
label: 'Large',
ram: '8 GB',
cpu: '2-core',
priceHourly: 0.1517,
priceMonthly: 110,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.FLY.id],
cloud_providers: [
PROVIDERS.AWS.id,
PROVIDERS.AWS_K8S.id,
PROVIDERS.AWS_NIMBUS.id,
PROVIDERS.FLY.id,
],
},
xlarge: {
label: 'XL',
ram: '16 GB',
cpu: '4-core',
priceHourly: 0.2877,
priceMonthly: 210,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.FLY.id],
cloud_providers: [
PROVIDERS.AWS.id,
PROVIDERS.AWS_K8S.id,
PROVIDERS.AWS_NIMBUS.id,
PROVIDERS.FLY.id,
],
},
'2xlarge': {
label: '2XL',
ram: '32 GB',
cpu: '8-core',
priceHourly: 0.562,
priceMonthly: 410,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.FLY.id],
cloud_providers: [
PROVIDERS.AWS.id,
PROVIDERS.AWS_K8S.id,
PROVIDERS.AWS_NIMBUS.id,
PROVIDERS.FLY.id,
],
},
'4xlarge': {
label: '4XL',
ram: '64 GB',
cpu: '16-core',
priceHourly: 1.32,
priceMonthly: 960,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.FLY.id],
cloud_providers: [
PROVIDERS.AWS.id,
PROVIDERS.AWS_K8S.id,
PROVIDERS.AWS_NIMBUS.id,
PROVIDERS.FLY.id,
],
},
'8xlarge': {
label: '8XL',
ram: '128 GB',
cpu: '32-core',
priceHourly: 2.562,
priceMonthly: 1870,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id],
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.AWS_NIMBUS.id],
},
'12xlarge': {
label: '12XL',
ram: '192 GB',
cpu: '48-core',
priceHourly: 3.836,
priceMonthly: 2800,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id],
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.AWS_NIMBUS.id],
},
'16xlarge': {
label: '16XL',
ram: '256 GB',
cpu: '64-core',
priceHourly: 5.12,
priceMonthly: 3730,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id],
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.AWS_NIMBUS.id],
},
'24xlarge': {
label: '24XL',
ram: '384 GB',
cpu: '96-core',
priceHourly: 9.73,
priceMonthly: 7100,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id],
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.AWS_NIMBUS.id],
},
'24xlarge_optimized_cpu': {
label: '24XL - Optimized CPU',
ram: '192 GB',
cpu: '96-core',
priceHourly: 8.9,
priceMonthly: 6500,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id],
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.AWS_NIMBUS.id],
},
'24xlarge_optimized_memory': {
label: '24XL - Optimized Memory',
ram: '768 GB',
cpu: '96-core',
priceHourly: 13.84,
priceMonthly: 10100,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id],
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.AWS_NIMBUS.id],
},
'24xlarge_high_memory': {
label: '24XL - High Memory',
ram: '1536 GB',
cpu: '96-core',
priceHourly: 21.91,
priceMonthly: 16000,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id],
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.AWS_NIMBUS.id],
},
'48xlarge': {
label: '48XL',
ram: '768 GB',
cpu: '192-core',
priceHourly: 19.47,
priceMonthly: 14200,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id],
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.AWS_NIMBUS.id],
},
'48xlarge_optimized_cpu': {
label: '48XL - Optimized CPU',
ram: '384 GB',
cpu: '192-core',
priceHourly: 17.8,
priceMonthly: 13000,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id],
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.AWS_NIMBUS.id],
},
'48xlarge_optimized_memory': {
label: '48XL - Optimized Memory',
ram: '1536 GB',
cpu: '192-core',
priceHourly: 27.68,
priceMonthly: 20200,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id],
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.AWS_NIMBUS.id],
},
'48xlarge_high_memory': {
label: '48XL - High Memory',
ram: '3072 GB',
cpu: '192-core',
priceHourly: 43.84,
priceMonthly: 32000,
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id],
cloud_providers: [PROVIDERS.AWS.id, PROVIDERS.AWS_K8S.id, PROVIDERS.AWS_NIMBUS.id],
},
}
16 changes: 13 additions & 3 deletions apps/studio/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ import timezone from 'dayjs/plugin/timezone'
import utc from 'dayjs/plugin/utc'
import Head from 'next/head'
import { NuqsAdapter } from 'nuqs/adapters/next/pages'
import { ErrorInfo } from 'react'
import { ErrorInfo, useCallback } from 'react'
import { ErrorBoundary } from 'react-error-boundary'

import {
FeatureFlagProvider,
getFlags as getConfigCatFlags,
getFlags,
TelemetryTagManager,
ThemeProvider,
useThemeSandbox,
Expand All @@ -51,7 +51,7 @@ import { GlobalErrorBoundaryState } from 'components/ui/GlobalErrorBoundaryState
import { useRootQueryClient } from 'data/query-client'
import { customFont, sourceCodePro } from 'fonts'
import { AuthProvider } from 'lib/auth'
import { API_URL, BASE_PATH, IS_PLATFORM } from 'lib/constants'
import { API_URL, BASE_PATH, IS_PLATFORM, useDefaultProvider } from 'lib/constants'
import { ProfileProvider } from 'lib/profile'
import { Telemetry } from 'lib/telemetry'
import { AppPropsWithLayout } from 'types'
Expand Down Expand Up @@ -100,6 +100,16 @@ function CustomApp({ Component, pageProps }: AppPropsWithLayout) {

const isTestEnv = process.env.NEXT_PUBLIC_NODE_ENV === 'test'

const cloudProvider = useDefaultProvider()
const getConfigCatFlags = useCallback(
(userEmail?: string) => {
const customAttributes = cloudProvider ? { cloud_provider: cloudProvider } : undefined

return getFlags(userEmail, customAttributes)
},
[cloudProvider]
)

return (
<ErrorBoundary FallbackComponent={GlobalErrorBoundaryState} onError={errorBoundaryHandler}>
<QueryClientProvider client={queryClient}>
Expand Down
6 changes: 4 additions & 2 deletions packages/common/configcat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ async function getClient() {
return client
}

export async function getFlags(userEmail: string = '') {
export async function getFlags(userEmail: string = '', customAttributes?: Record<string, string>) {
const client = await getClient()

if (userEmail) {
return client.getAllValuesAsync(new configcat.User(userEmail))
return client.getAllValuesAsync(
new configcat.User(userEmail, undefined, undefined, customAttributes)
)
} else {
return client.getAllValuesAsync()
}
Expand Down
Loading