Skip to content

Commit

Permalink
fix: Add Realtime API Routes (supabase#23237)
Browse files Browse the repository at this point in the history
Exposes the API routes for Realtime appropriately via Kong configuration.

Also alters the analytics configuration to avoid extra logs due to having only one analytics server instead of a cluster

Co-authored-by: Rodrigo Mansueli <[email protected]>
  • Loading branch information
filipecabaco and mansueli committed Apr 25, 2024
1 parent 08b2bd4 commit 03aa5c3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 10 deletions.
3 changes: 2 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ services:
# See: https://supabase.com/docs/guides/auth/auth-hooks#hook-custom-access-token for details
# GOTRUE_HOOK_CUSTOM_ACCESS_TOKEN_ENABLED="true"
# GOTRUE_HOOK_CUSTOM_ACCESS_TOKEN_URI="pg-functions:https://postgres/public/custom_access_token_hook"

# GOTRUE_HOOK_MFA_VERIFICATION_ATTEMPT_ENABLED="true"
# GOTRUE_HOOK_MFA_VERIFICATION_ATTEMPT_URI="pg-functions:https://postgres/public/mfa_verification_attempt"

Expand Down Expand Up @@ -339,6 +339,7 @@ services:
LOGFLARE_API_KEY: ${LOGFLARE_API_KEY}
LOGFLARE_SINGLE_TENANT: true
LOGFLARE_SUPABASE_MODE: true
LOGFLARE_MIN_CLUSTER_SIZE: 1

# Comment variables to use Big Query backend for analytics
POSTGRES_BACKEND_URL: postgresql:https://supabase_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}
Expand Down
36 changes: 27 additions & 9 deletions docker/volumes/api/kong.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,14 @@ acls:
### Dashboard credentials
###
basicauth_credentials:
- consumer: DASHBOARD
username: $DASHBOARD_USERNAME
password: $DASHBOARD_PASSWORD

- consumer: DASHBOARD
username: $DASHBOARD_USERNAME
password: $DASHBOARD_PASSWORD

###
### API Routes
###
services:

## Open Auth routes
- name: auth-v1-open
url: http:https://auth:9999/verify
Expand Down Expand Up @@ -134,11 +132,12 @@ services:
- anon

## Secure Realtime routes
- name: realtime-v1
- name: realtime-v1-ws
_comment: 'Realtime: /realtime/v1/* -> ws:https://realtime:4000/socket/*'
url: http:https://realtime-dev.supabase-realtime:4000/socket/
url: http:https://realtime-dev.supabase-realtime:4000/socket
protocol: ws
routes:
- name: realtime-v1-all
- name: realtime-v1-ws
strip_path: true
paths:
- /realtime/v1/
Expand All @@ -153,7 +152,26 @@ services:
allow:
- admin
- anon

- name: realtime-v1-rest
_comment: 'Realtime: /realtime/v1/* -> ws:https://realtime:4000/socket/*'
url: http:https://realtime-dev.supabase-realtime:4000/api
protocol: http
routes:
- name: realtime-v1-rest
strip_path: true
paths:
- /realtime/v1/api
plugins:
- name: cors
- name: key-auth
config:
hide_credentials: false
- name: acl
config:
hide_groups_header: true
allow:
- admin
- anon
## Storage routes: the storage server manages its own auth
- name: storage-v1
_comment: 'Storage: /storage/v1/* -> http:https://storage:5000/*'
Expand Down

0 comments on commit 03aa5c3

Please sign in to comment.