From 450846cf01a95b136674bc646edf5b608b555956 Mon Sep 17 00:00:00 2001 From: Jose Henrique Date: Thu, 20 Aug 2026 20:56:26 -0300 Subject: [PATCH] new services --- cloud/affine.yaml | 130 ++++++++++++++++++++++++++++++++++++++ default/stirling-pdf.yaml | 113 +++++++++++++++++++++++++++++++++ 2 files changed, 243 insertions(+) create mode 100644 cloud/affine.yaml create mode 100644 default/stirling-pdf.yaml diff --git a/cloud/affine.yaml b/cloud/affine.yaml new file mode 100644 index 0000000..a592d73 --- /dev/null +++ b/cloud/affine.yaml @@ -0,0 +1,130 @@ +--- +# ============ AFFiNE app ============ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: affine + namespace: cloud + labels: + app: affine +spec: + replicas: 1 + selector: + matchLabels: + app: affine + strategy: + type: Recreate + template: + metadata: + labels: + app: affine + spec: + containers: + - name: affine + image: ghcr.io/toeverything/affine:stable + imagePullPolicy: Always + command: + [ + "sh", + "-c", + "node ./scripts/self-host-predeploy.js && node ./dist/main.js", + ] + env: + - name: AFFINE_CONFIG_PATH + value: "/root/.affine/config" + - name: AFFINE_SERVER_EXTERNAL_URL + value: "http://affine.haven" + - name: AFFINE_SERVER_HOST + value: "0.0.0.0" + - name: AFFINE_SERVER_PORT + value: "3010" + - name: AFFINE_SERVER_HTTPS + value: "false" + - name: AFFINE_SERVER_SUBPATH + value: "/" + - name: AFFINE_ENABLE_SYNC_FROM_STARTUP + value: "true" + - name: DATABASE_URL + value: "postgres://affine:affine@postgresql.haven:5432/affine" + - name: REDIS_SERVER_HOST + value: "redis.haven" + - name: REDIS_SERVER_PORT + value: "6379" + ports: + - containerPort: 3010 + name: http + readinessProbe: + httpGet: + path: / + port: 3010 + initialDelaySeconds: 20 + periodSeconds: 10 + failureThreshold: 6 + resources: + requests: + cpu: 200m + memory: 512Mi + limits: + cpu: 2000m + memory: 2Gi + volumeMounts: + - name: config + mountPath: /root/.affine/config + volumes: + - name: config + persistentVolumeClaim: + claimName: affine-config + terminationGracePeriodSeconds: 30 +--- +apiVersion: v1 +kind: Service +metadata: + name: affine + namespace: cloud + labels: + app: affine +spec: + type: ClusterIP + selector: + app: affine + ports: + - name: http + port: 3010 + protocol: TCP + targetPort: http +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: affine-config + namespace: cloud + annotations: + nfs.io/storage-path: "affine-config" +spec: + storageClassName: "nfs-client" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: affine + namespace: cloud + labels: + app: affine +spec: + ingressClassName: nginx + rules: + - host: affine.haven + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: affine + port: + number: 3010 diff --git a/default/stirling-pdf.yaml b/default/stirling-pdf.yaml new file mode 100644 index 0000000..384a5f4 --- /dev/null +++ b/default/stirling-pdf.yaml @@ -0,0 +1,113 @@ +--- +# 1) Deployment - Stirling-PDF +apiVersion: apps/v1 +kind: Deployment +metadata: + name: stirlingpdf + namespace: default + labels: + app: stirlingpdf +spec: + replicas: 1 + selector: + matchLabels: + app: stirlingpdf + template: + metadata: + labels: + app: stirlingpdf + spec: + containers: + - name: stirlingpdf + image: stirlingtools/stirling-pdf:latest + imagePullPolicy: Always + env: + - name: TZ + value: "America/Sao_Paulo" + - name: DOCKER_ENABLE_SECURITY + value: "false" + - name: SECURITY_ENABLELOGIN + value: "false" + ports: + - containerPort: 8080 + name: http + readinessProbe: + httpGet: + path: / + port: 8080 + initialDelaySeconds: 20 + periodSeconds: 10 + resources: + requests: + cpu: 100m + memory: 1Gi + limits: + cpu: 2000m + memory: 2Gi + securityContext: + allowPrivilegeEscalation: false + runAsUser: 0 + volumeMounts: + - name: config + mountPath: /configs + volumes: + - name: config + persistentVolumeClaim: + claimName: stirlingpdf-config + terminationGracePeriodSeconds: 30 +--- +# 2) Service +apiVersion: v1 +kind: Service +metadata: + name: stirlingpdf + namespace: default + labels: + app: stirlingpdf +spec: + type: ClusterIP + selector: + app: stirlingpdf + ports: + - name: http + port: 8080 + protocol: TCP + targetPort: http +--- +# 3) PersistentVolumeClaim +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: stirlingpdf-config + namespace: default + annotations: + nfs.io/storage-path: "stirlingpdf-config" +spec: + storageClassName: "nfs-client" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +# 4) Ingress +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: stirlingpdf + namespace: default + labels: + app: stirlingpdf +spec: + ingressClassName: nginx + rules: + - host: stirling.haven + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: stirlingpdf + port: + number: 8080