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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: 'Scalable time-series data storage and analysis'

<Admonition type="deprecation">

The `timescaledb` extension is deprecated in projects using Postgres 17. It continues to be supported in projects using Postgres 15, but will need to dropped before those projects are upgraded to Postgres 17. See the [Upgrading to Postgres 17 notes](/guides/platform/upgrading#upgrading-to-postgres-17) for more information.
The `timescaledb` extension is deprecated in projects using Postgres 17. It continues to be supported in projects using Postgres 15, but will need to dropped before those projects are upgraded to Postgres 17. See the [Upgrading to Postgres 17 notes](/docs/guides/platform/upgrading#upgrading-to-postgres-17) for more information.

</Admonition>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ select pg_create_logical_replication_slot('example_slot', 'pgoutput');

This will need a **direct** connection (not a Connection Pooler) to your database and you can find the connection info in the [Dashboard](https://supabase.com/dashboard/project/_/settings/database).

You will also need to ensure that IPv6 is supported by your replication destination (or you can enable the [IPv4 add-on](/guides/platform/ipv4-address))
You will also need to ensure that IPv6 is supported by your replication destination (or you can enable the [IPv4 add-on](/docs/guides/platform/ipv4-address))

If you would prefer not to use the `postgres` user, then you can run `CREATE ROLE <user> WITH REPLICATION;` using the `postgres` user.

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/guides/database/replication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Logical replication is typically output in 2 forms, `pgoutput` and `wal2json`. T

When using logical replication, Postgres is then configured to keep WAL files around for longer than it needs them. If the files are removed too quickly, then your `replication slot` will become inactive and, if the database receives a large number of changes in a short time, then the `replication slot` can become lost as it was not able to keep up.

In order to mitigate this, Postgres has many options and settings that can be [tweaked](/guides/database/custom-postgres-config) to manage the WAL usage effectively. Not all of these settings are user configurable as they can impact the stability of your database. For those that are, these should be considered as advanced configuration and not changed without understanding that they can cause additional disk space and resources to be used, as well as incur additional costs.
In order to mitigate this, Postgres has many options and settings that can be [tweaked](/docs/guides/database/custom-postgres-config) to manage the WAL usage effectively. Not all of these settings are user configurable as they can impact the stability of your database. For those that are, these should be considered as advanced configuration and not changed without understanding that they can cause additional disk space and resources to be used, as well as incur additional costs.

| Setting | Description | User-facing | Default |
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------ | ----------- | ------- |
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/guides/database/replication/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Connections through a pooler, such as Supavisor, will not work.

# The tool in use does not support IPv6

You can enable the [IPv4 add-on](/guides/platform/ipv4-address) for your project.
You can enable the [IPv4 add-on](/docs/guides/platform/ipv4-address) for your project.

# What is XMIN and should it be used?

Expand All @@ -29,7 +29,7 @@ You can view [publications](https://supabase.com/dashboard/project/default/datab

# How to configure database settings for replication?

Yes. Using the Supabase CLI, you can [configure database settings](/guides/database/custom-postgres-config#cli-configurable-settings) to optimize them for your replication needs. These values can vary depending on the activity of your database size and activity.
Yes. Using the Supabase CLI, you can [configure database settings](/docs/guides/database/custom-postgres-config#cli-configurable-settings) to optimize them for your replication needs. These values can vary depending on the activity of your database size and activity.

# What are some important configuration options?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ title: 'Monitoring replication'

Monitoring replication lag is important and there are 3 ways to do this:

1. Dashboard - Under the [Reports](/guides/platform/reports) of the dashboard, you can view the replication lag of your project
1. Dashboard - Under the [Reports](/docs/guides/platform/reports) of the dashboard, you can view the replication lag of your project
2. Database -
- pg_stat_subscription (subscriber) - if PID is null, then the subscription is not active
- pg_stat_subscription_stats - look here for error_count to see if there were issues applying or syncing (if yes, check the logs for why)
- pg_replication_slots - use this to check if the slot is active and you can also calculate the lag from here
3. [Metrics](/guides/telemetry/metrics) - Using the prometheus endpoint for your project
3. [Metrics](/docs/guides/telemetry/metrics) - Using the prometheus endpoint for your project
- replication_slots_max_lag_bytes - this is the more important one
- pg_stat_replication_replay_lag - lag to replay WAL files from the source DB on the target DB (throttled by disk or high activity)
- pg_stat_replication_send_lag - lag in sending WAL files from the source DB (a high lag means that the publisher is not being asked to send new WAL files OR a network issues)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Materialize has the following [documentation](https://materialize.com/docs/sql/c

You can follow those steps with the following modifications:

1. Follow the steps in our [guide](/guides/database/postgres/setup-replication-external) to create a publication slot
1. Follow the steps in our [guide](/docs/guides/database/postgres/setup-replication-external) to create a publication slot

</TabPanel>

Expand Down
7 changes: 5 additions & 2 deletions apps/studio/components/interfaces/Auth/Users/UsersV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const UsersV2 = () => {
}
)

const { data: countData } = useUsersCountQuery({
const { data: countData, refetch: refetchCount } = useUsersCountQuery({
projectRef,
connectionString: project?.connectionString,
keywords: filterKeywords,
Expand Down Expand Up @@ -437,7 +437,10 @@ export const UsersV2 = () => {
icon={<RefreshCw />}
type="default"
loading={isRefetching && !isFetchingNextPage}
onClick={() => refetch()}
onClick={() => {
refetch()
refetchCount()
}}
>
Refresh
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ const CreateFunction = ({ func, visible, setVisible }: CreateFunctionProps) => {

useEffect(() => {
if (visible) {
setFocusedEditor(false)
form.reset({
name: func?.name ?? '',
schema: func?.schema ?? 'public',
Expand Down
22 changes: 15 additions & 7 deletions apps/studio/components/interfaces/Storage/CreateBucketModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {
import { useProjectStorageConfigQuery } from 'data/config/project-storage-config-query'
import { useBucketCreateMutation } from 'data/storage/bucket-create-mutation'
import { IS_PLATFORM } from 'lib/constants'
import { Alert, Button, Collapsible, Form, Input, Listbox, Modal, Toggle, cn } from 'ui'
import { Button, Collapsible, Form, Input, Listbox, Modal, Toggle, cn } from 'ui'
import { Admonition } from 'ui-patterns'

export interface CreateBucketModalProps {
visible: boolean
Expand Down Expand Up @@ -115,37 +116,44 @@ const CreateBucketModal = ({ visible, onClose }: CreateBucketModalProps) => {
onSubmit={onSubmit}
>
{({ values }: { values: any }) => {
const isPublicBucket = values.public

return (
<>
<Modal.Content>
<Modal.Content className={cn('!px-0', isPublicBucket && '!pb-0')}>
<Input
id="name"
name="name"
type="text"
className="w-full"
className="w-full px-5"
layout="vertical"
label="Name of bucket"
labelOptional="Buckets cannot be renamed once created."
descriptionText="Only lowercase letters, numbers, dots, and hyphens"
/>
<div className="space-y-2 mt-6">
<div className="flex flex-col gap-y-2 mt-6">
<Toggle
id="public"
name="public"
layout="flex"
className="px-5"
label="Public bucket"
descriptionText="Anyone can read any object without any authorization"
/>
{values.public && (
<Alert title="Public buckets are not protected" variant="warning" withIcon>
{isPublicBucket && (
<Admonition
type="warning"
className="rounded-none border-x-0 border-b-0 mb-0 [&>div>p]:!leading-normal"
title="Public buckets are not protected"
>
<p className="mb-2">
Users can read objects in public buckets without any authorization.
</p>
<p>
Row level security (RLS) policies are still required for other operations
such as object uploads and deletes.
</p>
</Alert>
</Admonition>
)}
</div>
</Modal.Content>
Expand Down
49 changes: 33 additions & 16 deletions apps/studio/components/interfaces/Storage/EditBucketModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ import { ChevronDown } from 'lucide-react'
import Link from 'next/link'
import { useEffect, useState } from 'react'
import { toast } from 'sonner'
import { Alert, Button, Collapsible, Form, Input, Listbox, Modal, Toggle, cn } from 'ui'
import { Button, Collapsible, Form, Input, Listbox, Modal, Toggle, cn } from 'ui'

import { StorageSizeUnits } from 'components/to-be-cleaned/Storage/StorageSettings/StorageSettings.constants'
import {
convertFromBytes,
convertToBytes,
} from 'components/to-be-cleaned/Storage/StorageSettings/StorageSettings.utils'
import { InlineLink } from 'components/ui/InlineLink'
import { useProjectStorageConfigQuery } from 'data/config/project-storage-config-query'
import { useBucketUpdateMutation } from 'data/storage/bucket-update-mutation'
import { IS_PLATFORM } from 'lib/constants'
import { Admonition } from 'ui-patterns'
import type { StorageBucket } from './Storage.types'

export interface EditBucketModalProps {
Expand Down Expand Up @@ -84,6 +86,10 @@ const EditBucketModal = ({ visible, bucket, onClose }: EditBucketModalProps) =>
>
<Form validateOnBlur={false} initialValues={{}} validate={validate} onSubmit={onSubmit}>
{({ values, resetForm }: { values: any; resetForm: any }) => {
const isChangingBucketVisibility = bucket?.public !== values.public
const isMakingBucketPrivate = bucket?.public && !values.public
const isMakingBucketPublic = !bucket?.public && values.public

// [Alaister] although this "technically" is breaking the rules of React hooks
// it won't error because the hooks are always rendered in the same order
// eslint-disable-next-line react-hooks/rules-of-hooks
Expand All @@ -106,45 +112,56 @@ const EditBucketModal = ({ visible, bucket, onClose }: EditBucketModalProps) =>

return (
<>
<Modal.Content>
<Modal.Content className={cn('!px-0', isChangingBucketVisibility && '!pb-0')}>
<Input
disabled
id="name"
name="name"
type="text"
className="w-full"
className="w-full px-5"
layout="vertical"
label="Name of bucket"
labelOptional="Buckets cannot be renamed once created."
/>
<div className="space-y-2 mt-6">
<div className={cn('flex flex-col gap-y-2 mt-6')}>
<Toggle
id="public"
name="public"
layout="flex"
label="Public bucket"
className="px-5"
descriptionText="Anyone can read any object without any authorization"
/>
{bucket?.public !== values.public && (
<Alert
{isChangingBucketVisibility && (
<Admonition
type="warning"
className="rounded-none border-x-0 border-b-0 mb-0 [&>div>p]:!leading-normal"
title={
!bucket?.public && values.public
isMakingBucketPublic
? 'Warning: Making bucket public'
: bucket?.public && !values.public
: isMakingBucketPrivate
? 'Warning: Making bucket private'
: ''
}
variant="warning"
withIcon
>
<p className="mb-2">
{!bucket?.public && values.public
? `This will make all objects in the bucket "${bucket?.name}" public`
: bucket?.public && !values.public
? `All objects in "${bucket?.name}" will be made private and will only be accessible via signed URLs or downloaded with the right authorisation headers`
<p>
{isMakingBucketPublic
? `This will make all objects in your bucket publicly accessible.`
: isMakingBucketPrivate
? `All objects in your bucket will be private and only accessible via signed URLs, or downloaded with the right authorisation headers.`
: ''}
</p>
</Alert>
{isMakingBucketPrivate && (
<p>
Assets cached in the CDN may still be publicly accessible. You can
consider{' '}
<InlineLink href="https://supabase.com/docs/guides/storage/cdn/smart-cdn#cache-eviction">
purging the cache
</InlineLink>{' '}
or moving your assets to a new bucket.
</p>
)}
</Admonition>
)}
</div>
</Modal.Content>
Expand Down
Loading
Loading