Skip to content

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

fixes: https://github.com/supabase/supabase/issues/13064

Copple19f29fae54b4
diff --git a/apps/docs/pages/guides/self-hosting/docker.mdx b/apps/docs/pages/guides/self-hosting/docker.mdx
index dd68add6bd2..1260aad288a 100644
--- a/apps/docs/pages/guides/self-hosting/docker.mdx
+++ b/apps/docs/pages/guides/self-hosting/docker.mdx
@@ -68,10 +68,10 @@ You can add new Functions as `volumes/functions/<FUNCTION_NAME>/index.ts`. Resta
### Accessing Postgres
-You can connect to the Postgres database on port `5432`, from any Postgres client. For example, you can use the `psql` command line tool from a remote machine, using your server's IP address:
+You can connect to the Postgres database locally on port `5432`. For example, you can use the `psql` command line tool on your local machine you can run:
```bash
-psql -h your_ip -p 5432 -d postgres -U postgres
+psql -h localhost -p 5432 -d postgres -U postgres
```
The default password is `your-super-secret-and-long-postgres-password`. You should change this as soon as possible using the instructions below.
@@ -180,6 +180,17 @@ You can find all the available options in the [storage repository](https://githu
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
+
+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:
+
+```yaml docker-compose.yml
+ db:
+ ports:
+ - ${POSTGRES_PORT}:${POSTGRES_PORT}
+```
+
+This is less-secure, so please make sure you are running a firewall in front of your server.
### File storage backend on macOS
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index 1477848b1f0..a4bc0ce9866 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -281,7 +281,7 @@ services:
restart: unless-stopped
ports:
# Pass down internal port because it's set dynamically by other services
- - ${POSTGRES_PORT}:${POSTGRES_PORT}
+ - 127.0.0.1:${POSTGRES_PORT}:${POSTGRES_PORT}
environment:
POSTGRES_HOST: /var/run/postgresql
PGPORT: ${POSTGRES_PORT}