From 560a2fc6a1e6f659ac2185a9f79f4dcfe0624b45 Mon Sep 17 00:00:00 2001 From: Nathan Rashleigh Date: Mon, 14 Apr 2025 21:44:56 +1000 Subject: [PATCH] crates bootstrap --- .gitignore | 1 + crates/crates.yaml | 78 ++++++++++++++++++++++------------------ spacerace/spacerace.yaml | 77 ++++++++++++++++++++++++--------------- 3 files changed, 93 insertions(+), 63 deletions(-) diff --git a/.gitignore b/.gitignore index dd4a79b..4bc93e1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ pvs/ *.sql +*.sql.gz *.tar.gz *.secret.yaml ntwl.sublime-workspace diff --git a/crates/crates.yaml b/crates/crates.yaml index 85a96af..4f48225 100644 --- a/crates/crates.yaml +++ b/crates/crates.yaml @@ -14,7 +14,7 @@ metadata: kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: crates-postgres-pvc + name: crates-postgres-data namespace: crates spec: storageClassName: zfs-fast @@ -26,6 +26,20 @@ spec: --- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: crates-postgres-bootstrap + namespace: crates +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + +--- + # ----------------------------------------------------------------------- # DEPLOYMENTS # ----------------------------------------------------------------------- @@ -69,28 +83,32 @@ spec: volumeMounts: - name: crates-postgres-storage mountPath: /var/lib/postgresql/data + - name: crates-postgres-bootstrap + mountPath: /docker-entrypoint-initdb.d volumes: - name: crates-postgres-storage persistentVolumeClaim: - claimName: crates-postgres-pvc + claimName: crates-postgres-data + - name: crates-postgres-bootstrap + persistentVolumeClaim: + claimName: crates-postgres-bootstrap --- +# apiVersion: v1 +# kind: Pod +# metadata: +# name: nbody-gpu-benchmark +# namespace: default +# spec: + apiVersion: apps/v1 -kind: Deployment +kind: Pod metadata: namespace: crates name: crates-api spec: - replicas: 1 - selector: - matchLabels: - app: crates-api - template: - metadata: - labels: - app: crates-api spec: containers: - name: crates-api @@ -123,33 +141,25 @@ spec: --- -apiVersion: apps/v1 -kind: Deployment +apiVersion: v1 +kind: Pod metadata: namespace: crates name: crates-migrate spec: - replicas: 1 - selector: - matchLabels: - app: crates-migrate - template: - metadata: - labels: - app: crates-migrate - spec: - containers: - - name: crates-migrate - image: registry.ntwl.xyz/crates-api - imagePullPolicy: IfNotPresent - command: ["npx"] - args: ["prisma", "migrate", "deploy"] - env: - - name: DATABASE_URL - valueFrom: - secretKeyRef: - name: crates - key: DATABASE_URL + restartPolicy: OnFailure + containers: + - name: crates-migrate + image: registry.ntwl.xyz/crates-api + imagePullPolicy: IfNotPresent + command: ["npx"] + args: ["prisma", "migrate", "deploy"] + env: + - name: DATABASE_URL + valueFrom: + secretKeyRef: + name: crates + key: DATABASE_URL --- diff --git a/spacerace/spacerace.yaml b/spacerace/spacerace.yaml index 34b7303..57af904 100644 --- a/spacerace/spacerace.yaml +++ b/spacerace/spacerace.yaml @@ -15,7 +15,7 @@ metadata: kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: spacerace-postgres-pvc + name: spacerace-postgres-data namespace: spacerace spec: storageClassName: zfs-fast @@ -27,6 +27,20 @@ spec: --- +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: spacerace-postgres-bootstrap + namespace: spacerace +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + +--- + # ----------------------------------------------------------------------- # DEPLOYMENTS # ----------------------------------------------------------------------- @@ -70,41 +84,46 @@ spec: volumeMounts: - name: spacerace-postgres-storage mountPath: /var/lib/postgresql/data + - name: spacerace-postgres-bootstrap + mountPath: /docker-entrypoint-initdb.d volumes: - name: spacerace-postgres-storage persistentVolumeClaim: - claimName: spacerace-postgres-pvc + claimName: spacerace-postgres-data + - name: spacerace-postgres-bootstrap + persistentVolumeClaim: + claimName: spacerace-postgres-bootstrap --- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: spacerace-api - namespace: spacerace -spec: - replicas: 1 - selector: - matchLabels: - app: spacerace-api - template: - metadata: - labels: - app: spacerace-api - spec: - containers: - - name: spacerace-api - image: registry.ntwl.xyz/spacerace-api - imagePullPolicy: IfNotPresent - ports: - - containerPort: 80 - env: - - name: CONNECTIONSTRINGS__SPACERACE - valueFrom: - secretKeyRef: - name: spacerace - key: CONNECTIONSTRINGS__SPACERACE +# apiVersion: apps/v1 +# kind: Deployment +# metadata: +# name: spacerace-api +# namespace: spacerace +# spec: +# replicas: 1 +# selector: +# matchLabels: +# app: spacerace-api +# template: +# metadata: +# labels: +# app: spacerace-api +# spec: +# containers: +# - name: spacerace-api +# image: registry.ntwl.xyz/spacerace-api +# imagePullPolicy: IfNotPresent +# ports: +# - containerPort: 80 +# env: +# - name: CONNECTIONSTRINGS__SPACERACE +# valueFrom: +# secretKeyRef: +# name: spacerace +# key: CONNECTIONSTRINGS__SPACERACE --- # -----------------------------------------------------------------------