200 lines
4.0 KiB
YAML
200 lines
4.0 KiB
YAML
# -----------------------------------------------------------------------
|
|
# VOLUMES
|
|
# -----------------------------------------------------------------------
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
kind: PersistentVolume
|
|
metadata:
|
|
name: crates-postgres-pv
|
|
spec:
|
|
storageClassName: ""
|
|
capacity:
|
|
storage: 1Gi
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
persistentVolumeReclaimPolicy: Retain
|
|
claimRef:
|
|
namespace: default
|
|
name: crates-postgres-pvc
|
|
hostPath:
|
|
path: "/var/lib/rancher/k3s/storage/crates-postgres-pv"
|
|
type: DirectoryOrCreate
|
|
|
|
---
|
|
|
|
kind: PersistentVolumeClaim
|
|
apiVersion: v1
|
|
metadata:
|
|
name: crates-postgres-pvc
|
|
spec:
|
|
volumeName: crates-postgres-pv
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 1Gi
|
|
|
|
---
|
|
|
|
# -----------------------------------------------------------------------
|
|
# DEPLOYMENTS
|
|
# -----------------------------------------------------------------------
|
|
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: crates-postgres
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: crates-postgres
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: crates-postgres
|
|
spec:
|
|
containers:
|
|
- name: postgres
|
|
image: postgres:16
|
|
ports:
|
|
- containerPort: 5432
|
|
env:
|
|
- name: POSTGRES_DB
|
|
value: crates
|
|
- name: POSTGRES_USER
|
|
value: crates
|
|
- name: POSTGRES_PASSWORD
|
|
value: digdeep
|
|
volumeMounts:
|
|
- name: crates-postgres-storage
|
|
mountPath: /var/lib/postgresql/data
|
|
|
|
volumes:
|
|
- name: crates-postgres-storage
|
|
persistentVolumeClaim:
|
|
claimName: crates-postgres-pvc
|
|
|
|
---
|
|
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: crates-api
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: crates-api
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: crates-api
|
|
spec:
|
|
containers:
|
|
- name: crates-api
|
|
image: registry.strix.systems/crates-api
|
|
imagePullPolicy: IfNotPresent
|
|
ports:
|
|
- containerPort: 80
|
|
env:
|
|
- name: DATABASE_URL
|
|
value: 'postgresql://crates:digdeep@crates-postgres:5432/crates?schema=public'
|
|
- name: DISCORD_TOKEN
|
|
value: 'MTA3MjQ4OTgzMDE0NTA2NDk5MA.G4ZhOg.rFchS4vp0cNqHKuqubMFZSZCD15_E58MQhfDJo'
|
|
- name: DISCOGS_TOKEN
|
|
value: 'Discogs token=wRTXuYZGOPsIQgKRGKCAkUkidGtvpSfQgPWkYIpD'
|
|
- name: DISCORD_ENABLED
|
|
value: 'true'
|
|
|
|
---
|
|
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: crates-migrate
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: crates-migrate
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: crates-migrate
|
|
spec:
|
|
containers:
|
|
- name: crates-migrate
|
|
image: registry.strix.systems/crates-api
|
|
imagePullPolicy: IfNotPresent
|
|
command: ["npx"]
|
|
args: ["prisma", "migrate", "deploy"]
|
|
env:
|
|
- name: DATABASE_URL
|
|
value: 'postgresql://crates:digdeep@crates-postgres:5432/crates?schema=public'
|
|
|
|
---
|
|
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: crates-client
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: crates-client
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: crates-client
|
|
spec:
|
|
containers:
|
|
- name: crates-client
|
|
image: registry.strix.systems/crates-client
|
|
imagePullPolicy: IfNotPresent
|
|
ports:
|
|
- containerPort: 8080
|
|
|
|
---
|
|
|
|
# -----------------------------------------------------------------------
|
|
# SERVICES
|
|
# -----------------------------------------------------------------------
|
|
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: crates-api
|
|
spec:
|
|
selector:
|
|
app: crates-api
|
|
ports:
|
|
- port: 41337
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: crates-postgres
|
|
spec:
|
|
selector:
|
|
app: crates-postgres
|
|
ports:
|
|
- port: 5432
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: crates-client
|
|
spec:
|
|
selector:
|
|
app: crates-client
|
|
ports:
|
|
- port: 8080
|