The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
docs(self-hosting): remove legacy key generation from docker guide (#45359)
fadymak287af52198eb
diff --git a/apps/docs/components/JwtGenerator/JwtGeneratorSimple.tsx b/apps/docs/components/JwtGenerator/JwtGeneratorSimple.tsxdeleted file mode 100644index 4ba0ae99e56..00000000000--- a/apps/docs/components/JwtGenerator/JwtGeneratorSimple.tsx+++ /dev/null@@ -1,79 +0,0 @@-import { KJUR } from 'jsrsasign'-import { useState } from 'react'-import { Button } from 'ui'-import { CodeBlock } from 'ui-patterns/CodeBlock'--const JWT_HEADER = { alg: 'HS256', typ: 'JWT' }--const generateRandomString = (length: number) => {- const CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'- let result = ''-- const MAX = Math.floor(256 / CHARS.length) * CHARS.length - 1- const randomUInt8Array = new Uint8Array(1)-- for (let i = 0; i < length; i++) {- let randomNumber: number- do {- crypto.getRandomValues(randomUInt8Array)- randomNumber = randomUInt8Array[0]- } while (randomNumber > MAX)-- result += CHARS[randomNumber % CHARS.length]- }-- return result-}--const generateKeys = () => {- const now = new Date()- const today = new Date(now.getFullYear(), now.getMonth(), now.getDate())- const fiveYears = new Date(now.getFullYear() + 5, now.getMonth(), now.getDate())- const iat = Math.floor(today.valueOf() / 1000)- const exp = Math.floor(fiveYears.valueOf() / 1000)-- const anonToken = { role: 'anon', iss: 'supabase', iat, exp }- const serviceToken = { role: 'service_role', iss: 'supabase', iat, exp }-- const secret = generateRandomString(40)- const anonKey = KJUR.jws.JWS.sign(null, JWT_HEADER, anonToken, secret)- const serviceRoleKey = KJUR.jws.JWS.sign(null, JWT_HEADER, serviceToken, secret)- return { secret, anonKey, serviceRoleKey }-}--export default function JwtGeneratorSimple() {- const [keys, setKeys] = useState(generateKeys)-- const regenerate = () => {- setKeys(generateKeys())- }-- return (- <div className="border rounded-lg p-4">- <div className="grid mb-8">- <label htmlFor="secret">JWT_SECRET</label>- <CodeBlock language="bash" className="relative font-mono">- {keys.secret}- </CodeBlock>- </div>-- <div className="grid mb-8">- <label htmlFor="anon">ANON_KEY</label>- <CodeBlock language="bash" className="relative font-mono">- {keys.anonKey}- </CodeBlock>- </div>-- <div className="grid mb-8">- <label htmlFor="service">SERVICE_ROLE_KEY</label>- <CodeBlock language="bash" className="relative font-mono">- {keys.serviceRoleKey}- </CodeBlock>- </div>-- <Button type="primary" onClick={regenerate}>- Generate new- </Button>- </div>- )-}diff --git a/apps/docs/components/JwtGenerator/index.tsx b/apps/docs/components/JwtGenerator/index.tsxdeleted file mode 100644index 27a49cc41cb..00000000000--- a/apps/docs/components/JwtGenerator/index.tsx+++ /dev/null@@ -1,16 +0,0 @@-'use client'--import dynamic from 'next/dynamic'-import { Suspense } from 'react'--const DynamicJwtGeneratorSimple = dynamic(() => import('./JwtGeneratorSimple'), { ssr: false })--const JwtGeneratorSimple = () => {- return (- <Suspense fallback={<div>Loading...</div>}>- <DynamicJwtGeneratorSimple />- </Suspense>- )-}--export { JwtGeneratorSimple }diff --git a/apps/docs/content/guides/self-hosting/docker.mdx b/apps/docs/content/guides/self-hosting/docker.mdxindex 7e906e6a4ef..3f2f74cfc64 100644--- a/apps/docs/content/guides/self-hosting/docker.mdx+++ b/apps/docs/content/guides/self-hosting/docker.mdx@@ -190,8 +190,6 @@ The generated secrets and password are written to the `.env` file. The ones you- `SUPABASE_SECRET_KEY`: secret API key for server-side use. Never expose this in client code- `SUPABASE_PUBLIC_URL`: base URL you pass as `supabaseUrl` to the client libraries-If you are still using the [legacy API keys](#configuring-legacy-api-keys), look for `ANON_KEY` and `SERVICE_ROLE_KEY` instead of the new publishable and secret API keys above.-### Studio authenticationAccess to Studio (Dashboard) is protected with **HTTP basic authentication**.@@ -408,22 +406,6 @@ sh utils/db-passwd.shThe script generates a new password, updates all database roles, and modifies your `.env` file. After running it, restart the services with `docker compose up -d --force-recreate`.-### Configuring legacy API keys--Use the key generator below to obtain and configure the following secure keys in `.env`:--- `JWT_SECRET`: Used by Auth, PostgREST, and other services to sign and verify JWTs.-- `ANON_KEY`: Client-side API key with limited permissions (`anon` role). Use this in your frontend applications.-- `SERVICE_ROLE_KEY`: Server-side API key with full database access (`service_role` role). **Never expose this in client code.**--<JwtGeneratorSimple />--1. Copy the generated value and update `JWT_SECRET` in the `.env` file. Do not share this secret publicly or commit it to version control.-2. Copy the generated value and update `ANON_KEY` in the `.env` file.-3. Copy the generated value and update `SERVICE_ROLE_KEY` in the `.env` file.--The generated keys expire in 5 years. You can verify them at [jwt.io](https://jwt.io) using the saved value of `JWT_SECRET`.-### Configuring secretsThe `generate-keys.sh` script sets the following secrets automatically. You can also configure them manually in the `.env` file if needed:diff --git a/apps/docs/features/docs/MdxBase.shared.tsx b/apps/docs/features/docs/MdxBase.shared.tsxindex 6e6ccca207f..ed70fab6657 100644--- a/apps/docs/features/docs/MdxBase.shared.tsx+++ b/apps/docs/features/docs/MdxBase.shared.tsx@@ -8,7 +8,6 @@ import ButtonCard from '~/components/ButtonCard'import { ComputeDiskLimitsTable } from '~/components/ComputeDiskLimitsTable'import { Extensions } from '~/components/Extensions'import Image, { type ImageProps } from '~/components/Image'-import { JwtGeneratorSimple } from '~/components/JwtGenerator'import { Mermaid } from '~/components/Mermaid'import { MetricsStackCards } from '~/components/MetricsStackCards'import { NavData } from '~/components/NavData'@@ -68,7 +67,6 @@ const components = {IconPanel,IconX: X,Image: (props: ImageProps) => <Image className="rounded-md w-full" {...props} />,- JwtGeneratorSimple,Link,McpConfigPanel,Mermaid,