You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/postgresql/SELF_HOSTED_POSTGRES_QUICKSTART.md
+28-5Lines changed: 28 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,16 +4,22 @@ This guide helps you enable CloudSync on a **self-hosted PostgreSQL database**.
4
4
5
5
## Step 1: Deploy PostgreSQL with CloudSync
6
6
7
-
Use the pre-built PostgreSQL Docker image that includes the CloudSync extension. This image is available for:
8
-
- PostgreSQL 15
9
-
- PostgreSQL 17
7
+
You can enable CloudSync in one of two ways:
8
+
- Use the published Docker image if you run PostgreSQL in Docker
9
+
- Install the released extension files into an existing native PostgreSQL installation
10
+
11
+
### Option A: Docker
12
+
13
+
Use the published PostgreSQL image that already includes the CloudSync extension:
14
+
-`sqlitecloud/sqlite-sync-postgres:15`
15
+
-`sqlitecloud/sqlite-sync-postgres:17`
10
16
11
17
Example using Docker Compose:
12
18
13
19
```yaml
14
20
services:
15
21
db:
16
-
image: <cloudsync-postgres-image>
22
+
image: sqlitecloud/sqlite-sync-postgres:17
17
23
container_name: cloudsync-postgres
18
24
environment:
19
25
POSTGRES_USER: postgres
@@ -39,6 +45,23 @@ Run:
39
45
docker compose up -d
40
46
```
41
47
48
+
### Option B: Existing PostgreSQL Without Docker
49
+
50
+
If you already run PostgreSQL directly on a VM or bare metal, download the release tarball that matches your operating system, CPU architecture, and PostgreSQL major version.
51
+
52
+
Extract the archive, then copy the three extension files into PostgreSQL's extension directories:
Copy file name to clipboardExpand all lines: docs/postgresql/SELF_HOSTED_SUPABASE_QUICKSTART.md
+43-11Lines changed: 43 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,26 +2,51 @@
2
2
3
3
This guide helps you enable CloudSync on a **fresh or existing** self-hosted Supabase instance. CloudSync adds offline-first synchronization capabilities to your PostgreSQL database.
4
4
5
-
## Step 1: Use the Custom PostgreSQL Image with CloudSync
5
+
## Step 1: Use the CloudSync Supabase Image
6
6
7
-
When deploying or updating your Supabase instance, use our custom PostgreSQL image that includes the CloudSync extension instead of the standard Supabase Postgres image.
7
+
When deploying or updating your Supabase instance, use the published CloudSync Supabase image instead of the standard Supabase Postgres image.
8
8
9
9
### For New Deployments
10
10
11
-
Follow [Supabase's Installing Supabase](https://supabase.com/docs/guides/self-hosting/docker#installing-supabase) guide to set up the initial files and `.env` configuration. Then, instead of using the default Supabase Postgres image, update your `docker-compose.yml`:
11
+
Follow [Supabase's Installing Supabase](https://supabase.com/docs/guides/self-hosting/docker#installing-supabase) guide to set up the initial files and `.env` configuration. Then, before the first `docker compose up -d`, update your `docker-compose.yml` to use the CloudSync-enabled Postgres image:
Use the tag that matches your Supabase Postgres base image exactly. Convenience tags `sqlitecloud/sqlite-sync-supabase:15` and `sqlitecloud/sqlite-sync-supabase:17` are also published, but the exact Supabase tag is the safest choice.
25
+
26
+
### Add the CloudSync Init Script
27
+
28
+
Create the init SQL:
29
+
30
+
```bash
31
+
mkdir -p volumes/db
32
+
cat > volumes/db/cloudsync.sql << 'EOF'
33
+
CREATE EXTENSION IF NOT EXISTS cloudsync;
34
+
EOF
35
+
```
36
+
37
+
Add a volume mount to the `db` service in `docker-compose.yml`:
The `100-` prefix ensures CloudSync loads after Supabase's own init scripts, which are typically numbered `98-99` in the self-hosted Docker Compose setup.
48
+
49
+
Then start Supabase:
25
50
26
51
```bash
27
52
docker compose pull
@@ -30,14 +55,22 @@ docker compose up -d
30
55
31
56
### For Existing Deployments
32
57
33
-
Follow [Supabase's Updating](https://supabase.com/docs/guides/self-hosting/docker#updating) guide. When updating the Postgres image, replace the default image with the CloudSync-enabled image (will be provided):
58
+
Follow [Supabase's Updating](https://supabase.com/docs/guides/self-hosting/docker#updating) guide. When updating the Postgres image, replace the default image with the matching CloudSync image:
34
59
35
60
```bash
36
-
# Update docker-compose.yml with the new CloudSync image
61
+
# Update docker-compose.yml to use:
62
+
# sqlitecloud/sqlite-sync-supabase:15.8.1.085
63
+
# or sqlitecloud/sqlite-sync-supabase:17.6.1.071
37
64
docker compose pull
38
65
docker compose down && docker compose up -d
39
66
```
40
67
68
+
If Postgres has already been initialized and you are adding CloudSync afterward, the init script will not run automatically. Connect to the database and run:
69
+
70
+
```sql
71
+
CREATE EXTENSION IF NOT EXISTS cloudsync;
72
+
```
73
+
41
74
---
42
75
43
76
## Step 2: Register Your Database in the CloudSync Dashboard
@@ -108,4 +141,3 @@ If you need role-based access control (RLS) or production security:
0 commit comments