forked from caprover/one-click-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsupabase.yml
421 lines (392 loc) · 17.1 KB
/
supabase.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
captainVersion: 4
services:
$$cap_appname-studio:
image: supabase/studio:$$cap_studio_version
restart: unless-stopped
environment:
STUDIO_PG_META_URL: http://$$cap_appname-pg-meta.$$cap_root_domain
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
DEFAULT_ORGANIZATION: ${STUDIO_DEFAULT_ORGANIZATION}
DEFAULT_PROJECT: ${STUDIO_DEFAULT_PROJECT}
SUPABASE_URL: http://$$cap_appname-supabase-kong.$$cap_root_domain
SUPABASE_PUBLIC_URL: http://$$cap_appname-supabase-studio.$$cap_root_domain
# Kept for backwards compatibility with studio:0.22.08
SUPABASE_REST_URL: http://$$cap_appname-rest.$$cap_root_domain/rest/v1/
SUPABASE_ANON_KEY: $$cap_supabase_anon_key
SUPABASE_SERVICE_KEY: $$cap_supabase_service_key
caproverExtra:
containerHttpPort: $$cap_studio_http_port
$$cap_appname-kong:
image: kong:$$cap_kong_version
volumes:
- $$cap_appname-kong-config:/var/lib/kong:ro
restart: unless-stopped
ports:
- $$cap_kong_https_port:8443
environment:
KONG_DATABASE: $$cap_kong_database
KONG_DECLARATIVE_CONFIG: $$cap_kong_declaritive_config
# https://github.com/supabase/cli/issues/14
KONG_DNS_ORDER: $$cap_kong_dns_order
KONG_PLUGINS: $$cap_kong_plugins
KONG_ADMIN_LISTEN: 0.0.0.0:$$cap_kong_admin_port, 0.0.0.0:$$cap_kong_admin_ssl_port ssl
KONG_NGINX_PROXY_PROXY_BUFFER_SIZE: 160k
KONG_NGINX_PROXY_PROXY_BUFFERS: 64 160k
caproverExtra:
containerHttpPort: 8000
$$cap_appname-auth:
image: supabase/gotrue:$$cap_auth_version
depends_on:
- $$cap_appname-db
restart: unless-stopped
environment:
GOTRUE_API_HOST: $$cap_gotrue_api_host
GOTRUE_API_PORT: $$cap_gotrue_api_port
API_EXTERNAL_URL: http://$$cap_appname-rest.$$cap_root_domain
GOTRUE_DB_DRIVER: postgres
GOTRUE_DB_DATABASE_URL: postgres://$$cap_pg_user:$$cap_pg_pass@srv-captain--$$cap_appname-db:5432/$$cap_pg_db?sslmode=disable&search_path=auth
GOTRUE_SITE_URL: $$cap_appname-auth.$$cap_root_domain
GOTRUE_URI_ALLOW_LIST: $$cap_gotrue_uri_allow_list
GOTRUE_DISABLE_SIGNUP: $$cap_gotrue_disable_signup
GOTRUE_JWT_ADMIN_ROLES: service_role
GOTRUE_JWT_AUD: authenticated
GOTRUE_JWT_DEFAULT_GROUP_NAME: authenticated
GOTRUE_JWT_EXP: $$cap_gotrue_jwt_expiry
GOTRUE_JWT_SECRET: $$cap_jwt_secret
GOTRUE_EXTERNAL_EMAIL_ENABLED: $$cap_gotrue_external_email_enabled
GOTRUE_MAILER_AUTOCONFIRM: $$cap_gotrue_mailer_autoconfirm
GOTRUE_SMTP_ADMIN_EMAIL: $$cap_gotrue_smtp_admin_email
GOTRUE_SMTP_HOST: $$cap_gotrue_smtp_host
GOTRUE_SMTP_PORT: $$cap_gotrue_smtp_port
GOTRUE_SMTP_USER: $$cap_gotrue_smtp_user
GOTRUE_SMTP_PASS: $$cap_gotrue_smtp_pass
GOTRUE_SMTP_SENDER_NAME: $$cap_gotrue_smtp_sender_name
GOTRUE_MAILER_URLPATHS_INVITE: /auth/v1/verify
GOTRUE_MAILER_URLPATHS_CONFIRMATION: /auth/v1/verify
GOTRUE_MAILER_URLPATHS_RECOVERY: /auth/v1/verify
GOTRUE_MAILER_URLPATHS_EMAIL_CHANGE: /auth/v1/verify
GOTRUE_EXTERNAL_PHONE_ENABLED: $$cap_gotrue_enable_phone_signup
GOTRUE_SMS_AUTOCONFIRM: $$cap_gotrue_sms_autoconfirm
MFA_ENABLED: $$cap_gotrue_mfa_enabled
caproverExtra:
containerHttpPort: $$cap_gotrue_api_port
$$cap_appname-rest:
image: postgrest/postgrest:$$cap_postgrest_version
depends_on:
- $$cap_appname-db
restart: unless-stopped
environment:
PGRST_DB_URI: postgres://$$cap_pg_user:$$cap_pg_pass@srv-captain--$$cap_appname-db:5432/$$cap_pg_db
PGRST_DB_SCHEMA: $$cap_postgrest_db_schemas
PGRST_DB_ANON_ROLE: anon
PGRST_JWT_SECRET: $$cap_jwt_secret
PGRST_DB_USE_LEGACY_GUCS: 'false'
caproverExtra:
containerHttpPort: 3000
$$cap_appname-realtime:
image: supabase/realtime:$$cap_realtime_version
depends_on:
- $$cap_appname-db
restart: unless-stopped
environment:
PORT: 4000
DB_HOST: srv-captain--$$cap_appname-db
DB_PORT: 5432
DB_USER: $$cap_pg_user
DB_PASSWORD: $$cap_pg_pass
DB_NAME: $$cap_pg_db
DB_AFTER_CONNECT_QUERY: 'SET search_path TO _realtime'
DB_ENC_KEY: supabaserealtime
API_JWT_SECRET: $$cap_jwt_secret
FLY_ALLOC_ID: fly123
FLY_APP_NAME: realtime
SECRET_KEY_BASE: UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq
ERL_AFLAGS: -proto_dist inet_tcp
ENABLE_TAILSCALE: 'false'
DNS_NODES: "''"
caproverExtra:
containerHttpPort: 4000
dockerfileLines:
# https://github.com/caprover/one-click-apps/pull/833#issuecomment-1445213826
- FROM supabase/realtime:$$cap_realtime_version - CMD sh -c "/app/bin/migrate && /app/bin/realtime eval 'Realtime.Release.seeds(Realtime.Repo)' && /app/bin/server"
$$cap_appname-storage:
image: supabase/storage-api:$$cap_storage_version
depends_on:
- $$cap_appname-db
- $$cap_appname-rest
restart: unless-stopped
volumes:
- $$cap_appname-storage:/var/lib/storage
environment:
ANON_KEY: $$cap_supabase_anon_key
SERVICE_KEY: $$cap_supabase_service_key
POSTGREST_URL: srv-captain--$$cap_appname-rest
PGRST_JWT_SECRET: $$cap_jwt_secret
DATABASE_URL: postgres://$$cap_pg_user:$$cap_pg_pass@srv-captain--$$cap_appname-db:5432/$$cap_pg_db
FILE_SIZE_LIMIT: $$cap_storage_file_size_limit
STORAGE_BACKEND: file
FILE_STORAGE_BACKEND_PATH: /var/lib/storage
TENANT_ID: stub
REGION: stub
GLOBAL_S3_BUCKET: stub
ENABLE_IMAGE_TRANSFORMATION: 'true'
IMGPROXY_URL: http://$$cap_appname-imgproxy.$$cap_root_domain
caproverExtra:
containerHttpPort: 5000
$$cap_appname-imgproxy:
image: darthsim/imgproxy:$$cap_imgproxy_version
environment:
IMGPROXY_BIND: ':5001'
IMGPROXY_LOCAL_FILESYSTEM_ROOT: /
IMGPROXY_USE_ETAG: 'true'
volumes:
- $$cap_appname-imgproxy-storage:/var/lib/storage
caproverExtra:
containerHttpPort: 5001
$$cap_appname-pg-meta:
image: supabase/postgres-meta:$$cap_pg_meta_version
depends_on:
- $$cap_appname-db
restart: unless-stopped
environment:
PG_META_PORT: $$cap_pg_meta_port
PG_META_DB_HOST: srv-captain--$$cap_appname-db
PG_META_DB_PORT: 5432
PG_META_DB_NAME: $$cap_pg_db
PG_META_DB_USER: $$cap_pg_user
PG_META_DB_PASSWORD: $$cap_pg_pass
caproverExtra:
containerHttpPort: $$cap_pg_meta_port
$$cap_appname-db:
# not using postgres image because supabase/postgres
# has some additional initdb script
image: supabase/postgres:$$cap_db_version
volumes:
- $$cap_appname-db-realtime:/docker-entrypoint-initdb.d/realtime.sql
- $$cap_appname-db-roles:/docker-entrypoint-initdb.d/roles.sql
# Must be superuser to enable pg_net extension
- $$cap_appname-db-webhooks:/etc/postgresql.schema.sql
- $$cap_appname-db-data:/var/lib/postgresql/data
restart: unless-stopped
environment:
POSTGRES_HOST: /var/run/postgresql
PGPORT: 5432
POSTGRES_PORT: 5432
PGPASSWORD: $$cap_pg_pass
POSTGRES_PASSWORD: $$cap_pg_pass
PGDATABASE: $$cap_pg_db
POSTGRES_DB: $$cap_pg_db
caproverExtra:
notExposeAsWebApp: 'true'
caproverOneClickApp:
variables:
# shared env
- id: $$cap_jwt_secret
label: JWT secret
defaultValue: $$cap_gen_random_hex(32)
validRegex: /^([^\s^\/])+$/
- id: $$cap_supabase_anon_key
label: Supabase Anon Key
description: Generate ANON_KEY using your JWT secret at https://supabase.io/docs/guides/hosting/overview#api-keys
validRegex: /^([^\s^\/])+$/
- id: $$cap_supabase_service_key
label: Supabase Service Key
description: Generate SERVICE_KEY using your JWT secret at https://supabase.io/docs/guides/hosting/overview#api-keys
validRegex: /^([^\s^\/])+$/
# studio variables
- id: $$cap_studio_version
label: Studio version
defaultValue: '20230216-e731b77'
description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/studio/tags
validRegex: /^([^\s^\/])+$/
- id: $$cap_studio_http_port
label: Studio HTTP port
defaultValue: '3000'
validRegex: /^\d+$/
# kong variables
- id: $$cap_kong_version
label: Kong version
defaultValue: '2.8.1'
description: Check out their Docker page for the valid tags https://hub.docker.com/_/kong?tab=tags
validRegex: /^([^\s^\/])+$/
- id: $$cap_kong_http_port
label: Kong HTTP port
defaultValue: '8000'
validRegex: /^\d+$/
- id: $$cap_kong_https_port
label: Kong HTTPS port
defaultValue: '8443'
validRegex: /^\d+$/
- id: $$cap_kong_admin_port
label: Kong Admin Listen port
defaultValue: '8001'
validRegex: /^\d+$/
- id: $$cap_kong_admin_ssl_port
label: Kong Admin Listen SSL port
defaultValue: '8444'
validRegex: /^\d+$/
- id: $$cap_kong_database
label: Kong Database
defaultValue: 'off'
validRegex: /^([^\s^\/])+$/
- id: $$cap_kong_declaritive_config
label: Kong Declarative Config
defaultValue: '/var/lib/kong/kong.yml'
- id: $$cap_kong_dns_order
label: Kong DNS order
defaultValue: 'LAST,A,CNAME'
validRegex: /^([^\s^\/])+$/
- id: $$cap_kong_plugins
label: Kong Plugins
defaultValue: 'request-transformer,cors,key-auth,acl'
validRegex: /^([^\s^\/])+$/
# auth variables
- id: $$cap_auth_version
label: Auth Version
defaultValue: 'v2.47.0'
description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/gotrue/tags
validRegex: /^([^\s^\/])+$/
- id: $$cap_gotrue_api_host
label: Gotrue API Host
defaultValue: '0.0.0.0'
validRegex: /^([^\s^\/])+$/
- id: $$cap_gotrue_api_port
label: Gotrue API port
defaultValue: '9999'
validRegex: /^([^\s^\/])+$/
- id: $$cap_gotrue_uri_allow_list
label: Gotrue URI allow list
defaultValue: ''
- id: $$cap_gotrue_disable_signup
label: Gotrue Disable Signup
defaultValue: 'false'
validRegex: /^(true|false)$/
- id: $$cap_gotrue_jwt_expiry
label: Gotrue JWT expiry
defaultValue: '84600'
validRegex: /^\d+$/
- id: $$cap_gotrue_external_email_enabled
label: Gotrue external email enabled
defaultValue: 'true'
validRegex: /^(true|false)$/
- id: $$cap_gotrue_mailer_autoconfirm
label: Gotrue mailer autoconfirm
defaultValue: 'false'
validRegex: /^(true|false)$/
- id: $$cap_gotrue_smtp_admin_email
label: Gotrue SMTP admin email
defaultValue: '[email protected]'
- id: $$cap_gotrue_smtp_host
label: Gotrue SMTP Host
defaultValue: ''
- id: $$cap_gotrue_smtp_port
label: Gotrue SMTP port
defaultValue: '567'
validRegex: /^\d+$/
- id: $$cap_gotrue_smtp_user
label: Gotrue SMTP user
defaultValue: ''
- id: $$cap_gotrue_smtp_pass
label: Gotrue SMTP password
defaultValue: ''
- id: $$cap_gotrue_smtp_sender_name
label: Gotrue SMTP sender name
defaultValue: ''
- id: $$cap_gotrue_enable_phone_signup
label: Gotrue External Phone Signup
defaultValue: 'true'
validRegex: /^(true|false)$/
- id: $$cap_gotrue_sms_autoconfirm
label: Gotrue SMS autoconfirm
defaultValue: 'false'
validRegex: /^(true|false)$/
- id: $$cap_gotrue_mfa_enabled
label: Gotrue MFA enabled
defaultValue: 'false'
validRegex: /^(true|false)$/
# postgrest variables
- id: $$cap_postgrest_version
label: Postgrest Version
defaultValue: 'v10.1.2'
description: Check out their Docker page for the valid tags https://hub.docker.com/r/postgrest/postgrest/tags
validRegex: /^([^\s^\/])+$/
- id: $$cap_postgrest_db_schemas
label: Postgrest DB Schemas
defaultValue: 'public, storage'
validRegex: /^([^\s^\/])+$/
# realtime variables
- id: $$cap_realtime_version
label: Storage Realtime Version
defaultValue: 'v2.5.1'
description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/realtime/tags
validRegex: /^([^\s^\/])+$/
# storage variables
- id: $$cap_storage_version
label: Storage API Version
defaultValue: 'v0.28.2'
description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/gotrue/tags
validRegex: /^([^\s^\/])+$/
- id: $$cap_storage_file_size_limit
label: Storage File Size Limit
defaultValue: '52428800'
validRegex: /^\d+$/
# postgres variables
- id: $$cap_db_version
label: Postgres Version
defaultValue: '15.1.0.42-rc2'
description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/postgres/tags
validRegex: /^([^\s^\/])+$/
- id: $$cap_pg_user
label: Postgres Username
defaultValue: 'postgres'
validRegex: /.{1,}/
- id: $$cap_pg_pass
label: Postgres Password
defaultValue: $$cap_gen_random_hex(64)
validRegex: /.{1,}/
- id: $$cap_pg_db
label: Postgres Default Database
defaultValue: 'postgres'
validRegex: /.{1,}/
# pg-meta variables
- id: $$cap_pg_meta_version
label: Postgres Meta Version
defaultValue: 'v0.60.7'
description: Check out their Docker page for the valid tags https://hub.docker.com/r/supabase/postgres-meta/tags
validRegex: /^([^\s^\/])+$/
- id: $$cap_pg_meta_port
label: Postgres Meta Port
defaultValue: '8080'
validRegex: /^\d+$/
# imgproxy variables
- id: $$cap_imgproxy_version
label: ImgProxy Version
defaultValue: 'v3.11'
description: Check out their Docker page for the valid tags https://hub.docker.com/r/darthsim/imgproxy/tags
validRegex: /^([^\s^\/])+$/
instructions:
start: >-
Supabase is an open source Firebase alternative.
end: >
Supabase is deployed.
1. Make sure to enable websocket support inside $$cap_appname-realtime.
2. You will also have to create a kong.yml inside /var/lib/docker/volumes/captain--$$cap_appname-kong-config/_data
Check https://github.com/supabase/supabase/blob/master/docker/volumes/api/kong.yml for the example content
(make sure to edit and add your ANON_KEY, SERVICE_KEY and service url)
3. # Set $$cap_appname-db instance count to 0
`docker service scale srv-captain--$$cap_appname-db=0`
4. Run the following command
# delete already created database
`rm -rf /var/lib/docker/volumes/captain--$$cap_appname-db-data/_data/*`
# clone supabase repo to extract migrations
`git clone https://github.com/supabase/supabase`
# copy migrations required for supabase
`cp supabase/docker/volumes/db/init/* /var/lib/docker/volumes/captain--$$cap_appname-db-init/_data/ && rm -rf supabase`
# now set instance count for $$cap_appname-db back to 1
`docker service scale srv-captain--$$cap_appname-db=1`
# once database is started, set wal_level to logical and restart database again
`echo "wal_level = 'logical'" >> /var/lib/docker/volumes/captain--$$cap_appname-db-data/_data/postgresql.conf`
displayName: Supabase
isOfficial: true
description: Supabase is an open source Firebase alternative.
documentation: Taken from https://github.com/supabase/supabase