From e7f4cf32ce7402e1102adcfb45a772434fdcc6c4 Mon Sep 17 00:00:00 2001 From: psyrenpark Date: Fri, 26 Jan 2024 14:34:46 +0900 Subject: [PATCH 1/3] Fix: Realtime Service Issue and StudioBranch Error in Supabase Library This commit addresses two key issues encountered while using the Supabase library in a self-hosted environment on AWS. 1. Realtime Service Not Functioning: - Identified Issue: Realtime service was non-operational, as discussed in https://github.com/supabase/realtime/issues/372. - Resolution: Upgraded the Realtime Docker image from 'public.ecr.aws/supabase/realtime:v2.25.27' to 'public.ecr.aws/supabase/realtime:v2.25.60', resolving the issue. 2. StudioBranch Error: - Identified Issue: Updating StudioBranch from 'v0.23.09' to 'v0.23.11' resulted in an AWS Amplify CustomerError related to reading 'next' version in package.json (https://stackoverflow.com/questions/76296605/aws-amplify-customererror-cannot-read-next-version-in-package-json). - Temporary Solution: Reverted to version 'v0.23.09' and pushed via CodeCommit, which led to successful redeployment. This commit should enhance the stability and functionality of the Supabase library in similar self-hosted setups. Further investigation into the StudioBranch error is suggested for a more permanent solution. --- src/supabase-stack.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/supabase-stack.ts b/src/supabase-stack.ts index dfe2c9e0..5568c56e 100644 --- a/src/supabase-stack.ts +++ b/src/supabase-stack.ts @@ -106,7 +106,7 @@ export class SupabaseStack extends FargateStack { }); const realtimeImageUri = new cdk.CfnParameter(this, 'RealtimeImageUri', { type: 'String', - default: 'public.ecr.aws/supabase/realtime:v2.25.27', + default: 'public.ecr.aws/supabase/realtime:v2.25.60', description: 'https://gallery.ecr.aws/supabase/realtime', }); const storageImageUri = new cdk.CfnParameter(this, 'StorageImageUri', { From 4aee05974712be3b88bd0a63105a3cbd7ff822da Mon Sep 17 00:00:00 2001 From: psyrenpark Date: Mon, 5 Feb 2024 09:28:27 +0900 Subject: [PATCH 2/3] Update kong-template.yml # For Realtime-API routes - SUPABASE_REALTIME_SOCKET_URL - SUPABASE_REALTIME_API_URL --- containers/kong/kong-template.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/containers/kong/kong-template.yml b/containers/kong/kong-template.yml index cc2e06a8..77766ebf 100644 --- a/containers/kong/kong-template.yml +++ b/containers/kong/kong-template.yml @@ -136,7 +136,7 @@ services: ## Secure Realtime routes - name: realtime-v1 _comment: 'Realtime: /realtime/v1/* -> ws://realtime:4000/socket/*' - url: ${SUPABASE_REALTIME_URL:=http://realtime:4000/socket/} + url: ${SUPABASE_REALTIME_SOCKET_URL:=http://realtime:4000/socket/} routes: - name: realtime-v1-all strip_path: true @@ -154,6 +154,27 @@ services: - admin - anon + # For Realtime-API routes + - name: realtime-v1-api + _comment: 'Realtime: /realtime/v1/api/* -> ws://realtime:4000/api/*' + url: ${SUPABASE_REALTIME_API_URL:=http://realtime:4000/api/} + routes: + - name: realtime-v1-api-routes + 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://storage:5000/*' From bf701627719eccfe53361a3073a5b66ff64c17f5 Mon Sep 17 00:00:00 2001 From: psyrenpark Date: Mon, 5 Feb 2024 09:36:01 +0900 Subject: [PATCH 3/3] Update supabase-stack.ts fix : new kong-template.yml ecr - public.ecr.aws/u3p7q2r8/kong:latest => public.ecr.aws/k1e4k0b3/kong:latest --- src/supabase-stack.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/supabase-stack.ts b/src/supabase-stack.ts index 5568c56e..ce30bdfd 100644 --- a/src/supabase-stack.ts +++ b/src/supabase-stack.ts @@ -96,22 +96,22 @@ export class SupabaseStack extends FargateStack { const authImageUri = new cdk.CfnParameter(this, 'AuthImageUri', { type: 'String', - default: 'public.ecr.aws/supabase/gotrue:v2.110.0', + default: 'public.ecr.aws/supabase/gotrue:v2.139.1', description: 'https://gallery.ecr.aws/supabase/gotrue', }); const restImageUri = new cdk.CfnParameter(this, 'RestImageUri', { type: 'String', - default: 'public.ecr.aws/supabase/postgrest:v11.2.0', + default: 'public.ecr.aws/supabase/postgrest:v12.0.2', description: 'https://gallery.ecr.aws/supabase/postgrest', }); const realtimeImageUri = new cdk.CfnParameter(this, 'RealtimeImageUri', { type: 'String', - default: 'public.ecr.aws/supabase/realtime:v2.25.60', + default: 'public.ecr.aws/supabase/realtime:v2.25.61', description: 'https://gallery.ecr.aws/supabase/realtime', }); const storageImageUri = new cdk.CfnParameter(this, 'StorageImageUri', { type: 'String', - default: 'public.ecr.aws/supabase/storage-api:v0.43.11', + default: 'public.ecr.aws/supabase/storage-api:v0.46.5', description: 'https://gallery.ecr.aws/supabase/storage-api', }); const imgproxyImageUri = new cdk.CfnParameter(this, 'ImgproxyImageUri', { @@ -121,7 +121,7 @@ export class SupabaseStack extends FargateStack { }); const postgresMetaImageUri = new cdk.CfnParameter(this, 'PostgresMetaImageUri', { type: 'String', - default: 'public.ecr.aws/supabase/postgres-meta:v0.74.2', + default: 'public.ecr.aws/supabase/postgres-meta:v0.75.0', description: 'https://gallery.ecr.aws/supabase/postgres-meta', }); @@ -284,7 +284,8 @@ export class SupabaseStack extends FargateStack { const kong = new AutoScalingFargateService(this, 'Kong', { cluster, taskImageOptions: { - image: ecs.ContainerImage.fromRegistry('public.ecr.aws/u3p7q2r8/kong:latest'), + // image: ecs.ContainerImage.fromRegistry('public.ecr.aws/u3p7q2r8/kong:latest'), + image: ecs.ContainerImage.fromRegistry('public.ecr.aws/k1e4k0b3/kong:latest'), // FIX: new kong-template.yml version //image: ecs.ContainerImage.fromAsset('./containers/kong', { platform: Platform.LINUX_ARM64 }), containerPort: 8000, healthCheck: { @@ -592,7 +593,8 @@ export class SupabaseStack extends FargateStack { kong.service.taskDefinition.defaultContainer!.addEnvironment('SUPABASE_AUTH_URL', `${auth.endpoint}/`); kong.service.taskDefinition.defaultContainer!.addEnvironment('SUPABASE_REST_URL', `${rest.endpoint}/`); //kong.service.taskDefinition.defaultContainer!.addEnvironment('SUPABASE_GRAPHQL_URL', `${gql.endpoint}/graphql`); - kong.service.taskDefinition.defaultContainer!.addEnvironment('SUPABASE_REALTIME_URL', `${realtime.endpoint}/socket/`); + kong.service.taskDefinition.defaultContainer!.addEnvironment('SUPABASE_REALTIME_SOCKET_URL', `${realtime.endpoint}/socket/`); + kong.service.taskDefinition.defaultContainer!.addEnvironment('SUPABASE_REALTIME_API_URL', `${realtime.endpoint}/api/`); kong.service.taskDefinition.defaultContainer!.addEnvironment('SUPABASE_STORAGE_URL', `${storage.endpoint}/`); kong.service.taskDefinition.defaultContainer!.addEnvironment('SUPABASE_META_HOST', `${meta.endpoint}/`);