diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml new file mode 100644 index 00000000000..bacadccbf1e --- /dev/null +++ b/.github/workflows/mirror.yml @@ -0,0 +1,33 @@ +name: Mirror Image + +on: + workflow_dispatch: + inputs: + version: + description: "Image tag" + required: true + type: string + +jobs: + mirror: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: docker/login-action@v2 + with: + registry: public.ecr.aws + username: ${{ secrets.PROD_ACCESS_KEY_ID }} + password: ${{ secrets.PROD_SECRET_ACCESS_KEY }} + - uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: akhilerm/tag-push-action@v2.1.0 + with: + src: docker.io/supabase/studio:${{ inputs.version }} + dst: | + public.ecr.aws/supabase/studio:${{ inputs.version }} + ghcr.io/supabase/studio:${{ inputs.version }} diff --git a/.github/workflows/publish_image.yml b/.github/workflows/publish_image.yml index 6106dad6b42..fb21fd49d43 100644 --- a/.github/workflows/publish_image.yml +++ b/.github/workflows/publish_image.yml @@ -16,13 +16,17 @@ on: jobs: publish: runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - id: meta uses: docker/metadata-action@v4 with: images: | supabase/studio - public.ecr.aws/t3w2s2c9/studio + public.ecr.aws/supabase/studio + ghcr.io/supabase/studio flavor: | latest=false tags: | @@ -49,6 +53,13 @@ jobs: username: ${{ secrets.PROD_ACCESS_KEY_ID }} password: ${{ secrets.PROD_SECRET_ACCESS_KEY }} + - name: Login to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/build-push-action@v3 with: push: true diff --git a/DEVELOPERS.md b/DEVELOPERS.md index 585e7359e3d..d4a62cd88f9 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -75,7 +75,7 @@ Then visit, and edit, any of the following sites: | ---------------------------------------------- | -------------- | ---------- | ------------------------------------ | ------------------------ | | [supabase.com](https://supabase.com) | `/apps/www` | www | The main website | http://localhost:3000 | | [app.supabase.com](https://app.supabase.com) | `/studio` | studio | Studio dashboard | http://localhost:8082 | -| [supabase.com/docs](https://supabase.com/docs) | `/apps/docs` | docs | Guides and Reference (Next.js based) | http://localhost:3001 | +| [supabase.com/docs](https://supabase.com/docs) | `/apps/docs` | docs | Guides and Reference (Next.js based) | http://localhost:3001/docs | #### Running sites individually diff --git a/README.md b/README.md index c24e86943fa..4c35921e1a5 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Supabase is a combination of open source tools. We’re building the features of Supabase is a [hosted platform](https://app.supabase.com). You can sign up and start using Supabase without installing anything. You can also [self-host](https://supabase.com/docs/guides/hosting/overview) and [develop locally](https://supabase.com/docs/guides/local-development). -![Architecture](https://user-images.githubusercontent.com/70828596/187547862-ffa9d058-0c3a-4851-a3e7-92ccfca4b596.png) +![Architecture](https://github.com/supabase/supabase/blob/master/apps/docs/public/img/supabase-architecture.png) - [PostgreSQL](https://www.postgresql.org/) is an object-relational database system with over 30 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance. - [Realtime](https://github.com/supabase/realtime) is an Elixir server that allows you to listen to PostgreSQL inserts, updates, and deletes using websockets. Realtime polls Postgres' built-in replication functionality for database changes, converts changes to JSON, then broadcasts the JSON over websockets to authorized clients. diff --git a/apps/docs/components/Navigation/Navigation.constants.ts b/apps/docs/components/Navigation/Navigation.constants.ts index 5bfb8aa40df..3c407085da2 100644 --- a/apps/docs/components/Navigation/Navigation.constants.ts +++ b/apps/docs/components/Navigation/Navigation.constants.ts @@ -237,7 +237,7 @@ export const menuItems: NavMenu = { items: [ { name: 'Overview', url: '/guides/realtime', items: [] }, { name: 'Quickstart', url: '/guides/realtime/quickstart', items: [] }, - { name: 'Postgres CDC', url: '/guides/realtime/postgres-cdc', items: [] }, + { name: 'Postgres Changes', url: '/guides/realtime/postgres-changes', items: [] }, { name: 'Rate Limits', url: '/guides/realtime/rate-limits', items: [] }, ], }, diff --git a/apps/docs/pages/features.mdx b/apps/docs/pages/features.mdx index 06152162e48..22a1dfd567a 100755 --- a/apps/docs/pages/features.mdx +++ b/apps/docs/pages/features.mdx @@ -92,7 +92,7 @@ Fast GraphQL APIs using our custom Postgres GraphQL extension. [Docs](/docs/guid ### Realtime Database changes -Receive your database changes through websockets. [Docs](/docs/guides/realtime/postgres-cdc). +Receive your database changes through websockets. [Docs](/docs/guides/realtime/postgres-changes). ### User Broadcasting @@ -156,7 +156,7 @@ Both Postgres and the Supabase Platform are production-ready. Some tools we offe | Database | Point-in-Time Recovery | `alpha` | | Database | Vault | `alpha` | | Studio | | `GA` | -| Realtime | Postgres CDC | `GA` | +| Realtime | Postgres Changes | `GA` | | Realtime | Broadcast | `beta` | | Realtime | Presence | `beta` | | Storage | Backend (S3) | `GA` | diff --git a/apps/docs/pages/guides/database/extensions/pgnet.mdx b/apps/docs/pages/guides/database/extensions/pgnet.mdx index afaa24a8378..f9b99c7e018 100644 --- a/apps/docs/pages/guides/database/extensions/pgnet.mdx +++ b/apps/docs/pages/guides/database/extensions/pgnet.mdx @@ -8,7 +8,7 @@ export const meta = { -The pg_net API is in beta. Functions signatures may change. +The pg_net API is in alpha. Functions signatures may change. @@ -150,102 +150,6 @@ request_id After triggering `http_post`, use [`http_get_result`](#http_get_result) to get the result of the request. -## `http_collect_response` [#http_collect_response] - -Given a `request_id` reference, retrieves the response. - -When `async:=false` is set it is recommended that [statement_timeout](https://www.postgresql.org/docs/13/runtime-config-client.html) is set for the maximum amount of time the caller is willing to wait in case the response is slow to populate. - -### Signature - - - -This is a Postgres SECURITY DEFINER function - - - -```sql -net.http_collect_response( - -- request_id reference - request_id bigint, - -- when `true`, return immediately. when `false` wait for the request to complete before returning - async bool default true -) - -- http response composite wrapped in a result type - returns net.http_response_result - - strict - volatile - parallel safe -``` - -### Usage - - - -`net.http_collect_response` must be in a separate transaction from the calls to `net.http_` - - - -```sql -select - net.http_post( - url:='https://httpbin.org/post', - body:='{"hello": "world"}'::jsonb - ) as request_id; -request_id ----------- - 1 -(1 row) - -select * from net.http_collect_response(1, async:=false); -status | message | response ---------+---------+---------- -SUCCESS ok ( - status_code := 200, - headers := '{"date": ...}', - body := '{"args": ...}' - )::net.http_response_result - - -select - (response).body::json -from - net.http_collect_response(request_id:=1); - body -------------------------------------------------------------------- - { - "args": {}, - "data": "{\"hello\": \"world\"}", - "files": {}, - "form": {}, - "headers": { - "Accept": "*/*", - "Content-Length": "18", - "Content-Type": "application/json", - "Host": "httpbin.org", - "User-Agent": "pg_net/0.2", - "X-Amzn-Trace-Id": "Root=1-61031a5c-7e1afeae69bffa8614d8e48e" - }, - "json": { - "hello": "world" - }, - "origin": "135.63.38.488", - "url": "https://httpbin.org/post" - } -(1 row) -``` - -Where `response` is a composite: - -```sql -status_code integer -headers jsonb -body text -``` - -Possible values for `net.http_response_result.status` are `('PENDING', 'SUCCESS', 'ERROR')` - ## Resources - Source code: [github.com/supabase/pg_net](https://github.com/supabase/pg_net/) diff --git a/apps/docs/pages/guides/functions/quickstart.mdx b/apps/docs/pages/guides/functions/quickstart.mdx index 963305181a3..55b9ed617c6 100644 --- a/apps/docs/pages/guides/functions/quickstart.mdx +++ b/apps/docs/pages/guides/functions/quickstart.mdx @@ -106,7 +106,7 @@ You should see the response `{ "message":"Hello Functions!" }`.
Implementation details -- All Edge Functions are `POST` requests. +- Edge Functions don't serve HTML content (`GET` requests that return `text/html` are rewritten to `text/plain`). - The `Authorization` header is required. You can use either the `ANON` key, the `SERVICE_ROLE` key, or a logged-in user's JWT. - The Function is proxied through the local API (`http://localhost:54321`) diff --git a/apps/docs/pages/guides/integrations/zuplo.mdx b/apps/docs/pages/guides/integrations/zuplo.mdx index c4eb7cc98e4..06b621b5b47 100644 --- a/apps/docs/pages/guides/integrations/zuplo.mdx +++ b/apps/docs/pages/guides/integrations/zuplo.mdx @@ -30,7 +30,7 @@ Manually enter a couple of rows of data, so that we have something to read from ## The `Get all` reviews route in Zuplo -Login to Zuplo at [portal.zuplo.com](https://portal.zuplo.com] and create a new project in Zuplo - I went with `supabase-ski-reviews`. +Login to Zuplo at [portal.zuplo.com](https://portal.zuplo.com) and create a new project in Zuplo - I went with `supabase-ski-reviews`. Select the **File** tab and choose **Routes**. Add your first route with the following settings: diff --git a/apps/docs/pages/guides/platform/custom-domains.mdx b/apps/docs/pages/guides/platform/custom-domains.mdx index 36565487f59..0ff3d80bb49 100644 --- a/apps/docs/pages/guides/platform/custom-domains.mdx +++ b/apps/docs/pages/guides/platform/custom-domains.mdx @@ -12,7 +12,7 @@ Custom Domains are currently in beta, and are being slowly made available to pro -Custom domains allow you to present a branded experience to your users. You can also use a subdomain for the purposes of this guide. +Custom domains allow you to present a branded experience to your users. Currently, you must use a subdomain (e.g., `api.example.com`, rather than `example.com`) for the purposes of this guide. To get started: diff --git a/apps/docs/pages/guides/realtime.mdx b/apps/docs/pages/guides/realtime.mdx index acf13a0f57b..e6b8ce7e283 100644 --- a/apps/docs/pages/guides/realtime.mdx +++ b/apps/docs/pages/guides/realtime.mdx @@ -3,7 +3,7 @@ import Layout from '~/layouts/DefaultGuideLayout' export const meta = { id: 'realtime', title: 'Realtime', - description: 'Supabase Realtime with Broadcast, Presence, and Postgres CDC.', + description: 'Supabase Realtime with Broadcast, Presence, and Postgres Changes.', sidebar_label: 'Overview', } @@ -11,11 +11,11 @@ Supabase provides a globally distributed cluster of [Realtime](https://github.co - [Broadcast](#broadcast): Send ephemeral messages from client to clients with low latency. - [Presence](#presence): Track and synchronize shared state between clients. -- [Postgres CDC](#postgres-cdc): Listen to Postgres database changes and send them to authorized clients. +- [Postgres Changes](#postgres-changes): Listen to Postgres database changes and send them to authorized clients. A [channel](https://hexdocs.pm/phoenix/channels.html) is the basic building block of Realtime and narrows the scope of data flow to subscribed clients. You can think of a channel as a chatroom where participants are able to see who's online and send and receive messages; similar to a Discord or Slack channel. -All clients can connect to a channel and take advantage of the built-in features, Broadcast and Presence, while extenstions, like Postgres CDC, must be enabled prior to use. +All clients can connect to a channel and take advantage of the built-in features, Broadcast and Presence, while extenstions, like Postgres Changes, must be enabled prior to use. ## Broadcast @@ -37,9 +37,9 @@ Clients are free to come-and-go as they please, and as long as they are all subs The neat thing about Presence is that if a client is suddenly disconnected (for example, they go offline), their state will be automatically removed from the shared state. If you've ever tried to build an “I'm online” feature which handles unexpected disconnects, you'll appreciate how useful this is. -## Postgres CDC +## Postgres Changes -Postgres Change Data Capture (CDC) enables you to listen to database changes and have them broadcast to authorized clients based on [Row Level Security (RLS)](/docs/guides/auth/row-level-security) policies. +Postgres Changes enable you to listen to database changes and have them broadcast to authorized clients based on [Row Level Security (RLS)](/docs/guides/auth/row-level-security) policies. This works by Realtime polling your database's logical replication slot for changes, passing those changes to the [apply_rls](https://github.com/supabase/walrus#reading-wal) SQL function to determine which clients have permission, and then using Broadcast to send those changes to clients. diff --git a/apps/docs/pages/guides/realtime/postgres-cdc.mdx b/apps/docs/pages/guides/realtime/postgres-changes.mdx similarity index 83% rename from apps/docs/pages/guides/realtime/postgres-cdc.mdx rename to apps/docs/pages/guides/realtime/postgres-changes.mdx index c8d20133f3a..79a76e884b2 100644 --- a/apps/docs/pages/guides/realtime/postgres-cdc.mdx +++ b/apps/docs/pages/guides/realtime/postgres-changes.mdx @@ -1,18 +1,18 @@ import Layout from '~/layouts/DefaultGuideLayout' export const meta = { - id: 'postgres-cdc', - title: 'Postgres CDC', - description: "Getting started with Realtime's Postgres CDC feature", + id: 'postgres-changes', + title: 'Postgres Changes', + description: "Getting started with Realtime's Postgres Changes feature", } -Realtime's Postgres Change Data Capture (CDC) feature listens for database changes and sends them to clients. Clients are required to subscribe with a JWT dictating which changes they are allowed to receive based on the database's [Row Level Security](/docs/guides/auth/row-level-security). +Realtime's Postgres Changes feature listens for database changes and sends them to clients. Clients are required to subscribe with a JWT dictating which changes they are allowed to receive based on the database's [Row Level Security](/docs/guides/auth/row-level-security). Anyone with access to a valid JWT signed with the project's JWT secret is able to listen to your database's changes, unless tables have [Row Level Security](/docs/guides/auth/row-level-security) enabled and policies in place. Clients can choose to receive `INSERT`, `UPDATE`, `DELETE`, or `*` (all) changes for all changes in a schema, a table in a schema, or a column's value in a table. Your clients should only listen to tables in the `public` schema and you must first enable the tables you want your clients to listen to. -Postgres CDC works out of the box for tables in the `public` schema. You can listen to tables in your private schemas by granting table `SELECT` permissions to the database role found in your access token. You can run a query similar to the following: +Postgres Changes works out of the box for tables in the `public` schema. You can listen to tables in your private schemas by granting table `SELECT` permissions to the database role found in your access token. You can run a query similar to the following: ```sql GRANT SELECT ON "private_schema"."table" TO authenticated; diff --git a/apps/docs/pages/guides/realtime/quickstart.mdx b/apps/docs/pages/guides/realtime/quickstart.mdx index 02bc5b9177b..5d384d5f874 100644 --- a/apps/docs/pages/guides/realtime/quickstart.mdx +++ b/apps/docs/pages/guides/realtime/quickstart.mdx @@ -7,7 +7,7 @@ export const meta = { sidebar_label: 'Quickstart', } -Learn how to build [multiplayer.dev](https://multiplayer.dev), a collaborative app that demonstrates Broadcast, Presence, and Postgres CDC using [Realtime](/docs/guides/realtime). +Learn how to build [multiplayer.dev](https://multiplayer.dev), a collaborative app that demonstrates Broadcast, Presence, and Postgres Changes using [Realtime](/docs/guides/realtime).