mirror of
https://github.com/hanzoai/bootnode.git
synced 2026-10-25 02:31:30 +00:00
- Add k8s configs for production deployment - Use shared postgres/datastore in hanzo namespace - Fix image registry to ghcr.io/hanzoai/bootnode - Add deploy script with shared infra support - Simplify compose.yml for local development
105 lines
2.4 KiB
YAML
105 lines
2.4 KiB
YAML
# Shared PostgreSQL for Hanzo services
|
|
# Deployed to hanzo namespace, used by bootnode and platform
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: postgres
|
|
namespace: hanzo
|
|
labels:
|
|
app: postgres
|
|
spec:
|
|
serviceName: postgres
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: postgres
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: postgres
|
|
spec:
|
|
containers:
|
|
- name: postgres
|
|
image: postgres:16-alpine
|
|
ports:
|
|
- containerPort: 5432
|
|
name: postgres
|
|
env:
|
|
- name: POSTGRES_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: postgres
|
|
key: username
|
|
- name: POSTGRES_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: postgres
|
|
key: password
|
|
- name: POSTGRES_DB
|
|
value: hanzo
|
|
- name: PGDATA
|
|
value: /var/lib/postgresql/data/pgdata
|
|
volumeMounts:
|
|
- name: postgres-data
|
|
mountPath: /var/lib/postgresql/data
|
|
resources:
|
|
requests:
|
|
cpu: "250m"
|
|
memory: "512Mi"
|
|
limits:
|
|
cpu: "1000m"
|
|
memory: "2Gi"
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- pg_isready
|
|
- -U
|
|
- hanzo
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
readinessProbe:
|
|
exec:
|
|
command:
|
|
- pg_isready
|
|
- -U
|
|
- hanzo
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 5
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: postgres-data
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
storageClassName: do-block-storage
|
|
resources:
|
|
requests:
|
|
storage: 20Gi
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: postgres
|
|
namespace: hanzo
|
|
labels:
|
|
app: postgres
|
|
spec:
|
|
type: ClusterIP
|
|
ports:
|
|
- port: 5432
|
|
targetPort: 5432
|
|
name: postgres
|
|
selector:
|
|
app: postgres
|
|
---
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: postgres
|
|
namespace: hanzo
|
|
type: Opaque
|
|
stringData:
|
|
username: hanzo
|
|
password: "${POSTGRES_PASSWORD}"
|
|
url: "postgresql+asyncpg://hanzo:${POSTGRES_PASSWORD}@postgres:5432/hanzo"
|
|
url-go: "postgres://hanzo:${POSTGRES_PASSWORD}@postgres:5432/hanzo"
|