Не подтверждена Коммит 2f6c4e36 создал по автору Alex Yang's avatar Alex Yang Зафиксировано автором GitHub
Просмотр файлов

feat!: affine cloud support (#3813)



Co-authored-by: default avatarHongtao Lye <codert.sn@gmail.com>
Co-authored-by: default avatarliuyi <forehalo@gmail.com>
Co-authored-by: default avatarLongYinan <lynweklm@gmail.com>
Co-authored-by: default avatarX1a0t <405028157@qq.com>
Co-authored-by: default avatarJimmFly <yangjinfei001@gmail.com>
Co-authored-by: default avatarPeng Xiao <pengxiao@outlook.com>
Co-authored-by: default avatarxiaodong zuo <53252747+zuoxiaodong0815@users.noreply.github.com>
Co-authored-by: default avatarDarkSky <25152247+darkskygit@users.noreply.github.com>
Co-authored-by: default avatarQi <474021214@qq.com>
Co-authored-by: default avatardanielchim <kahungchim@gmail.com>
владелец d0145c6f
...@@ -9,3 +9,5 @@ ENABLE_NEW_SETTING_UNSTABLE_API= ...@@ -9,3 +9,5 @@ ENABLE_NEW_SETTING_UNSTABLE_API=
ENABLE_NOTIFICATION_CENTER= ENABLE_NOTIFICATION_CENTER=
ENABLE_CLOUD= ENABLE_CLOUD=
ENABLE_MOVE_DATABASE= ENABLE_MOVE_DATABASE=
SHOULD_REPORT_TRACE=
TRACE_REPORT_ENDPOINT=
...@@ -31,6 +31,12 @@ const createPattern = packageName => [ ...@@ -31,6 +31,12 @@ const createPattern = packageName => [
message: 'Use `useNavigateHelper` instead', message: 'Use `useNavigateHelper` instead',
importNames: ['useNavigate'], importNames: ['useNavigate'],
}, },
{
group: ['next-auth/react'],
message: "Import hooks from 'use-current-user.tsx'",
// useSession is type unsafe
importNames: ['useSession'],
},
{ {
group: ['yjs'], group: ['yjs'],
message: 'Do not use this API because it has a bug', message: 'Do not use this API because it has a bug',
...@@ -160,6 +166,12 @@ const config = { ...@@ -160,6 +166,12 @@ const config = {
message: 'Use `useNavigateHelper` instead', message: 'Use `useNavigateHelper` instead',
importNames: ['useNavigate'], importNames: ['useNavigate'],
}, },
{
group: ['next-auth/react'],
message: "Import hooks from 'use-current-user.tsx'",
// useSession is type unsafe
importNames: ['useSession'],
},
{ {
group: ['yjs'], group: ['yjs'],
message: 'Do not use this API because it has a bug', message: 'Do not use this API because it has a bug',
......
...@@ -4,6 +4,9 @@ inputs: ...@@ -4,6 +4,9 @@ inputs:
target: target:
description: 'Cargo target' description: 'Cargo target'
required: true required: true
package:
description: 'Package to build'
required: true
nx_token: nx_token:
description: 'Nx Cloud access token' description: 'Nx Cloud access token'
required: false required: false
...@@ -31,7 +34,7 @@ runs: ...@@ -31,7 +34,7 @@ runs:
if: ${{ inputs.target != 'x86_64-unknown-linux-gnu' && inputs.target != 'aarch64-unknown-linux-gnu' }} if: ${{ inputs.target != 'x86_64-unknown-linux-gnu' && inputs.target != 'aarch64-unknown-linux-gnu' }}
shell: bash shell: bash
run: | run: |
yarn nx build @affine/native --target ${{ inputs.target }} yarn nx build ${{ inputs.package }} --target ${{ inputs.target }}
env: env:
NX_CLOUD_ACCESS_TOKEN: ${{ inputs.nx_token }} NX_CLOUD_ACCESS_TOKEN: ${{ inputs.nx_token }}
...@@ -44,7 +47,8 @@ runs: ...@@ -44,7 +47,8 @@ runs:
run: | run: |
export CC=x86_64-unknown-linux-gnu-gcc export CC=x86_64-unknown-linux-gnu-gcc
export CC_x86_64_unknown_linux_gnu=x86_64-unknown-linux-gnu-gcc export CC_x86_64_unknown_linux_gnu=x86_64-unknown-linux-gnu-gcc
yarn nx build @affine/native --target ${{ inputs.target }} export RUSTFLAGS="-C debuginfo=1"
yarn nx build ${{ inputs.package }} --target ${{ inputs.target }}
chmod -R 777 node_modules/.cache chmod -R 777 node_modules/.cache
chmod -R 777 target chmod -R 777 target
...@@ -55,6 +59,7 @@ runs: ...@@ -55,6 +59,7 @@ runs:
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64 image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
options: --user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build -e NX_CLOUD_ACCESS_TOKEN=${{ inputs.nx_token }} options: --user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build -e NX_CLOUD_ACCESS_TOKEN=${{ inputs.nx_token }}
run: | run: |
yarn nx build @affine/native --target ${{ inputs.target }} export RUSTFLAGS="-C debuginfo=1"
yarn nx build ${{ inputs.package }} --target ${{ inputs.target }}
chmod -R 777 node_modules/.cache chmod -R 777 node_modules/.cache
chmod -R 777 target chmod -R 777 target
name: 'Deploy to Cluster'
description: 'Deploy AFFiNE Cloud to cluster'
inputs:
build-type:
description: 'Align with App build type, canary|beta|stable|internal'
default: 'canary'
gcp-project-number:
description: 'GCP project number'
required: true
gcp-project-id:
description: 'GCP project id'
required: true
service-account:
description: 'Service account'
cluster-name:
description: 'Cluster name'
cluster-location:
description: 'Cluster location'
runs:
using: 'composite'
steps:
- name: Setup Git short hash
shell: bash
run: |
echo "GIT_SHORT_HASH=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
- uses: azure/setup-helm@v3
- id: auth
uses: google-github-actions/auth@v1
with:
workload_identity_provider: 'projects/${{ inputs.gcp-project-number }}/locations/global/workloadIdentityPools/github-actions/providers/github-actions-helm-deploy'
service_account: '${{ inputs.service-account }}'
token_format: 'access_token'
project_id: '${{ inputs.gcp-project-id }}'
- name: 'Setup gcloud cli'
uses: 'google-github-actions/setup-gcloud@v1'
with:
install_components: 'gke-gcloud-auth-plugin'
- id: get-gke-credentials
shell: bash
run: |
gcloud container clusters get-credentials ${{ inputs.cluster-name }} --region ${{ inputs.cluster-location }} --project ${{ inputs.gcp-project-id }}
- name: Deploy
shell: bash
run: node ./.github/actions/deploy/deploy.mjs
env:
BUILD_TYPE: '${{ inputs.build-type }}'
import { execSync } from 'node:child_process';
const {
BUILD_TYPE,
DEPLOY_HOST,
CANARY_DEPLOY_HOST,
GIT_SHORT_HASH,
DATABASE_URL,
DATABASE_USERNAME,
DATABASE_PASSWORD,
DATABASE_NAME,
R2_ACCOUNT_ID,
R2_ACCESS_KEY_ID,
R2_SECRET_ACCESS_KEY,
R2_BUCKET,
OAUTH_EMAIL_SENDER,
OAUTH_EMAIL_LOGIN,
OAUTH_EMAIL_PASSWORD,
AFFINE_GOOGLE_CLIENT_ID,
AFFINE_GOOGLE_CLIENT_SECRET,
CLOUD_SQL_IAM_ACCOUNT,
GCLOUD_CONNECTION_NAME,
GCLOUD_CLOUD_SQL_INTERNAL_ENDPOINT,
REDIS_HOST,
REDIS_PASSWORD,
} = process.env;
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const buildType = BUILD_TYPE || 'canary';
const isProduction = buildType === 'stable';
const isBeta = buildType === 'beta';
const createHelmCommand = ({ isDryRun }) => {
const flag = isDryRun ? '--dry-run' : '--atomic';
const imageTag = `${buildType}-${GIT_SHORT_HASH}`;
const staticIpName = isProduction
? 'affine-cluster-production'
: isBeta
? 'affine-cluster-beta'
: 'affine-cluster-dev';
const redisAndPostgres =
isProduction || isBeta
? [
`--set-string global.database.url=${DATABASE_URL}`,
`--set-string global.database.user=${DATABASE_USERNAME}`,
`--set-string global.database.password=${DATABASE_PASSWORD}`,
`--set-string global.database.name=${DATABASE_NAME}`,
`--set global.database.gcloud.enabled=true`,
`--set-string global.database.gcloud.connectionName="${GCLOUD_CONNECTION_NAME}"`,
`--set-string global.database.gcloud.cloudSqlInternal="${GCLOUD_CLOUD_SQL_INTERNAL_ENDPOINT}"`,
`--set-string global.redis.host="${REDIS_HOST}"`,
`--set-string global.redis.password="${REDIS_PASSWORD}"`,
]
: [];
const serviceAnnotations =
isProduction || isBeta
? [
`--set-json web.service.annotations=\"{ \\"cloud.google.com/neg\\": \\"{\\\\\\"ingress\\\\\\": true}\\" }\"`,
`--set-json graphql.serviceAccount.annotations=\"{ \\"iam.gke.io/gcp-service-account\\": \\"${CLOUD_SQL_IAM_ACCOUNT}\\" }\"`,
`--set-json graphql.service.annotations=\"{ \\"cloud.google.com/neg\\": \\"{\\\\\\"ingress\\\\\\": true}\\" }\"`,
`--set-json sync.serviceAccount.annotations=\"{ \\"iam.gke.io/gcp-service-account\\": \\"${CLOUD_SQL_IAM_ACCOUNT}\\" }\"`,
`--set-json sync.service.annotations=\"{ \\"cloud.google.com/neg\\": \\"{\\\\\\"ingress\\\\\\": true}\\" }\"`,
]
: [];
const webReplicaCount = isProduction ? 3 : isBeta ? 2 : 1;
const graphqlReplicaCount = isProduction ? 3 : isBeta ? 2 : 1;
const syncReplicaCount = isProduction ? 6 : isBeta ? 3 : 1;
const namespace = isProduction ? 'production' : isBeta ? 'beta' : 'dev';
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}"`,
...redisAndPostgres,
`--set web.replicaCount=${webReplicaCount}`,
`--set-string web.image.tag="${imageTag}"`,
`--set graphql.replicaCount=${graphqlReplicaCount}`,
`--set-string graphql.image.tag="${imageTag}"`,
`--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}"`,
`--set-string graphql.app.objectStorage.r2.secretAccessKey="${R2_SECRET_ACCESS_KEY}"`,
`--set-string graphql.app.objectStorage.r2.bucket="${R2_BUCKET}"`,
`--set-string graphql.app.oauth.email.sender="${OAUTH_EMAIL_SENDER}"`,
`--set-string graphql.app.oauth.email.login="${OAUTH_EMAIL_LOGIN}"`,
`--set-string graphql.app.oauth.email.password="${OAUTH_EMAIL_PASSWORD}"`,
`--set-string graphql.app.oauth.google.enabled=true`,
`--set-string graphql.app.oauth.google.clientId="${AFFINE_GOOGLE_CLIENT_ID}"`,
`--set-string graphql.app.oauth.google.clientSecret="${AFFINE_GOOGLE_CLIENT_SECRET}"`,
`--set graphql.app.experimental.enableJwstCodec=true`,
`--set sync.replicaCount=${syncReplicaCount}`,
`--set-string sync.image.tag="${imageTag}"`,
...serviceAnnotations,
`--version "0.0.0-${buildType}.${GIT_SHORT_HASH}" --timeout 10m`,
flag,
].join(' ');
return deployCommand;
};
const output = execSync(createHelmCommand({ isDryRun: true }), {
encoding: 'utf-8',
stdio: ['inherit', 'pipe', 'inherit'],
});
const templates = output
.split('---')
.filter(yml => !yml.split('\n').some(line => line.trim() === 'kind: Secret'))
.join('---');
console.log(templates);
execSync(createHelmCommand({ isDryRun: false }), {
encoding: 'utf-8',
stdio: 'inherit',
});
name: 'AFFiNE Rust setup'
description: 'Rust setup, including cache configuration'
inputs:
target:
description: 'Cargo target'
required: true
toolchain:
description: 'Rustup toolchain'
required: false
default: 'stable'
runs:
using: 'composite'
steps:
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ inputs.toolchain }}
targets: ${{ inputs.target }}
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-cache-${{ runner.os }}-${{ inputs.toolchain }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-cache-${{ runner.os }}-${{ inputs.toolchain }}-
...@@ -3,7 +3,7 @@ server { ...@@ -3,7 +3,7 @@ server {
root /app/dist; root /app/dist;
location / { location / {
try_files $uri $uri/index.html $uri.html =404; try_files $uri $uri/ /index.html;
} }
error_page 404 /404.html; error_page 404 /404.html;
......
...@@ -40,6 +40,7 @@ helm.sh/chart: {{ include "graphql.chart" . }} ...@@ -40,6 +40,7 @@ helm.sh/chart: {{ include "graphql.chart" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }} {{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
monitoring: enabled
{{- end }} {{- end }}
{{/* {{/*
...@@ -75,58 +76,3 @@ key: {{ $secret.data.private }} ...@@ -75,58 +76,3 @@ key: {{ $secret.data.private }}
key: {{ genPrivateKey "ecdsa" | b64enc }} key: {{ genPrivateKey "ecdsa" | b64enc }}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "objectStorage.r2" -}}
{{- $secret := lookup "v1" "Secret" .Release.Namespace .Values.app.objectStorage.r2.secretName -}}
{{- if $secret -}}
{{/*
Reusing existing secret data
*/}}
accountId: {{ $secret.data.accountId }}
accessKeyId: {{ $secret.data.accessKeyId }}
secretAccessKey: {{ $secret.data.secretAccessKey }}
bucket: {{ $secret.data.bucket }}
{{- else -}}
{{/*
Generate new data
*/}}
accountId: {{ .Values.app.objectStorage.r2.accountId | b64enc }}
accessKeyId: {{ .Values.app.objectStorage.r2.accessKeyId | b64enc }}
secretAccessKey: {{ .Values.app.objectStorage.r2.secretAccessKey | b64enc }}
bucket: {{ .Values.app.objectStorage.r2.bucket | b64enc }}
{{- end -}}
{{- end -}}
{{- define "objectStorage.oauth.google" -}}
{{- $secret := lookup "v1" "Secret" .Release.Namespace .Values.app.oauth.google.secretName -}}
{{- if $secret -}}
{{/*
Reusing existing secret data
*/}}
clientId: {{ $secret.data.clientId }}
clientSecret: {{ $secret.data.clientSecret }}
{{- else -}}
{{/*
Generate new data
*/}}
clientId: "{{ .Values.app.oauth.google.clientId | b64enc }}"
clientSecret: "{{ .Values.app.oauth.google.clientSecret | b64enc }}"
{{- end -}}
{{- end -}}
{{- define "objectStorage.oauth.github" -}}
{{- $secret := lookup "v1" "Secret" .Release.Namespace .Values.app.oauth.github.secretName -}}
{{- if $secret -}}
{{/*
Reusing existing secret data
*/}}
clientId: {{ $secret.data.clientId }}
clientSecret: {{ $secret.data.clientSecret }}
{{- else -}}
{{/*
Generate new data
*/}}
clientId: "{{ .Values.app.oauth.github.clientId | b64enc }}"
clientSecret: "{{ .Values.app.oauth.github.clientSecret | b64enc }}"
{{- end -}}
{{- end -}}
...@@ -35,13 +35,36 @@ spec: ...@@ -35,13 +35,36 @@ spec:
key: key key: key
- name: NODE_ENV - name: NODE_ENV
value: "{{ .Values.env }}" value: "{{ .Values.env }}"
- name: DATABSE_PASSWORD - name: NO_COLOR
value: "1"
- name: SERVER_FLAVOR
value: "graphql"
- name: AFFINE_ENV
value: "{{ .Release.Namespace }}"
- name: NEXTAUTH_URL
value: "{{ .Values.global.ingress.host }}"
- name: DATABASE_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: pg-postgresql name: pg-postgresql
key: postgres-password key: postgres-password
- name: DATABASE_URL - name: DATABASE_URL
value: postgres://{{ .Values.database.user }}:$(DATABSE_PASSWORD)@{{ .Values.database.url }}:{{ .Values.database.port }}/{{ .Values.database.name }} value: postgres://{{ .Values.global.database.user }}:$(DATABASE_PASSWORD)@{{ .Values.global.database.url }}:{{ .Values.global.database.port }}/{{ .Values.global.database.name }}
- name: REDIS_SERVER_ENABLED
value: "true"
- name: REDIS_SERVER_HOST
value: "{{ .Values.global.redis.host }}"
- name: REDIS_SERVER_PORT
value: "{{ .Values.global.redis.port }}"
- name: REDIS_SERVER_USER
value: "{{ .Values.global.redis.username }}"
- name: REDIS_SERVER_PASSWORD
valueFrom:
secretKeyRef:
name: redis
key: redis-password
- name: REDIS_SERVER_DATABASE
value: "{{ .Values.global.redis.database }}"
- name: AFFINE_SERVER_PORT - name: AFFINE_SERVER_PORT
value: "{{ .Values.service.port }}" value: "{{ .Values.service.port }}"
- name: AFFINE_SERVER_SUB_PATH - name: AFFINE_SERVER_SUB_PATH
...@@ -50,6 +73,37 @@ spec: ...@@ -50,6 +73,37 @@ spec:
value: "{{ .Values.app.host }}" value: "{{ .Values.app.host }}"
- name: ENABLE_R2_OBJECT_STORAGE - name: ENABLE_R2_OBJECT_STORAGE
value: "{{ .Values.app.objectStorage.r2.enabled }}" value: "{{ .Values.app.objectStorage.r2.enabled }}"
- name: OAUTH_EMAIL_SENDER
valueFrom:
secretKeyRef:
name: "{{ .Values.app.oauth.email.secretName }}"
key: sender
- name: OAUTH_EMAIL_LOGIN
valueFrom:
secretKeyRef:
name: "{{ .Values.app.oauth.email.secretName }}"
key: login
- name: OAUTH_EMAIL_SERVER
valueFrom:
secretKeyRef:
name: "{{ .Values.app.oauth.email.secretName }}"
key: server
- name: OAUTH_EMAIL_PORT
valueFrom:
secretKeyRef:
name: "{{ .Values.app.oauth.email.secretName }}"
key: port
- name: OAUTH_EMAIL_PASSWORD
valueFrom:
secretKeyRef:
name: "{{ .Values.app.oauth.email.secretName }}"
key: password
- name: DOC_MERGE_INTERVAL
value: "{{ .Values.app.doc.mergeInterval }}"
{{ if .Values.app.experimental.enableJwstCodec }}
- name: DOC_MERGE_USE_JWST_CODEC
value: "true"
{{ end }}
{{ if .Values.app.objectStorage.r2.enabled }} {{ if .Values.app.objectStorage.r2.enabled }}
- name: R2_OBJECT_STORAGE_ACCOUNT_ID - name: R2_OBJECT_STORAGE_ACCOUNT_ID
valueFrom: valueFrom:
...@@ -112,6 +166,20 @@ spec: ...@@ -112,6 +166,20 @@ spec:
initialDelaySeconds: {{ .Values.probe.initialDelaySeconds }} initialDelaySeconds: {{ .Values.probe.initialDelaySeconds }}
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml .Values.resources | nindent 12 }}
{{ if .Values.global.database.gcloud.enabled }}
- name: cloud-sql-proxy
image: gcr.io/cloud-sql-connectors/cloud-sql-proxy:2.6.0
args:
- "--structured-logs"
- "--auto-iam-authn"
- "{{ .Values.global.database.gcloud.connectionName }}"
securityContext:
runAsNonRoot: true
resources:
requests:
memory: "2Gi"
cpu: "1"
{{ end }}
{{- with .Values.nodeSelector }} {{- with .Values.nodeSelector }}
nodeSelector: nodeSelector:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
......
...@@ -5,13 +5,14 @@ metadata: ...@@ -5,13 +5,14 @@ metadata:
labels: labels:
{{- include "graphql.labels" . | nindent 4 }} {{- include "graphql.labels" . | nindent 4 }}
annotations: annotations:
"helm.sh/hook": pre-install,pre-upgrade "helm.sh/hook": post-install,pre-upgrade
"helm.sh/hook-weight": "-1" "helm.sh/hook-weight": "-1"
"helm.sh/hook-delete-policy": before-hook-creation "helm.sh/hook-delete-policy": before-hook-creation
spec: spec:
template: template:
spec: spec:
serviceAccountName: {{ include "graphql.serviceAccountName" . }}
containers: containers:
- name: {{ .Chart.Name }} - name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
...@@ -19,13 +20,21 @@ spec: ...@@ -19,13 +20,21 @@ spec:
env: env:
- name: NODE_ENV - name: NODE_ENV
value: "{{ .Values.env }}" value: "{{ .Values.env }}"
- name: DATABSE_PASSWORD - name: AFFINE_ENV
value: "{{ .Release.Namespace }}"
- name: DATABASE_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: pg-postgresql name: pg-postgresql
key: postgres-password key: postgres-password
{{ if not .Values.global.database.gcloud.enabled }}
- name: DATABASE_URL - name: DATABASE_URL
value: postgres://{{ .Values.database.user }}:$(DATABSE_PASSWORD)@{{ .Values.database.url }}:{{ .Values.database.port }}/{{ .Values.database.name }} value: postgres://{{ .Values.global.database.user }}:$(DATABASE_PASSWORD)@{{ .Values.global.database.url }}:{{ .Values.global.database.port }}/{{ .Values.global.database.name }}
{{ end }}
{{ if .Values.global.database.gcloud.enabled }}
- name: DATABASE_URL
value: postgres://{{ .Values.global.database.user }}:$(DATABASE_PASSWORD)@{{ .Values.global.database.gcloud.cloudSqlInternal }}:{{ .Values.global.database.port }}/{{ .Values.global.database.name }}
{{ end }}
resources: resources:
requests: requests:
cpu: '100m' cpu: '100m'
......
{{- if .Values.global.gke.enabled -}}
apiVersion: monitoring.googleapis.com/v1
kind: PodMonitoring
metadata:
name: "{{ .Chart.Name }}-monitoring"
spec:
selector:
matchLabels:
app.kubernetes.io/name: "{{ include "graphql.name" . }}"
endpoints:
- port: {{ .Values.service.port }}
interval: 30s
{{- end }}
{{- if .Values.app.oauth.github.enabled -}}
apiVersion: v1
kind: Secret
metadata:
name: "{{ .Values.app.oauth.github.secretName }}"
type: Opaque
data:
{{- ( include "objectStorage.oauth.github" . ) | indent 2 -}}
{{- end }}
{{- if .Values.app.oauth.google.enabled -}}
apiVersion: v1
kind: Secret
metadata:
name: "{{ .Values.app.oauth.google.secretName }}"
type: Opaque
data:
{{- ( include "objectStorage.oauth.google" . ) | indent 2 -}}
{{- end }}
apiVersion: v1
kind: Secret
metadata:
name: "{{ .Values.app.oauth.email.secretName }}"
type: Opaque
data:
sender: "{{ .Values.app.oauth.email.sender | b64enc }}"
login: "{{ .Values.app.oauth.email.login | b64enc }}"
password: "{{ .Values.app.oauth.email.password | b64enc }}"
server: "{{ .Values.app.oauth.email.server | b64enc }}"
port: "{{ .Values.app.oauth.email.port | b64enc }}"
---
{{- if .Values.app.oauth.google.enabled -}}
apiVersion: v1
kind: Secret
metadata:
name: "{{ .Values.app.oauth.google.secretName }}"
type: Opaque
data:
clientId: "{{ .Values.app.oauth.google.clientId | b64enc }}"
clientSecret: "{{ .Values.app.oauth.google.clientSecret | b64enc }}"
{{- end }}
---
{{- if .Values.app.oauth.github.enabled -}}
apiVersion: v1
kind: Secret
metadata:
name: "{{ .Values.app.oauth.github.secretName }}"
type: Opaque
data:
clientId: "{{ .Values.app.oauth.github.clientId | b64enc }}"
clientSecret: "{{ .Values.app.oauth.github.clientSecret | b64enc }}"
{{- end }}
{{- if .Values.global.database.password -}}
apiVersion: v1
kind: Secret
metadata:
name: pg-postgresql
type: Opaque
data:
postgres-password: {{ .Values.global.database.password | b64enc }}
{{- end }}
...@@ -5,5 +5,8 @@ metadata: ...@@ -5,5 +5,8 @@ metadata:
name: "{{ .Values.app.objectStorage.r2.secretName }}" name: "{{ .Values.app.objectStorage.r2.secretName }}"
type: Opaque type: Opaque
data: data:
{{- ( include "objectStorage.r2" . ) | indent 2 -}} accountId: {{ .Values.app.objectStorage.r2.accountId | b64enc }}
accessKeyId: {{ .Values.app.objectStorage.r2.accessKeyId | b64enc }}
secretAccessKey: {{ .Values.app.objectStorage.r2.secretAccessKey | b64enc }}
bucket: {{ .Values.app.objectStorage.r2.bucket | b64enc }}
{{- end }} {{- end }}
{{- if .Values.global.redis.password -}}
apiVersion: v1
kind: Secret
metadata:
name: redis
type: Opaque
data:
redis-password: {{ .Values.global.redis.password | b64enc }}
{{- end }}
...@@ -9,16 +9,15 @@ nameOverride: '' ...@@ -9,16 +9,15 @@ nameOverride: ''
fullnameOverride: '' fullnameOverride: ''
# map to NODE_ENV environment variable # map to NODE_ENV environment variable
env: 'production' env: 'production'
database:
user: 'postgres'
url: 'pg-postgresql'
port: '5432'
name: 'affine'
app: app:
experimental:
enableJwstCodec: true
# AFFINE_SERVER_SUB_PATH # AFFINE_SERVER_SUB_PATH
path: '' path: ''
# AFFINE_SERVER_HOST # AFFINE_SERVER_HOST
host: '0.0.0.0' host: '0.0.0.0'
doc:
mergeInterval: "3000"
jwt: jwt:
secretName: jwt-private-key secretName: jwt-private-key
# base64 encoded ecdsa private key # base64 encoded ecdsa private key
...@@ -32,6 +31,13 @@ app: ...@@ -32,6 +31,13 @@ app:
secretAccessKey: '' secretAccessKey: ''
bucket: '' bucket: ''
oauth: oauth:
email:
secretName: 'oauth-email'
sender: 'noreply@toeverything.info'
login: ''
password: ''
server: 'smtp.gmail.com'
port: '465'
google: google:
enabled: false enabled: false
secretName: oauth-google secretName: oauth-google
...@@ -55,11 +61,11 @@ podSecurityContext: ...@@ -55,11 +61,11 @@ podSecurityContext:
resources: resources:
limits: limits:
cpu: '2000m' cpu: '4'
memory: 4Gi memory: 8Gi
requests: requests:
cpu: '1000m' cpu: '2'
memory: 2Gi memory: 4Gi
probe: probe:
initialDelaySeconds: 20 initialDelaySeconds: 20
......
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
apiVersion: v2
name: sync
description: A Helm chart for Kubernetes
type: application
version: 0.0.0
appVersion: "0.7.0-canary.18"
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать