diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 0c74c8e7..b3f9550d 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -92,6 +92,5 @@ services: # Prometheus Metrics - GOTRUE_METRICS_ENABLED=true - GOTRUE_METRICS_EXPORTER=prometheus - - GOTRUE_EXTERNAL_SAML_ENABLED=true ports: - 9998:9999 diff --git a/docker-compose.yml b/docker-compose.yml index 570ccaae..ca25c11c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -136,7 +136,6 @@ services: # Prometheus Metrics - GOTRUE_METRICS_ENABLED=true - GOTRUE_METRICS_EXPORTER=prometheus - - GOTRUE_EXTERNAL_SAML_ENABLED=true ports: - 9998:9999 diff --git a/docker/gotrue.Dockerfile b/docker/gotrue.Dockerfile index 95750ded..01450a39 100644 --- a/docker/gotrue.Dockerfile +++ b/docker/gotrue.Dockerfile @@ -1,12 +1,10 @@ FROM golang as base WORKDIR /go/src/supabase -RUN git clone https://github.com/supabase/gotrue.git +RUN git clone https://github.com/supabase/gotrue.git --depth 1 --branch v2.117.0 WORKDIR /go/src/supabase/gotrue -RUN git checkout e67a10c1 && \ - CGO_ENABLED=0 \ - GOOS=linux \ - GOARCH=amd64 \ - go build -o /gotrue . +COPY docker/gotrue.patch . +RUN git apply gotrue.patch +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /gotrue . FROM scratch COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo @@ -15,5 +13,6 @@ COPY --from=base /etc/passwd /etc/passwd COPY --from=base /etc/group /etc/group COPY --from=base /gotrue . +COPY --from=base /go/src/supabase/gotrue/migrations ./migrations CMD ["./gotrue"] diff --git a/docker/gotrue.patch b/docker/gotrue.patch new file mode 100644 index 00000000..335859ed --- /dev/null +++ b/docker/gotrue.patch @@ -0,0 +1,15 @@ +# This patch is done because there is no way to enable SSO/SAML at the moment + +diff --git a/internal/api/api.go b/internal/api/api.go +index d9016fd0..924ce018 100644 +--- a/internal/api/api.go ++++ b/internal/api/api.go +@@ -175,7 +175,7 @@ func NewAPIWithVersion(ctx context.Context, globalConfig *conf.GlobalConfigurati + }) + + r.Route("/sso", func(r *router) { +- r.Use(api.requireSAMLEnabled) ++ // r.Use(api.requireSAMLEnabled) + r.With(api.limitHandler( + // Allow requests at the specified rate per 5 minutes. + tollbooth.NewLimiter(api.config.RateLimitSso/(60*5), &limiter.ExpirableOptions{ diff --git a/migrations/before/20230312043000_supabase_auth.sql b/migrations/before/20230312043000_supabase_auth.sql index 15c2b383..3dbc0ce9 100644 --- a/migrations/before/20230312043000_supabase_auth.sql +++ b/migrations/before/20230312043000_supabase_auth.sql @@ -1,3 +1,5 @@ +-- This will be run before appflowy-cloud or gotrue does its migration + -- Add migration script here -- Create the anon and authenticated roles if they don't exist CREATE OR REPLACE FUNCTION create_roles(roles text []) RETURNS void LANGUAGE plpgsql AS $$