-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d53a37
commit 8118769
Showing
50 changed files
with
797 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
.github/helm/affine/charts/graphql/templates/r2-secret.yaml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v2 | ||
name: renderer | ||
description: AFFiNE renderer server | ||
type: application | ||
version: 0.0.0 | ||
appVersion: "0.16.0" | ||
dependencies: | ||
- name: gcloud-sql-proxy | ||
version: 0.0.0 | ||
repository: "file://../gcloud-sql-proxy" | ||
condition: .global.database.gcloud.enabled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
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 "renderer.fullname" . }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo http://$NODE_IP:$NODE_PORT | ||
{{- else if contains "LoadBalancer" .Values.service.type }} | ||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "renderer.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "renderer.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") | ||
echo http://$SERVICE_IP:{{ .Values.service.port }} | ||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "renderer.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT | ||
{{- end }} |
63 changes: 63 additions & 0 deletions
63
.github/helm/affine/charts/renderer/templates/_helpers.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "renderer.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 "renderer.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 "renderer.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "renderer.labels" -}} | ||
helm.sh/chart: {{ include "renderer.chart" . }} | ||
{{ include "renderer.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
monitoring: enabled | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "renderer.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "renderer.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "renderer.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "renderer.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
133 changes: 133 additions & 0 deletions
133
.github/helm/affine/charts/renderer/templates/deployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "renderer.fullname" . }} | ||
labels: | ||
{{- include "renderer.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "renderer.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "renderer.selectorLabels" . | nindent 8 }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "renderer.serviceAccountName" . }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
env: | ||
- name: AFFINE_PRIVATE_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: "{{ .Values.global.secret.secretName }}" | ||
key: key | ||
- name: NODE_ENV | ||
value: "{{ .Values.env }}" | ||
- name: NODE_OPTIONS | ||
value: "--max-old-space-size=4096" | ||
- name: NO_COLOR | ||
value: "1" | ||
- name: DEPLOYMENT_TYPE | ||
value: "affine" | ||
- name: SERVER_FLAVOR | ||
value: "renderer" | ||
- name: AFFINE_ENV | ||
value: "{{ .Release.Namespace }}" | ||
- name: DATABASE_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
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 }} | ||
- 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 | ||
value: "{{ .Values.service.port }}" | ||
- name: AFFINE_SERVER_SUB_PATH | ||
value: "{{ .Values.app.path }}" | ||
- name: AFFINE_SERVER_HOST | ||
value: "{{ .Values.app.host }}" | ||
- name: AFFINE_SERVER_HTTPS | ||
value: "{{ .Values.app.https }}" | ||
- name: ENABLE_R2_OBJECT_STORAGE | ||
value: "{{ .Values.global.objectStorage.r2.enabled }}" | ||
{{ if .Values.global.objectStorage.r2.enabled }} | ||
- name: R2_OBJECT_STORAGE_ACCOUNT_ID | ||
valueFrom: | ||
secretKeyRef: | ||
name: "{{ .Values.global.objectStorage.r2.secretName }}" | ||
key: accountId | ||
- name: R2_OBJECT_STORAGE_ACCESS_KEY_ID | ||
valueFrom: | ||
secretKeyRef: | ||
name: "{{ .Values.global.objectStorage.r2.secretName }}" | ||
key: accessKeyId | ||
- name: R2_OBJECT_STORAGE_SECRET_ACCESS_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: "{{ .Values.global.objectStorage.r2.secretName }}" | ||
key: secretAccessKey | ||
{{ end }} | ||
ports: | ||
- name: http | ||
containerPort: {{ .Values.service.port }} | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: /info | ||
port: http | ||
initialDelaySeconds: {{ .Values.probe.initialDelaySeconds }} | ||
readinessProbe: | ||
httpGet: | ||
path: /info | ||
port: http | ||
initialDelaySeconds: {{ .Values.probe.initialDelaySeconds }} | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
volumes: | ||
- name: config | ||
configMap: | ||
name: {{ .Release.Name }}-runtime-config | ||
items: | ||
- key: "web-assets-manifest" | ||
path: "/app/web-assets-manifest.json" | ||
- key: "mobile-assets-manifest" | ||
path: "/app/mobile-assets-manifest.json" | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
Oops, something went wrong.