From e76cdf4d7178239f325aa45e794c28c515bc8dbb Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 1 Sep 2023 18:37:48 +0800 Subject: [PATCH] fix(server): set right AFFINE_SERVER_HOST env variable (#4108) --- .github/actions/deploy/deploy.mjs | 6 ++++-- apps/server/src/index.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/actions/deploy/deploy.mjs b/.github/actions/deploy/deploy.mjs index c5c7a43ce..093beae18 100644 --- a/.github/actions/deploy/deploy.mjs +++ b/.github/actions/deploy/deploy.mjs @@ -67,18 +67,20 @@ const createHelmCommand = ({ isDryRun }) => { const graphqlReplicaCount = isProduction ? 3 : isBeta ? 2 : 2; const syncReplicaCount = isProduction ? 6 : isBeta ? 3 : 2; const namespace = isProduction ? 'production' : isBeta ? 'beta' : 'dev'; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const host = DEPLOY_HOST || CANARY_DEPLOY_HOST; const deployCommand = [ `helm upgrade --install affine .github/helm/affine`, `--namespace ${namespace}`, `--set global.ingress.enabled=true`, `--set-json global.ingress.annotations=\"{ \\"kubernetes.io/ingress.class\\": \\"gce\\", \\"kubernetes.io/ingress.allow-http\\": \\"true\\", \\"kubernetes.io/ingress.global-static-ip-name\\": \\"${staticIpName}\\" }\"`, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - `--set-string global.ingress.host="${DEPLOY_HOST || CANARY_DEPLOY_HOST}"`, + `--set-string global.ingress.host="${host}"`, ...redisAndPostgres, `--set web.replicaCount=${webReplicaCount}`, `--set-string web.image.tag="${imageTag}"`, `--set graphql.replicaCount=${graphqlReplicaCount}`, `--set-string graphql.image.tag="${imageTag}"`, + `--set graphql.app.host=${host}`, `--set graphql.app.objectStorage.r2.enabled=true`, `--set-string graphql.app.objectStorage.r2.accountId="${R2_ACCOUNT_ID}"`, `--set-string graphql.app.objectStorage.r2.accessKeyId="${R2_ACCESS_KEY_ID}"`, diff --git a/apps/server/src/index.ts b/apps/server/src/index.ts index eb74a4b51..c8fc02bd2 100644 --- a/apps/server/src/index.ts +++ b/apps/server/src/index.ts @@ -79,7 +79,7 @@ app.use(cookieParser()); const config = app.get(Config); -const host = config.host ?? 'localhost'; +const host = config.node.prod ? '0.0.0.0' : 'localhost'; const port = config.port ?? 3010; if (!config.objectStorage.r2.enabled) {