Move affine to deprecated

This commit is contained in:
2026-06-21 10:22:47 +02:00
parent e83fe33109
commit edef407a7e
10 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: affine-config-pvc
namespace: affine
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn-static
resources:
requests:
storage: 1Gi

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: affine-data-pvc
namespace: affine
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn-static
resources:
requests:
storage: 30Gi

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: affine
namespace: affine
spec:
selector:
app: affine
type: ClusterIP
ports:
- name: http
protocol: TCP
port: 3010
targetPort: 3010

View File

@@ -0,0 +1,82 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: affine
namespace: affine
spec:
replicas: 1
selector:
matchLabels:
app: affine
serviceName: affine
template:
metadata:
labels:
app: affine
spec:
restartPolicy: Always
terminationGracePeriodSeconds: 30
initContainers:
- name: affine-migration
image: ghcr.io/toeverything/affine:stable
command: ["sh", "-c", "node ./scripts/self-host-predeploy.js"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: affine-secrets
key: DATABASE_URL
- name: REDIS_SERVER_HOST
value: affine-valkey.affine.svc.cluster.local
- name: AFFINE_INDEXER_ENABLED
value: "false"
volumeMounts:
- name: affine-storage
mountPath: /root/.affine/storage
- name: affine-config
mountPath: /root/.affine/config
containers:
- name: affine
image: ghcr.io/toeverything/affine:stable
resources:
requests:
cpu: 200m
memory: 512Mi
limits:
cpu: 1000m
memory: 2Gi
ports:
- containerPort: 3010
name: http
env:
- name: NODE_ENV
value: production
- name: AFFINE_SERVER_HOST
value: affine.jsme.be
- name: AFFINE_SERVER_HTTPS
value: "true"
- name: AFFINE_SERVER_PORT
value: "3010"
- name: AFFINE_INDEXER_ENABLED
value: "false"
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: affine-secrets
key: DATABASE_URL
- name: REDIS_SERVER_HOST
value: affine-valkey.affine.svc.cluster.local
- name: REDIS_SERVER_PORT
value: "6379"
volumeMounts:
- name: affine-storage
mountPath: /root/.affine/storage
- name: affine-config
mountPath: /root/.affine/config
volumes:
- name: affine-storage
persistentVolumeClaim:
claimName: affine-data-pvc
- name: affine-config
persistentVolumeClaim:
claimName: affine-config-pvc

View File

@@ -0,0 +1,46 @@
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: affine-route
namespace: affine
spec:
parentRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: gateway-internal
namespace: envoy-gateway
sectionName: affine
hostnames:
- "affine.jsme.be"
rules:
- matches:
- path:
type: PathPrefix
value: /
filters:
- type: RequestHeaderModifier
requestHeaderModifier:
set:
- name: X-Forwarded-Host
value: "affine.jsme.be"
- name: X-Forwarded-Proto
value: https
- type: ResponseHeaderModifier
responseHeaderModifier:
set:
- name: Strict-Transport-Security
value: "max-age=31536000; includeSubDomains"
- name: X-Content-Type-Options
value: nosniff
- name: X-Frame-Options
value: SAMEORIGIN
- name: Referrer-Policy
value: strict-origin-when-cross-origin
- name: Permissions-Policy
value: "camera=(), microphone=(), geolocation=(), payment=()"
backendRefs:
- name: affine
port: 3010
kind: Service
group: ""
weight: 1

View File

@@ -0,0 +1,55 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: affine-postgresql
namespace: affine
spec:
replicas: 1
selector:
matchLabels:
app: affine-postgresql
serviceName: affine-postgresql
template:
metadata:
labels:
app: affine-postgresql
spec:
restartPolicy: Always
terminationGracePeriodSeconds: 60
containers:
- name: affine-postgresql
image: pgvector/pgvector:pg17
resources:
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: 500m
memory: 512Mi
ports:
- containerPort: 5432
volumeMounts:
- name: affine-postgresql-database
mountPath: /var/lib/postgresql/volumes/pgdata
env:
- name: PGDATA
value: /var/lib/postgresql/volumes/pgdata/data
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: affine-secrets
key: db_name
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: affine-secrets
key: db_user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: affine-secrets
key: db_password
volumes:
- name: affine-postgresql-database
persistentVolumeClaim:
claimName: affine-postgresql-pvc

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: affine-postgresql-pvc
namespace: affine
spec:
accessModes:
- ReadWriteMany
storageClassName: longhorn
resources:
requests:
storage: 5Gi

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: affine-postgresql
namespace: affine
spec:
selector:
app: affine-postgresql
type: ClusterIP
ports:
- name: postgresql
protocol: TCP
port: 5432
targetPort: 5432

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: affine-valkey
namespace: affine
spec:
selector:
app: affine-valkey
type: ClusterIP
ports:
- name: valkey
protocol: TCP
port: 6379
targetPort: 6379

View File

@@ -0,0 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: affine-valkey
namespace: affine
spec:
replicas: 1
selector:
matchLabels:
app: affine-valkey
template:
metadata:
labels:
app: affine-valkey
spec:
restartPolicy: Always
containers:
- name: affine-valkey
image: valkey/valkey:9
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 200m
memory: 256Mi
ports:
- containerPort: 6379