diff --git a/.github/actions/deploy/deploy.mjs b/.github/actions/deploy/deploy.mjs index 20c9ee726f..01cc29b9d2 100644 --- a/.github/actions/deploy/deploy.mjs +++ b/.github/actions/deploy/deploy.mjs @@ -12,8 +12,8 @@ const { DATABASE_NAME, CLOUD_SQL_IAM_ACCOUNT, APP_IAM_ACCOUNT, - REDIS_HOST, - REDIS_PASSWORD, + REDIS_SERVER_HOST, + REDIS_SERVER_PASSWORD, STATIC_IP_NAME, } = process.env; @@ -75,8 +75,8 @@ const createHelmCommand = ({ isDryRun }) => { `--set-string global.database.user=${DATABASE_USERNAME}`, `--set-string global.database.password=${DATABASE_PASSWORD}`, `--set-string global.database.name=${DATABASE_NAME}`, - `--set-string global.redis.host="${REDIS_HOST}"`, - `--set-string global.redis.password="${REDIS_PASSWORD}"`, + `--set-string global.redis.host="${REDIS_SERVER_HOST}"`, + `--set-string global.redis.password="${REDIS_SERVER_PASSWORD}"`, ] : []; const serviceAnnotations = [ diff --git a/.github/helm/affine/charts/doc/templates/deployment.yaml b/.github/helm/affine/charts/doc/templates/deployment.yaml index 3dd107ed53..76f1837e42 100644 --- a/.github/helm/affine/charts/doc/templates/deployment.yaml +++ b/.github/helm/affine/charts/doc/templates/deployment.yaml @@ -53,7 +53,7 @@ spec: name: pg-postgresql key: postgres-password - name: DATABASE_URL - value: postgres://{{ .Values.global.database.user }}:$(DATABASE_PASSWORD)@{{ .Values.global.database.url }}:{{ .Values.global.database.port }}/{{ .Values.global.database.name }} + value: postgres://{{ .Values.global.database.user }}:$(DATABASE_PASSWORD)@{{ .Values.global.database.host }}:{{ .Values.global.database.port }}/{{ .Values.global.database.name }} - name: REDIS_SERVER_ENABLED value: "true" - name: REDIS_SERVER_HOST diff --git a/.github/helm/affine/charts/gcloud-sql-proxy/templates/NOTES.txt b/.github/helm/affine/charts/gcloud-sql-proxy/templates/NOTES.txt index b7cb03936a..775c2927c4 100644 --- a/.github/helm/affine/charts/gcloud-sql-proxy/templates/NOTES.txt +++ b/.github/helm/affine/charts/gcloud-sql-proxy/templates/NOTES.txt @@ -1,4 +1,4 @@ -{{- if .Values.global.database.gcloud.enabled -}} +{{- if .Values.enabled -}} 1. Get the application URL by running these commands: {{- if contains "NodePort" .Values.service.type }} export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "gcloud-sql-proxy.fullname" . }}) diff --git a/.github/helm/affine/charts/gcloud-sql-proxy/templates/service.yaml b/.github/helm/affine/charts/gcloud-sql-proxy/templates/service.yaml index b7a0c96cf7..6c4e174a87 100644 --- a/.github/helm/affine/charts/gcloud-sql-proxy/templates/service.yaml +++ b/.github/helm/affine/charts/gcloud-sql-proxy/templates/service.yaml @@ -1,4 +1,4 @@ -{{- if .Values.global.database.gcloud.enabled -}} +{{- if .Values.enabled -}} apiVersion: v1 kind: Service metadata: diff --git a/.github/helm/affine/charts/gcloud-sql-proxy/templates/serviceaccount.yaml b/.github/helm/affine/charts/gcloud-sql-proxy/templates/serviceaccount.yaml index 5e9bfa2ada..a5bddfaa61 100644 --- a/.github/helm/affine/charts/gcloud-sql-proxy/templates/serviceaccount.yaml +++ b/.github/helm/affine/charts/gcloud-sql-proxy/templates/serviceaccount.yaml @@ -1,4 +1,4 @@ -{{- if .Values.global.database.gcloud.enabled -}} +{{- if .Values.enabled -}} {{- if .Values.serviceAccount.create -}} apiVersion: v1 kind: ServiceAccount diff --git a/.github/helm/affine/charts/gcloud-sql-proxy/templates/tests/test-connection.yaml b/.github/helm/affine/charts/gcloud-sql-proxy/templates/tests/test-connection.yaml index c6138cc299..49b671667f 100644 --- a/.github/helm/affine/charts/gcloud-sql-proxy/templates/tests/test-connection.yaml +++ b/.github/helm/affine/charts/gcloud-sql-proxy/templates/tests/test-connection.yaml @@ -1,4 +1,4 @@ -{{- if .Values.global.database.gcloud.enabled -}} +{{- if .Values.enabled -}} apiVersion: v1 kind: Pod metadata: diff --git a/.github/helm/affine/charts/graphql/templates/deployment.yaml b/.github/helm/affine/charts/graphql/templates/deployment.yaml index d2139e368b..edd2ed0509 100644 --- a/.github/helm/affine/charts/graphql/templates/deployment.yaml +++ b/.github/helm/affine/charts/graphql/templates/deployment.yaml @@ -53,7 +53,7 @@ spec: name: pg-postgresql key: postgres-password - name: DATABASE_URL - value: postgres://{{ .Values.global.database.user }}:$(DATABASE_PASSWORD)@{{ .Values.global.database.url }}:{{ .Values.global.database.port }}/{{ .Values.global.database.name }} + value: postgres://{{ .Values.global.database.user }}:$(DATABASE_PASSWORD)@{{ .Values.global.database.host }}:{{ .Values.global.database.port }}/{{ .Values.global.database.name }} - name: REDIS_SERVER_HOST value: "{{ .Values.global.redis.host }}" - name: REDIS_SERVER_PORT diff --git a/.github/helm/affine/charts/graphql/templates/migration.yaml b/.github/helm/affine/charts/graphql/templates/migration.yaml index 3d49d564fd..31781793a6 100644 --- a/.github/helm/affine/charts/graphql/templates/migration.yaml +++ b/.github/helm/affine/charts/graphql/templates/migration.yaml @@ -32,7 +32,7 @@ spec: name: pg-postgresql key: postgres-password - name: DATABASE_URL - value: postgres://{{ .Values.global.database.user }}:$(DATABASE_PASSWORD)@{{ .Values.global.database.url }}:{{ .Values.global.database.port }}/{{ .Values.global.database.name }} + value: postgres://{{ .Values.global.database.user }}:$(DATABASE_PASSWORD)@{{ .Values.global.database.host }}:{{ .Values.global.database.port }}/{{ .Values.global.database.name }} - name: REDIS_SERVER_HOST value: "{{ .Values.global.redis.host }}" - name: REDIS_SERVER_PORT diff --git a/.github/helm/affine/charts/renderer/templates/deployment.yaml b/.github/helm/affine/charts/renderer/templates/deployment.yaml index 0aa0a0315e..fcff427b88 100644 --- a/.github/helm/affine/charts/renderer/templates/deployment.yaml +++ b/.github/helm/affine/charts/renderer/templates/deployment.yaml @@ -53,7 +53,7 @@ spec: name: pg-postgresql key: postgres-password - name: DATABASE_URL - value: postgres://{{ .Values.global.database.user }}:$(DATABASE_PASSWORD)@{{ .Values.global.database.url }}:{{ .Values.global.database.port }}/{{ .Values.global.database.name }} + value: postgres://{{ .Values.global.database.user }}:$(DATABASE_PASSWORD)@{{ .Values.global.database.host }}:{{ .Values.global.database.port }}/{{ .Values.global.database.name }} - name: REDIS_SERVER_ENABLED value: "true" - name: REDIS_SERVER_HOST diff --git a/.github/helm/affine/charts/sync/templates/deployment.yaml b/.github/helm/affine/charts/sync/templates/deployment.yaml index 963fae19ac..f6496f01dc 100644 --- a/.github/helm/affine/charts/sync/templates/deployment.yaml +++ b/.github/helm/affine/charts/sync/templates/deployment.yaml @@ -55,7 +55,7 @@ spec: name: pg-postgresql key: postgres-password - name: DATABASE_URL - value: postgres://{{ .Values.global.database.user }}:$(DATABASE_PASSWORD)@{{ .Values.global.database.url }}:{{ .Values.global.database.port }}/{{ .Values.global.database.name }} + value: postgres://{{ .Values.global.database.user }}:$(DATABASE_PASSWORD)@{{ .Values.global.database.host }}:{{ .Values.global.database.port }}/{{ .Values.global.database.name }} - name: REDIS_SERVER_HOST value: "{{ .Values.global.redis.host }}" - name: REDIS_SERVER_PORT diff --git a/.github/helm/affine/values.yaml b/.github/helm/affine/values.yaml index cf826108e7..1ccfbb47fb 100644 --- a/.github/helm/affine/values.yaml +++ b/.github/helm/affine/values.yaml @@ -16,7 +16,6 @@ global: name: 'affine' password: '' redis: - enabled: true host: 'redis-master' port: '6379' username: '' diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index ed45e6fe6c..644bbe5c0c 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -25,7 +25,7 @@ jobs: uses: ./.github/actions/setup-node with: electron-install: false - extra-flags: workspaces focus @affine/server + extra-flags: workspaces focus @affine/server @types/affine__env - name: Build Server run: | find packages/backend/server/src -type d -name "__tests__" -exec rm -rf {} + diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 259978896b..2bc0fcd8af 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -114,8 +114,8 @@ jobs: DATABASE_NAME: ${{ secrets.DATABASE_NAME }} GCLOUD_CONNECTION_NAME: ${{ secrets.GCLOUD_CONNECTION_NAME }} GCLOUD_CLOUD_SQL_INTERNAL_ENDPOINT: ${{ secrets.GCLOUD_CLOUD_SQL_INTERNAL_ENDPOINT }} - REDIS_HOST: ${{ secrets.REDIS_HOST }} - REDIS_PASSWORD: ${{ secrets.REDIS_PASSWORD }} + REDIS_SERVER_HOST: ${{ secrets.REDIS_SERVER_HOST }} + REDIS_SERVER_PASSWORD: ${{ secrets.REDIS_SERVER_PASSWORD }} CLOUD_SQL_IAM_ACCOUNT: ${{ secrets.CLOUD_SQL_IAM_ACCOUNT }} APP_IAM_ACCOUNT: ${{ secrets.APP_IAM_ACCOUNT }} STRIPE_API_KEY: ${{ secrets.STRIPE_API_KEY }} diff --git a/packages/backend/server/src/base/redis/config.ts b/packages/backend/server/src/base/redis/config.ts index f921604e6e..9fc25a1f33 100644 --- a/packages/backend/server/src/base/redis/config.ts +++ b/packages/backend/server/src/base/redis/config.ts @@ -22,29 +22,29 @@ defineModuleConfig('redis', { db: { desc: 'The database index of redis server to be used(Must be less than 10).', default: 0, - env: ['REDIS_DATABASE', 'integer'], + env: ['REDIS_SERVER_DATABASE', 'integer'], validate: val => val >= 0 && val < 10, }, host: { desc: 'The host of the redis server.', default: 'localhost', - env: ['REDIS_HOST', 'string'], + env: ['REDIS_SERVER_HOST', 'string'], }, port: { desc: 'The port of the redis server.', default: 6379, - env: ['REDIS_PORT', 'integer'], + env: ['REDIS_SERVER_PORT', 'integer'], shape: z.number().positive(), }, username: { desc: 'The username of the redis server.', default: '', - env: ['REDIS_USERNAME', 'string'], + env: ['REDIS_SERVER_USERNAME', 'string'], }, password: { desc: 'The password of the redis server.', default: '', - env: ['REDIS_PASSWORD', 'string'], + env: ['REDIS_SERVER_PASSWORD', 'string'], }, ioredis: { desc: 'The config for the ioredis client.', diff --git a/packages/backend/server/src/core/doc-service/config.ts b/packages/backend/server/src/core/doc-service/config.ts index 9eb4e3136b..cbf3f733d0 100644 --- a/packages/backend/server/src/core/doc-service/config.ts +++ b/packages/backend/server/src/core/doc-service/config.ts @@ -12,5 +12,6 @@ defineModuleConfig('docService', { endpoint: { desc: 'The endpoint of the doc service.', default: '', + env: 'DOC_SERVICE_ENDPOINT', }, });