From e9bb17dd8acb5675c0df62e1dcf8dfb87cafbab9 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 15 Feb 2024 12:47:27 +0000 Subject: [PATCH 1/2] Fixing cluster mode in docker-compose setups, we weren't copying across the pm2 config that was needed to achieve this. --- packages/server/Dockerfile | 1 + packages/worker/Dockerfile | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile index f63481c373..3aae395bc5 100644 --- a/packages/server/Dockerfile +++ b/packages/server/Dockerfile @@ -66,6 +66,7 @@ COPY packages/server/dist/ dist/ COPY packages/server/docker_run.sh . COPY packages/server/builder/ builder/ COPY packages/server/client/ client/ +COPY packages/server/pm2.config.js . ARG BUDIBASE_VERSION ARG GIT_COMMIT_SHA diff --git a/packages/worker/Dockerfile b/packages/worker/Dockerfile index 52fd3677b1..77869c48f1 100644 --- a/packages/worker/Dockerfile +++ b/packages/worker/Dockerfile @@ -37,6 +37,7 @@ RUN apk del .gyp \ COPY packages/worker/dist/ dist/ COPY packages/worker/docker_run.sh . +COPY packages/server/pm2.config.js . EXPOSE 4001 From 1f4a254ec5449e2e04797ce3fa904cf14048ccde Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 15 Feb 2024 15:47:56 +0000 Subject: [PATCH 2/2] Fix for integration test, make sure to carry auth headers over correctly. --- packages/server/src/utilities/workerRequests.ts | 9 +++++++++ packages/shared-core/src/constants/api.ts | 1 + 2 files changed, 10 insertions(+) diff --git a/packages/server/src/utilities/workerRequests.ts b/packages/server/src/utilities/workerRequests.ts index 5612084216..b5c3bfcd4a 100644 --- a/packages/server/src/utilities/workerRequests.ts +++ b/packages/server/src/utilities/workerRequests.ts @@ -7,6 +7,7 @@ import { tenancy, logging, env as coreEnv, + utils, } from "@budibase/backend-core" import { Ctx, User, EmailInvite } from "@budibase/types" @@ -25,6 +26,14 @@ export function request(ctx?: Ctx, request?: any) { request.headers[header] = ctx.headers[header] } } + // be specific about auth headers + const cookie = ctx.headers[constants.Header.COOKIE], + apiKey = ctx.headers[constants.Header.API_KEY] + if (cookie) { + request.headers[constants.Header.COOKIE] = cookie + } else if (apiKey) { + request.headers[constants.Header.API_KEY] = apiKey + } } // apply tenancy if its available diff --git a/packages/shared-core/src/constants/api.ts b/packages/shared-core/src/constants/api.ts index d6633649e6..f63849bf3d 100644 --- a/packages/shared-core/src/constants/api.ts +++ b/packages/shared-core/src/constants/api.ts @@ -16,4 +16,5 @@ export enum Header { CORRELATION_ID = "x-budibase-correlation-id", AUTHORIZATION = "authorization", MIGRATING_APP = "x-budibase-migrating-app", + COOKIE = "cookie", }