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: apps/docs/content/guides/self-hosting/docker.mdx
+33-30Lines changed: 33 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,14 @@
1
1
---
2
-
title: "Self-Hosting with Docker"
3
-
description: "Learn how to configure and deploy Supabase with Docker."
4
-
subtitle: "Learn how to configure and deploy Supabase with Docker."
5
-
tocVideo: "FqiQKRKsfZE"
2
+
title: 'Self-Hosting with Docker'
3
+
description: 'Learn how to configure and deploy Supabase with Docker.'
4
+
subtitle: 'Learn how to configure and deploy Supabase with Docker.'
5
+
tocVideo: 'FqiQKRKsfZE'
6
6
---
7
7
8
8
Docker is the easiest way to get started with self-hosted Supabase. It should only take you a few minutes to get up and running. This guide assumes you are running the command from the machine you intend to host from.
9
9
10
10
## Contents
11
+
11
12
1.[Before you begin](#before-you-begin)
12
13
2.[Installing and running Supabase](#installing-and-running-supabase)
13
14
3.[Accessing your services](#accessing-supabase-studio)
@@ -142,12 +143,14 @@ The default tenant ID is `your-tenant-id`, and the default password is `your-sup
142
143
By default, the database is not accessible from outside the local machine but the pooler is. You can [change this](#exposing-your-postgres-database) by updating the `docker-compose.yml` file.
143
144
144
145
## Updating your services
146
+
145
147
For security reasons, we "pin" the versions of each service in the docker-compose file (these versions are updated ~monthly). If you want to update any services immediately, you can do so by updating the version number in the docker compose file and then running `docker compose pull`. You can find all the latest docker images in the [Supabase Docker Hub](https://hub.docker.com/u/supabase).
146
148
147
149
You should update your services frequently to get the latest features and bug fixes and security patches. Note that you will need to restart the services to pick up the changes, which will result in some downtime for your services.
148
150
149
151
**Example**
150
152
You'll want to update the Studio(Dashboard) frequently to get the latest features and bug fixes. To update the Dashboard:
153
+
151
154
1. Visit the [supabase/studio](https://hub.docker.com/r/supabase/studio/tags) image in the [Supabase Docker Hub](https://hub.docker.com/u/supabase)
152
155
2. Find the latest version (tag) number. It will look something like `20241029-46e1e40`
153
156
3. Update the `image` field in the `docker-compose.yml` file to the new version. It should look like this: `image: supabase/studio:20241028-a265374`
@@ -158,6 +161,7 @@ You'll want to update the Studio(Dashboard) frequently to get the latest feature
158
161
While we provided you with some example secrets for getting started, you should NEVER deploy your Supabase setup using the defaults we have provided. Please follow all of the steps in this section to ensure you have a secure setup, and then [restart all services](#restarting-all-services) to pick up the changes.
159
162
160
163
### Generate API keys
164
+
161
165
We need to generate secure keys for accessing your services. We'll use the `JWT Secret` to generate `anon` and `service` API keys using the form below.
162
166
163
167
1.**Obtain a Secret**: Use the 40-character secret provided, or create your own. If creating, ensure it's a strong, random string of 40 characters.
@@ -170,8 +174,8 @@ We need to generate secure keys for accessing your services. We'll use the `JWT
170
174
171
175
Run this form twice to generate new `anon` and `service` API keys. Replace the values in the `./docker/.env` file:
172
176
173
-
-`ANON_KEY` - replace with an `anon` key
174
-
-`SERVICE_ROLE_KEY` - replace with a `service` key
177
+
-`ANON_KEY` - replace with an `anon` key
178
+
-`SERVICE_ROLE_KEY` - replace with a `service` key
175
179
176
180
You will need to [restart](#restarting-all-services) the services for the changes to take effect.
177
181
@@ -191,19 +195,20 @@ You will need to [restart](#restarting-all-services) the services for the change
191
195
192
196
The Dashboard is protected with basic authentication. The default user and password MUST be updated before using Supabase in production.
193
197
Update the following values in the `./docker/.env` file:
194
-
-`DASHBOARD_USERNAME`: The default username for the Dashboard
195
-
-`DASHBOARD_PASSWORD`: The default password for the Dashboard
198
+
199
+
-`DASHBOARD_USERNAME`: The default username for the Dashboard
200
+
-`DASHBOARD_PASSWORD`: The default password for the Dashboard
196
201
197
202
You can also add more credentials for multiple users in `./docker/volumes/api/kong.yml`. For example:
198
203
199
204
```yaml docker/volumes/api/kong.yml
200
205
basicauth_credentials:
201
-
- consumer: DASHBOARD
202
-
username: user_one
203
-
password: password_one
204
-
- consumer: DASHBOARD
205
-
username: user_two
206
-
password: password_two
206
+
- consumer: DASHBOARD
207
+
username: user_one
208
+
password: password_one
209
+
- consumer: DASHBOARD
210
+
username: user_two
211
+
password: password_two
207
212
```
208
213
209
214
You will need to [restart](#restarting-all-services) the services for the changes to take effect.
@@ -297,23 +302,22 @@ Each system has a number of configuration options which can be found in the rele
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.
301
-
305
+
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.
302
306
303
307
<CH.Code>
304
308
305
-
```yml docker-compose.yml
309
+
```yml docker-compose.yml
306
310
services:
307
311
rest:
308
312
image: postgrest/postgrest
309
313
environment:
310
314
PGRST_JWT_SECRET: ${JWT_SECRET}
311
-
```
315
+
```
312
316
313
-
```bash .env
314
-
## Never check your secrets into version control
317
+
```bash .env
318
+
## Never check your secrets into version control
315
319
`${JWT_SECRET}`
316
-
```
320
+
```
317
321
318
322
</CH.Code>
319
323
@@ -341,11 +345,10 @@ We recommend using [AWS SES](https://aws.amazon.com/ses/). It's extremely cheap
341
345
By default all files are stored locally on the server. You can configure the Storage service to use S3 by updating the following environment variables:
342
346
343
347
```yaml docker-compose.yml
344
-
storage:
345
-
environment:
346
-
STORAGE_BACKEND=s3
347
-
GLOBAL_S3_BUCKET=name-of-your-s3-bucket
348
-
REGION=region-of-your-s3-bucket
348
+
storage:
349
+
environment: STORAGE_BACKEND=s3
350
+
GLOBAL_S3_BUCKET=name-of-your-s3-bucket
351
+
REGION=region-of-your-s3-bucket
349
352
```
350
353
351
354
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`
@@ -369,9 +372,9 @@ If you need direct access to the Postgres database without going through Supavis
369
372
# supavisor:
370
373
# ports:
371
374
# ...
372
-
db:
373
-
ports:
374
-
- ${POSTGRES_PORT}:${POSTGRES_PORT}
375
+
db:
376
+
ports:
377
+
- ${POSTGRES_PORT}:${POSTGRES_PORT}
375
378
```
376
379
377
380
This is less-secure, so please make sure you are running a firewall in front of your server.
@@ -394,7 +397,6 @@ All data in analytics will be deleted when you run the commands below.
394
397
395
398
</Admonition>
396
399
397
-
398
400
```sh
399
401
### Destroy analytics to transition to postgres self hosted solution without other data loss
400
402
@@ -422,6 +424,7 @@ A minimal setup working on Ubuntu, hosted on DigitalOcean.
422
424
</div>
423
425
424
426
### Demo using DigitalOcean
427
+
425
428
1. A DigitalOcean Droplet with 1 GB memory and 25 GB solid-state drive (SSD) is sufficient to start
426
429
2. To access the Dashboard, use the ipv4 IP address of your Droplet.
427
430
3. If you're unable to access Dashboard, run `docker compose ps` to see if the Studio service is running and healthy.
0 commit comments