From 0215ecaf877d425db49d0ac76a9233c7b701f3f4 Mon Sep 17 00:00:00 2001 From: Remy Moll Date: Mon, 13 May 2024 14:27:34 +0200 Subject: [PATCH] add (broken) deployment --- apps/affine/deployment.yaml | 49 ++++++++++++++++++++++++++++++++++ apps/affine/ingress.yaml | 15 +++++++++++ apps/affine/kustomization.yaml | 20 ++++++++++++++ apps/affine/namespace.yaml | 4 +++ apps/affine/postgres.yaml | 21 +++++++++++++++ apps/affine/pvc.yaml | 11 ++++++++ apps/affine/service.yaml | 10 +++++++ 7 files changed, 130 insertions(+) create mode 100644 apps/affine/deployment.yaml create mode 100644 apps/affine/ingress.yaml create mode 100644 apps/affine/kustomization.yaml create mode 100644 apps/affine/namespace.yaml create mode 100644 apps/affine/postgres.yaml create mode 100644 apps/affine/pvc.yaml create mode 100644 apps/affine/service.yaml diff --git a/apps/affine/deployment.yaml b/apps/affine/deployment.yaml new file mode 100644 index 0000000..25d354d --- /dev/null +++ b/apps/affine/deployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: affine +spec: + selector: + matchLabels: + app: affine + template: + metadata: + labels: + app: affine + spec: + containers: + - name: affine + image: affine + resources: + limits: + memory: "128Mi" + cpu: "500m" + env: + - name: AFFINE_SERVER_HOST + value: "affine.kluster.moll.re" + - name: AFFINE_SERVER_PORT + value: "443" + - name: AFFINE_SERVER_HTTPS + value: "true" + - name: AFFINE_CONFIG_PATH + value: "/root/.affine/config" + - name: AFFINE_ADMIN_EMAIL + value: "me@moll.re" + - name: AFFINE_ADMIN_PASSWORD + value: "password" + - name: TELEMETRY_ENABLE + value: "false" + - name: DATABASE_URL + valueFrom: + secretKeyRef: + name: postgres-credentials + key: url + ports: + - containerPort: 3010 + volumeMounts: + - name: affine + mountPath: /root/.affine/storage + volumes: + - name: affine + persistentVolumeClaim: + claimName: affine-data diff --git a/apps/affine/ingress.yaml b/apps/affine/ingress.yaml new file mode 100644 index 0000000..9e591fc --- /dev/null +++ b/apps/affine/ingress.yaml @@ -0,0 +1,15 @@ +apiVersion: traefik.io/v1alpha1 +kind: IngressRoute +metadata: + name: affine-ingress +spec: + entryPoints: + - websecure + routes: + - match: Host(`affine.kluster.moll.re`) + kind: Rule + services: + - name: affine-web + port: 3010 + tls: + certResolver: default-tls diff --git a/apps/affine/kustomization.yaml b/apps/affine/kustomization.yaml new file mode 100644 index 0000000..d27d06b --- /dev/null +++ b/apps/affine/kustomization.yaml @@ -0,0 +1,20 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + + +namespace: affine + +resources: + - namespace.yaml + - deployment.yaml + - service.yaml + - ingress.yaml + - postgres.yaml + - pvc.yaml + - postgres-credentials.secret.yaml + + +images: + - name: affine + newName: ghcr.io/toeverything/affine-graphql + newTag: stable diff --git a/apps/affine/namespace.yaml b/apps/affine/namespace.yaml new file mode 100644 index 0000000..3900a62 --- /dev/null +++ b/apps/affine/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: placeholder \ No newline at end of file diff --git a/apps/affine/postgres.yaml b/apps/affine/postgres.yaml new file mode 100644 index 0000000..11e5a7e --- /dev/null +++ b/apps/affine/postgres.yaml @@ -0,0 +1,21 @@ +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: affine-postgres +spec: + instances: 1 + imageName: postgres:16.2 + bootstrap: + initdb: + owner: affine + database: affine + secret: + name: postgres-credentials + + storage: + size: 1Gi + pvcTemplate: + storageClassName: "nfs-client" + resources: + requests: + storage: "1Gi" diff --git a/apps/affine/pvc.yaml b/apps/affine/pvc.yaml new file mode 100644 index 0000000..2301675 --- /dev/null +++ b/apps/affine/pvc.yaml @@ -0,0 +1,11 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: affine-data +spec: + storageClassName: "nfs-client" + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 15Gi diff --git a/apps/affine/service.yaml b/apps/affine/service.yaml new file mode 100644 index 0000000..46f221c --- /dev/null +++ b/apps/affine/service.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Service +metadata: + name: affine-web +spec: + selector: + app: affine + ports: + - port: 3010 + targetPort: 3010