move migration and server into same thing
This commit is contained in:
@@ -1,51 +1,4 @@
|
|||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
# 5a) Job: affine-migration (runs once at startup to initialize the DB)
|
|
||||||
# --------------------------------------------------------------------
|
|
||||||
apiVersion: batch/v1
|
|
||||||
kind: Job
|
|
||||||
metadata:
|
|
||||||
name: affine-migration
|
|
||||||
namespace: affine
|
|
||||||
spec:
|
|
||||||
backoffLimit: 2
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
job: affine-migration
|
|
||||||
spec:
|
|
||||||
restartPolicy: OnFailure
|
|
||||||
containers:
|
|
||||||
- name: affine-migrate
|
|
||||||
image: ghcr.io/toeverything/affine-graphql:canary-2e58c11
|
|
||||||
command: ["sh", "-c", "node ./scripts/self-host-predeploy.js"]
|
|
||||||
env:
|
|
||||||
- name: REDIS_SERVER_HOST
|
|
||||||
value: "redis-lb.redis.svc.cluster.local"
|
|
||||||
- name: REDIS_SERVER_PORT
|
|
||||||
value: "6379"
|
|
||||||
- name: DATABASE_URL
|
|
||||||
value: >-
|
|
||||||
postgresql://$(DB_USERNAME):$(DB_PASSWORD)@postgres-base-rw.postgres.svc.cluster.local:5432/$(DB_DATABASE)
|
|
||||||
- name: AFFINE_SERVER_PORT
|
|
||||||
value: "3010"
|
|
||||||
envFrom:
|
|
||||||
- secretRef:
|
|
||||||
name: affine-db-secret
|
|
||||||
volumeMounts:
|
|
||||||
- name: affine-storage
|
|
||||||
mountPath: /root/.affine/storage
|
|
||||||
- name: affine-config
|
|
||||||
mountPath: /root/.affine/config
|
|
||||||
volumes:
|
|
||||||
- name: affine-storage
|
|
||||||
persistentVolumeClaim:
|
|
||||||
claimName: affine-storage-pvc
|
|
||||||
- name: affine-config
|
|
||||||
persistentVolumeClaim:
|
|
||||||
claimName: affine-config-pvc
|
|
||||||
|
|
||||||
---
|
|
||||||
# --------------------------------------------------------------------
|
|
||||||
# 5b) Deployment: affine-server (serves HTTP on port 3010)
|
# 5b) Deployment: affine-server (serves HTTP on port 3010)
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
@@ -65,6 +18,28 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: affine-server
|
app: affine-server
|
||||||
spec:
|
spec:
|
||||||
|
initContainers:
|
||||||
|
- name: affine-migrate
|
||||||
|
image: ghcr.io/toeverything/affine-graphql:canary-2e58c11
|
||||||
|
command: ["sh", "-c", "node ./scripts/self-host-predeploy.js"]
|
||||||
|
env:
|
||||||
|
- name: REDIS_SERVER_HOST
|
||||||
|
value: "redis-lb.redis.svc.cluster.local"
|
||||||
|
- name: REDIS_SERVER_PORT
|
||||||
|
value: "6379"
|
||||||
|
- name: DATABASE_URL
|
||||||
|
value: >
|
||||||
|
postgresql://$(DB_USERNAME):$(DB_PASSWORD)@postgres-base-rw.postgres.svc.cluster.local:5432/$(DB_DATABASE)
|
||||||
|
- name: AFFINE_SERVER_PORT
|
||||||
|
value: "3010"
|
||||||
|
envFrom:
|
||||||
|
- secretRef:
|
||||||
|
name: affine-db-secret
|
||||||
|
volumeMounts:
|
||||||
|
- name: affine-storage
|
||||||
|
mountPath: /root/.affine/storage
|
||||||
|
- name: affine-config
|
||||||
|
mountPath: /root/.affine/config
|
||||||
containers:
|
containers:
|
||||||
- name: affine
|
- name: affine
|
||||||
image: ghcr.io/toeverything/affine-graphql:canary-2e58c11
|
image: ghcr.io/toeverything/affine-graphql:canary-2e58c11
|
||||||
@@ -93,7 +68,6 @@ spec:
|
|||||||
- secretRef:
|
- secretRef:
|
||||||
name: affine-db-secret
|
name: affine-db-secret
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
# If Affine supports an HTTP health endpoint, replace “/health” with the actual path.
|
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /health
|
path: /health
|
||||||
port: 3010
|
port: 3010
|
||||||
|
|||||||
Reference in New Issue
Block a user