From ee80f9a10f424e6b84c946ea005ad134438b6443 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 12 Dec 2025 10:42:31 +0100 Subject: [PATCH] Add Kong API gateway config --- supabase/volumes/api/kong.yml | 199 ++++++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+) create mode 100644 supabase/volumes/api/kong.yml diff --git a/supabase/volumes/api/kong.yml b/supabase/volumes/api/kong.yml new file mode 100644 index 0000000..44e4446 --- /dev/null +++ b/supabase/volumes/api/kong.yml @@ -0,0 +1,199 @@ +_format_version: "2.1" +_transform: true + +### +### Consumers / JWT Credentials +### + +consumers: + - username: DASHBOARD + - username: anon + keyauth_credentials: + - key: ${SUPABASE_ANON_KEY} + - username: service_role + keyauth_credentials: + - key: ${SUPABASE_SERVICE_KEY} + +### +### Access Control Lists +### + +acls: + - consumer: anon + group: anon + - consumer: service_role + group: admin + +### +### Dashboard Authentication +### + +basicauth_credentials: + - consumer: DASHBOARD + username: ${DASHBOARD_USERNAME} + password: ${DASHBOARD_PASSWORD} + +### +### API Routes +### + +services: + ## Open routes (no auth) + - name: auth-v1-open + url: http://supabase-auth:9999/verify + routes: + - name: auth-v1-open + strip_path: true + paths: + - /auth/v1/verify + plugins: + - name: cors + + - name: auth-v1-open-callback + url: http://supabase-auth:9999/callback + routes: + - name: auth-v1-open-callback + strip_path: true + paths: + - /auth/v1/callback + plugins: + - name: cors + + - name: auth-v1-open-authorize + url: http://supabase-auth:9999/authorize + routes: + - name: auth-v1-open-authorize + strip_path: true + paths: + - /auth/v1/authorize + plugins: + - name: cors + + ## Auth routes + - name: auth-v1 + _comment: "GoTrue: /auth/v1/* -> http://supabase-auth:9999/*" + url: http://supabase-auth:9999/ + routes: + - name: auth-v1-all + strip_path: true + paths: + - /auth/v1/ + plugins: + - name: cors + - name: key-auth + config: + hide_credentials: false + + ## REST API routes + - name: rest-v1 + _comment: "PostgREST: /rest/v1/* -> http://supabase-rest:3000/*" + url: http://supabase-rest:3000/ + routes: + - name: rest-v1-all + strip_path: true + paths: + - /rest/v1/ + plugins: + - name: cors + - name: key-auth + config: + hide_credentials: false + + ## GraphQL routes + - name: graphql-v1 + _comment: "pg_graphql: /graphql/v1 -> http://supabase-rest:3000/rpc/graphql" + url: http://supabase-rest:3000/rpc/graphql + routes: + - name: graphql-v1-all + strip_path: true + paths: + - /graphql/v1 + plugins: + - name: cors + - name: key-auth + config: + hide_credentials: false + + ## Realtime routes + - name: realtime-v1-ws + _comment: "Realtime: /realtime/v1/* -> ws://supabase-realtime:4000/socket/*" + url: http://supabase-realtime:4000/socket/ + routes: + - name: realtime-v1-ws-all + strip_path: true + paths: + - /realtime/v1/ + plugins: + - name: cors + - name: key-auth + config: + hide_credentials: false + + ## Storage routes + - name: storage-v1 + _comment: "Storage: /storage/v1/* -> http://supabase-storage:5000/*" + url: http://supabase-storage:5000/ + routes: + - name: storage-v1-all + strip_path: true + paths: + - /storage/v1/ + plugins: + - name: cors + + ## Functions routes + - name: functions-v1 + _comment: "Functions: /functions/v1/* -> http://supabase-functions:9000/*" + url: http://supabase-functions:9000/ + routes: + - name: functions-v1-all + strip_path: true + paths: + - /functions/v1/ + plugins: + - name: cors + + ## Analytics routes + - name: analytics-v1 + _comment: "Logflare: /analytics/v1/* -> http://supabase-analytics:4000/*" + url: http://supabase-analytics:4000/ + routes: + - name: analytics-v1-all + strip_path: true + paths: + - /analytics/v1/ + plugins: + - name: cors + - name: key-auth + config: + hide_credentials: false + + ## Meta routes + - name: meta + _comment: "PG Meta: /pg/* -> http://supabase-meta:8080/*" + url: http://supabase-meta:8080/ + routes: + - name: meta-all + strip_path: true + paths: + - /pg/ + plugins: + - name: cors + - name: key-auth + config: + hide_credentials: false + + ## Dashboard (Studio) + - name: dashboard + _comment: "Studio: /* -> http://supabase-studio:3000/*" + url: http://supabase-studio:3000/ + routes: + - name: dashboard-all + strip_path: true + paths: + - / + plugins: + - name: cors + - name: basic-auth + config: + hide_credentials: true