Skip to content

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

Adds some updates for the self-hosted guides

Copple34d3ab823753
diff --git a/apps/docs/pages/guides/self-hosting.mdx b/apps/docs/pages/guides/self-hosting.mdx
index 1ad426b229b..4b631683686 100644
--- a/apps/docs/pages/guides/self-hosting.mdx
+++ b/apps/docs/pages/guides/self-hosting.mdx
@@ -2,15 +2,43 @@ import Layout from '~/layouts/DefaultGuideLayout'
export const meta = {
title: 'Self-Hosting',
- description: 'Getting started with self-hosting Supabase.',
+ description: 'Host Supabase on your own infrastructure.',
+ subtitle: 'Host Supabase on your own infrastructure.',
}
-There are several ways to use Supabase:
+There are several ways to host Supabase on your own computer, server, or cloud.
-- [Supabase Cloud](https://supabase.com/dashboard): you don't need to deploy anything. We will manage and scale your infrastructure.
-- [Docker](/docs/guides/self-hosting/docker): deploy to your own infrastructure.
+## Officially Supported
-### Community
+<div className="grid md:grid-cols-12 gap-4 not-prose">
+ {official.map((x) => (
+ <div className="md:col-span-6 xl:col-span-3" key={x.href}>
+ <Link href={x.href} passHref>
+ <a>
+ <GlassPanel title={x.name}>{x.description}</GlassPanel>
+ </a>
+ </Link>
+ </div>
+ ))}
+</div>
+
+export const official = [
+ {
+ name: 'Docker',
+ description: 'Deploy Supabase within your own infrastructure using Docker Compose.',
+ href: '/docs/guides/self-hosting/docker',
+ },
+ {
+ name: 'BYO Cloud',
+ description:
+ 'Contact our Enterprise sales team if you need Supabase managed in your own cloud.',
+ href: '/pricing',
+ },
+]
+
+Supabase is also a hosted platform. If you want to get started for free, visit [supabase.com/dashboard](https://supabase.com/dashboard).
+
+## Community Supported
There are several community-driven projects to help you deploy Supabase. We encourage you to try them out and contribute back to the community.
@@ -49,7 +77,7 @@ export const community = [
},
]
-### Third-party
+## Third-party Guides
The following third-party providers have shown consistent support for the self-hosted version of Supabase:.
@@ -78,102 +106,6 @@ export const external = [
},
]
-## Architecture
-
-Supabase is a combination of open source tools, each specifically chosen for Enterprise-readiness.
-
-If the tools and communities already exist, with an MIT, Apache 2, or equivalent open license, we will use and support that tool.
-If the tool doesn't exist, we build and open source it ourselves.
-
-![Supabase Architecture](/docs/img/supabase-architecture.png)
-
-- [Kong](https://github.com/Kong/kong) is a cloud-native API gateway.
-- [GoTrue](https://github.com/supabase/gotrue) is an SWT based API for managing users and issuing SWT tokens.
-- [PostgREST](http://postgrest.org/) is a web server that turns your PostgreSQL database directly into a RESTful API
-- [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.
-- [Storage](https://github.com/supabase/storage-api) provides a RESTful interface for managing Files stored in S3, using Postgres to manage permissions.
-- [postgres-meta](https://github.com/supabase/postgres-meta) is a RESTful API for managing your Postgres, allowing you to fetch tables, add roles, and run queries, etc.
-- [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.
-
-## Configuration
-
-Each system has a number of configuration options which can be found in the relevant product documentation.
-
-- [Postgres](https://hub.docker.com/_/postgres/)
-- [PostgREST](https://postgrest.org/en/stable/configuration.html)
-- [Realtime](https://github.com/supabase/realtime#server)
-- [GoTrue](https://github.com/supabase/gotrue)
-- [Storage](https://github.com/supabase/storage-api)
-- [Kong](https://docs.konghq.com/gateway/latest/install/docker/)
-
-## Managing your database
-
-It is recommended that you decouple your database from the middleware so that you can upgrade the middleware without any downtime.
-The "middleware" is everything except Postgres, and it should work with any Postgres provider (such as AWS RDS), or your own Postgres cluster.
-
-### Extensions
-
-Supabase requires some Postgres extensions to be enabled by default for the API and Auth system to work. You can find the extensions inside the
-[schema migration scripts](https://github.com/supabase/postgres/tree/develop/migrations). These are mounted at `/docker-entrypoint-initdb.d`
-to run automatically when starting the database container.
-
-We recommend installing all extensions into an `extensions` schema. This will keep your API clean,
-since all tables in the `public` schema are exposed via the API.
-
-{/* prettier-ignore */}
-```sql
-create schema if not exists extensions;
-create extension if not exists "uuid-ossp" with schema extensions;
-create extension if not exists pgcrypto with schema extensions;
-create extension if not exists pgjwt with schema extensions;
-```
-
-##### `uuid-ossp`
-
-For UUID functions, required for PostgreSQL `<13`.
-
-##### `pgcrypto` and `pgjwt`
-
-For working with JWT and Auth functions.
-
-### Roles
-
-Supabase creates several [default roles](/docs/guides/database/postgres-roles) in your Postgres database. To restore defaults at any time you can run the commands inside the [schema initialization scripts](https://github.com/supabase/postgres/tree/develop/migrations/db/init-scripts). Remember to change your [role passwords](/docs/guides/self-hosting/docker#securing-your-setup) before deploying to production environments.
-
-### Realtime Logs
-
-Set your database's `log_min_messages` configuration to `fatal` to prevent redundant database logs generated by Realtime. However, you might miss important log messages such as database errors. Configure `log_min_messages` based on your needs.
-
-## API Keys
-
-The API Gateway (Kong) uses JWT to authenticate access through to the database. The JWT should correspond to a relevant Postgres Role,
-and Supabase is designed to work with 2 roles: an `ANON_KEY` for unauthenticated access and a `SERVICE_KEY` for elevated access.
-
-Use this tool to generate keys:
-
-<JwtGenerator />
-
-## Managing your secrets
-
-Many components inside Supabase use secure secrets and passwords. These are listed in the self-hosting
-[env file](https://github.com/supabase/supabase/blob/master/docker/.env.example), but we strongly recommend using a
-secrets manager when deploying to production. Plain text files like dotenv lead to accidental costly leaks.
-
-Some suggested systems include:
-
-- [Doppler](https://www.doppler.com/)
-- [Key Vault](https://docs.microsoft.com/en-us/azure/key-vault/general/overview) by Azure (Microsoft)
-- [Secrets Manager](https://aws.amazon.com/secrets-manager/) by AWS
-- [Secrets Manager](https://cloud.google.com/secret-manager) by GCP
-- [Vault](https://www.hashicorp.com/products/vault) by Hashicorp
-
-## Migrating and Upgrading
-
-If you have decoupled your database from the middleware, then you should be able to redeploy the latest middleware at any time as long as it has no breaking changes.
-Supabase is evolving fast, and we'll continue to improve the migration strategy as part of our core offering.
-
-We realize that database migrations are difficult, and this is one of the problems we plan to make easy for developers.
-
export const Page = ({ children }) => <Layout meta={meta} children={children} />
export default Page
diff --git a/apps/docs/pages/guides/self-hosting/docker.mdx b/apps/docs/pages/guides/self-hosting/docker.mdx
index 649bb5e2d83..68cb792dd88 100644
--- a/apps/docs/pages/guides/self-hosting/docker.mdx
+++ b/apps/docs/pages/guides/self-hosting/docker.mdx
@@ -159,11 +159,80 @@ rm -rf volumes/db/data/
This will destroy all data in the database and storage volumes, so be careful!
-## Common configuration
+## Managing your secrets
+
+Many components inside Supabase use secure secrets and passwords. These are listed in the self-hosting [env file](https://github.com/supabase/supabase/blob/master/docker/.env.example), but we strongly recommend using a secrets manager when deploying to production. Plain text files like dotenv lead to accidental costly leaks.
+
+Some suggested systems include:
+
+- [Doppler](https://www.doppler.com/)
+- [Infisical](https://infisical.com/)
+- [Key Vault](https://docs.microsoft.com/en-us/azure/key-vault/general/overview) by Azure (Microsoft)
+- [Secrets Manager](https://aws.amazon.com/secrets-manager/) by AWS
+- [Secrets Manager](https://cloud.google.com/secret-manager) by GCP
+- [Vault](https://www.hashicorp.com/products/vault) by Hashicorp
+
+## Advanced
+
+Everything beyond this point in the guide helps you understand how the system works and how you can modify it to suit your needs.
+
+### Architecture
+
+Supabase is a combination of open source tools, each specifically chosen for Enterprise-readiness.
+
+If the tools and communities already exist, with an MIT, Apache 2, or equivalent open license, we will use and support that tool.
+If the tool doesn't exist, we build and open source it ourselves.
+
+![Supabase Architecture](/docs/img/supabase-architecture.png)
+
+- [Kong](https://github.com/Kong/kong) is a cloud-native API gateway.
+- [GoTrue](https://github.com/supabase/gotrue) is an SWT based API for managing users and issuing SWT tokens.
+- [PostgREST](http://postgrest.org/) is a web server that turns your PostgreSQL database directly into a RESTful API
+- [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.
+- [Storage](https://github.com/supabase/storage-api) provides a RESTful interface for managing Files stored in S3, using Postgres to manage permissions.
+- [postgres-meta](https://github.com/supabase/postgres-meta) is a RESTful API for managing your Postgres, allowing you to fetch tables, add roles, and run queries, etc.
+- [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.
+
+For the system to work cohesively, some services require additional configuration within the Postgres database. For example, the APIs and Auth system require several [default roles](/docs/guides/database/postgres-roles) amd the `pgjwt` Postgres extension.
+
+You can find all the default extensions inside the [schema migration scripts repo](https://github.com/supabase/postgres/tree/develop/migrations). These scripts are mounted at `/docker-entrypoint-initdb.d` to run automatically when starting the database container.
+
+### Configuring services
+
+Each system has a number of configuration options which can be found in the relevant product documentation.
+
+- [Postgres](https://hub.docker.com/_/postgres/)
+- [PostgREST](https://postgrest.org/en/stable/configuration.html)
+- [Realtime](https://github.com/supabase/realtime#server)
+- [GoTrue](https://github.com/supabase/gotrue)
+- [Storage](https://github.com/supabase/storage-api)
+- [Kong](https://docs.konghq.com/gateway/latest/install/docker/)
+
+ These configuration items are generally added to the `env` section of each service, inside the `docker-compose.yml` section. If these configuration items are sensitive, they should be stored in a [secret manager](/docs/guides/self-hosting#managing-your-secrets) or using an `.env` file and then referenced using the `${}` syntax.
+
+
+<CH.Code>
+
+ ```yml docker-compose.yml
+services:
+ rest:
+ image: postgrest/postgrest
+ environment:
+ PGRST_JWT_SECRET: ${JWT_SECRET}
+ ```
+
+ ```bash .env
+ ## Never check your secrets into version control
+`${JWT_SECRET}`
+ ```
+
+</CH.Code>
+
+### Common configuration
Each system can be [configured](../self-hosting#configuration) independently. Some of the most common configuration options are listed below.
-### Configuring an email server
+#### Configuring an email server
You will need to use a production-ready SMTP server for sending emails. You can configure the SMTP server by updating the the following environment variables:
@@ -178,7 +247,7 @@ SMTP_SENDER_NAME=
We recommend using [AWS SES](https://aws.amazon.com/ses/). It's extremely cheap and reliable. Restart all services to pick up the new configuration.
-### Configuring S3 Storage
+#### Configuring S3 Storage
By default all files are stored locally on the server. You can connfigure the Storage service to use S3 by updating the following environment variables:
@@ -192,11 +261,11 @@ By default all files are stored locally on the server. You can connfigure the St
You can find all the available options in the [storage repository](https://github.com/supabase/storage-api/blob/master/.env.sample). Restart the `storage` service to pick up the changes: `docker compose restart storage --no-deps`
-### Setting database's `log_min_messages`
+#### Setting database's `log_min_messages`
By default, `docker compose` sets the database's `log_min_messages` configuration to `fatal` to prevent redundant logs generated by Realtime. You can configure `log_min_messages` using any of the Postgres [Severity Levels](https://www.postgresql.org/docs/current/runtime-config-logging.html#RUNTIME-CONFIG-SEVERITY-LEVELS).
-### Exposing your Postgres database
+#### Exposing your Postgres database
By default, the Postgres database is only accessible locally. If you want to expose it to the outside world, you can update the `docker-compose.yml` file and remove the `127.0.0.1:` prefix from the `ports` section:
@@ -208,15 +277,33 @@ By default, the Postgres database is only accessible locally. If you want to exp
This is less-secure, so please make sure you are running a firewall in front of your server.
-### File storage backend on macOS
+#### File storage backend on macOS
By default, Storage backend is set to `file`, which is to use local files as the storage backend. For macOS compatibility, you need to choose `VirtioFS` as the Docker container file sharing implementation (in Docker Desktop -> Preferences -> General).
-### Setting up logging with the Analytics server
+#### Setting up logging with the Analytics server
Additional configuration is required for self-hosting the Analytics server. For the full setup instructions, see [Self Hosting Analytics](https://supabase.com/docs/reference/self-hosting-analytics/introduction#getting-started).
+---
+
+{/* Finish with a video. This also appears in the Sidebar via the "tocVideo" metadata */}
+
+## Demo
+
+A minimal setup working on Ubuntu, hosted on Digital Ocean.
+
+
+<div className="video-container">
+ <iframe
+ src="https://www.youtube-nocookie.com/embed/FqiQKRKsfZE"
+ frameBorder="1"
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
+ allowFullScreen
+ ></iframe>
+</div>
+
export const Page = ({ children }) => <Layout meta={meta} children={children} />
export default Page