There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
docs: improve helm ci & document (#2902)
DarkSkyd6addc0d0b85
diff --git a/.github/helm/affine-cloud/.gitignore b/.github/helm/affine-cloud/.gitignorenew file mode 100644index 0000000000..711a39c541--- /dev/null+++ b/.github/helm/affine-cloud/.gitignore@@ -0,0 +1 @@+charts/\ No newline at end of filediff --git a/.github/helm/affine-cloud/.helmignore b/.github/helm/affine-cloud/.helmignoreindex 0e8a0eb36f..691fa13d6a 100644--- a/.github/helm/affine-cloud/.helmignore+++ b/.github/helm/affine-cloud/.helmignore@@ -20,4 +20,4 @@.project.idea/*.tmproj-.vscode/+.vscode/\ No newline at end of filediff --git a/.github/helm/affine-cloud/charts/postgresql-12.5.8.tgz b/.github/helm/affine-cloud/charts/postgresql-12.5.8.tgzdeleted file mode 100644index 1c2df40510..0000000000Binary files a/.github/helm/affine-cloud/charts/postgresql-12.5.8.tgz and /dev/null differdiff --git a/.github/helm/affine-cloud/readme.md b/.github/helm/affine-cloud/readme.mdnew file mode 100644index 0000000000..0cac15cf57--- /dev/null+++ b/.github/helm/affine-cloud/readme.md@@ -0,0 +1,30 @@+# Helm Chart Configuration++The following table lists the configurable parameters of this Helm chart and their default values.++## AFFiNE Cloud Server parameters++| Parameter | Description | Default |+| ------------------------------ | -------------------------------------------------- | ------------------ |+| `affineCloud.tag` | The Docker tag of the AffineCloud image to be used | `'nightly-latest'` |+| `affineCloud.resources.cpu` | The CPU resources allocated for AffineCloud | `'250m'` |+| `affineCloud.resources.memory` | The memory resources allocated for AffineCloud | `'0.5Gi'` |+| `affineCloud.signKey` | The key used to sign the JWT tokens | `'c2VjcmV0'` |+| `affineCloud.service.type` | The type of the Kubernetes service | `'ClusterIP'` |+| `affineCloud.service.port` | The port of the Kubernetes service | `'http'` |+| `affineCloud.mail.account` | The email account used to send emails | `''` |+| `affineCloud.mail.password` | The password of the email account | `''` |++## PostgreSQL parameters++| Parameter | Description | Default |+| -------------------------------------------- | ------------------------------------------------------------------------------------- | ------------ |+| `postgresql.auth.username` | Username for the PostgreSQL database | `'affine'` |+| `postgresql.auth.password` | Password for the PostgreSQL database. Please change this for production environments. | `'password'` |+| `postgresql.auth.database` | The name of the default database that will be created on image startup | `'affine'` |+| `postgresql.primary.resources.limits.cpu` | The CPU resources allocated for the PostgreSQL primary node | `'500m'` |+| `postgresql.primary.resources.limits.memory` | The memory resources allocated for the PostgreSQL primary node | `'0.5Gi'` |++For more postgres parameters, please refer to: https://artifacthub.io/packages/helm/bitnami/postgresql++Please note that for the `postgresql.auth.password`, you should provide your own password for production environments. The default value is provided only for demonstration purposes.diff --git a/.github/helm/affine-cloud/templates/_helper.tpl b/.github/helm/affine-cloud/templates/_helper.tplnew file mode 100644index 0000000000..06a02feb84--- /dev/null+++ b/.github/helm/affine-cloud/templates/_helper.tpl@@ -0,0 +1,51 @@+{{/*+Expand the name of the chart.+*/}}+{{- define "affine-cloud.name" -}}+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}+{{- end }}++{{/*+Create a default fully qualified app name.+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).+If release name contains chart name it will be used as a full name.+*/}}+{{- define "affine-cloud.fullname" -}}+{{- if .Values.fullnameOverride }}+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}+{{- else }}+{{- $name := default .Chart.Name .Values.nameOverride }}+{{- if contains $name .Release.Name }}+{{- .Release.Name | trunc 63 | trimSuffix "-" }}+{{- else }}+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}+{{- end }}+{{- end }}+{{- end }}++{{/*+Create chart name and version as used by the chart label.+*/}}+{{- define "affine-cloud.chart" -}}+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}+{{- end }}++{{/*+Common labels+*/}}+{{- define "affine-cloud.labels" -}}+helm.sh/chart: {{ include "affine-cloud.chart" . }}+{{ include "affine-cloud.selectorLabels" . }}+{{- if .Chart.AppVersion }}+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}+{{- end }}+app.kubernetes.io/managed-by: {{ .Release.Service }}+{{- end }}++{{/*+Selector labels+*/}}+{{- define "affine-cloud.selectorLabels" -}}+app.kubernetes.io/name: {{ include "affine-cloud.name" . }}+app.kubernetes.io/instance: {{ .Release.Name }}+{{- end }}diff --git a/.github/helm/affine-cloud/templates/deployment.yaml b/.github/helm/affine-cloud/templates/deployment.yamlindex 37acfc45fa..842e9ab63c 100644--- a/.github/helm/affine-cloud/templates/deployment.yaml+++ b/.github/helm/affine-cloud/templates/deployment.yaml@@ -1,7 +1,9 @@apiVersion: apps/v1kind: Deploymentmetadata:- name: affine-cloud+ name: "{{ include "affine-cloud.fullname" . }}"+ labels:+ {{- include "affine-cloud.labels" . | nindent 4 }}spec:replicas: 1selector:@@ -30,7 +32,7 @@ spec:- name: PG_HOSTvalue: "{{ .Release.Name }}-postgresql"- name: DATABASE_URL- value: "{{ default "postgresql://$(PG_USER):$(PG_PASS)@$(PG_HOST)/$(PG_DATABASE)" .Values.affineCloud.databaseUrl }}"+ value: "{{ .Values.affineCloud.databaseUrl | default "postgresql://$(PG_USER):$(PG_PASS)@$(PG_HOST)/$(PG_DATABASE)" }}"envFrom:- secretRef:name: affine-cloud-secretdiff --git a/.github/helm/affine-cloud/templates/secret.yaml b/.github/helm/affine-cloud/templates/secret.yamlindex 170a5b90d1..f6879af5e8 100644--- a/.github/helm/affine-cloud/templates/secret.yaml+++ b/.github/helm/affine-cloud/templates/secret.yaml@@ -4,7 +4,6 @@ metadata:name: affine-cloud-secrettype: Opaquedata:- # only for demo, please modify it at prod env- SIGN_KEY: TUFtdFdzQTJhdGJuem01TA==-# MAIL_ACCOUNT: XXXX-# MAIL_PASSWORD: XXXX+ SIGN_KEY: "{{ .Values.affineCloud.signKey }}"+ MAIL_ACCOUNT: "{{ .Values.affineCloud.mail.account }}"+ MAIL_PASSWORD: "{{ .Values.affineCloud.mail.password }}"diff --git a/.github/helm/affine-cloud/templates/services.yaml b/.github/helm/affine-cloud/templates/services.yamlindex ec0b2f8c72..2529d4569d 100644--- a/.github/helm/affine-cloud/templates/services.yaml+++ b/.github/helm/affine-cloud/templates/services.yaml@@ -1,13 +1,15 @@apiVersion: v1kind: Servicemetadata:- name: affine-cloud+ name: "{{ include "affine-cloud.fullname" . }}"+ labels:+ {{- include "affine-cloud.labels" . | nindent 4 }}spec:- type: ClusterIP- selector:- app: affine-cloud+ type: "{{ .Values.affineCloud.service.type }}"ports:- - name: affine-cloud+ - name: httpprotocol: TCP- port: 3000+ port: {{ .Values.affineCloud.service.port }}targetPort: 3000+ selector:+ {{- include "affine-cloud.selectorLabels" . | nindent 4 }}diff --git a/.github/helm/affine-cloud/values.yaml b/.github/helm/affine-cloud/values.yamlindex e1bad387ea..582dee709a 100644--- a/.github/helm/affine-cloud/values.yaml+++ b/.github/helm/affine-cloud/values.yaml@@ -1,5 +1,13 @@affineCloud:tag: 'nightly-latest'+ # databaseUrl: 'postgresql://affine:password@affine-cloud-postgresql:5432/affine'+ signKey: TUFtdFdzQTJhdGJuem01TA==+ mail:+ account: ''+ password: ''+ service:+ type: ClusterIP+ port: 80resources:cpu: '250m'memory: 0.5Gi@@ -7,7 +15,7 @@ postgresql:auth:# only for demo, please modify it at prod envusername: affine- password: XJYMLnuBJS27a2du+ password: passworddatabase: affineprimary:initdb:diff --git a/.github/workflows/helm_releaser.yml b/.github/workflows/helm-releaser.ymlsimilarity index 90%rename from .github/workflows/helm_releaser.ymlrename to .github/workflows/helm-releaser.ymlindex 890c46f98d..b85972e47d 100644--- a/.github/workflows/helm_releaser.yml+++ b/.github/workflows/helm-releaser.yml@@ -37,21 +37,25 @@ jobs:| tar zxf - -C /usr/local/bin- name: Package charts+ working-directory: .helm-chart-repo+ run: |+ mkdir -p .cr-index+ helm repo add bitnami https://charts.bitnami.com/bitnami+ helm repo update++ helm dependencies build ../.github/helm/affine-cloud+ cr package ../.github/helm/affine-cloud++ - name: Package charts+ if: github.ref == 'refs/heads/master'working-directory: .helm-chart-reporun: |set -exgit config --local user.name "$GITHUB_ACTOR"git config --local user.email "[email protected]"- mkdir -p .cr-indexowner=$(cut -d '/' -f 1 <<< '${{ github.repository }}')repo=helm-chartsgit_hash=$(git rev-parse HEAD)- echo $git_hash-- helm repo add bitnami https://charts.bitnami.com/bitnami- helm repo update-- cr package ../.github/helm/affine-cloudcr upload --commit "$git_hash" \--git-repo "$repo" --owner "$owner" \--token '${{ secrets.HELM_RELEASER_TOKEN }}' \