- k8s/using-cash/: namespace, deployment (2 replicas, rolling), service, ingress - apex (using.cash) with Let's Encrypt TLS via cert-manager HTTP-01 - www.using.cash permanent-redirect → using.cash - app.using.cash placeholder ingress (DNS slot reserved for product app) - k8s/analytics/: Plausible CE + Postgres 16 + ClickHouse 24.3 with PVCs - stats.using.cash ingress with TLS - init containers wait for Postgres and ClickHouse before Plausible starts - Secrets created out-of-band; placeholder files document the kubectl commands - Dockerfile: multi-stage Next.js static export → nginx:alpine (port 8080, non-root) - nginx.conf: trailing-slash static export support, immutable asset caching, security headers - .gitea/workflows/deploy.yml: CI build→push→rollout on push to main - docs/deploy.md: first-apply checklist, DNS cutover procedure, rollback commands Co-Authored-By: Paperclip <noreply@paperclip.ing>
92 lines
1.9 KiB
YAML
92 lines
1.9 KiB
YAML
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: postgres-config
|
|
namespace: analytics
|
|
data:
|
|
POSTGRES_DB: plausible_db
|
|
POSTGRES_USER: plausible
|
|
---
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: postgres-secret
|
|
namespace: analytics
|
|
type: Opaque
|
|
stringData:
|
|
# Apply out-of-band: kubectl create secret generic postgres-secret \
|
|
# --from-literal=POSTGRES_PASSWORD="$(openssl rand -hex 32)" \
|
|
# -n analytics --dry-run=client -o yaml | kubectl apply -f -
|
|
POSTGRES_PASSWORD: REPLACE_WITH_STRONG_RANDOM_PASSWORD
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: postgres
|
|
namespace: analytics
|
|
labels:
|
|
app: postgres
|
|
spec:
|
|
replicas: 1
|
|
strategy:
|
|
type: Recreate
|
|
selector:
|
|
matchLabels:
|
|
app: postgres
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: postgres
|
|
spec:
|
|
containers:
|
|
- name: postgres
|
|
image: postgres:16-alpine
|
|
envFrom:
|
|
- configMapRef:
|
|
name: postgres-config
|
|
- secretRef:
|
|
name: postgres-secret
|
|
ports:
|
|
- containerPort: 5432
|
|
resources:
|
|
requests:
|
|
cpu: 100m
|
|
memory: 256Mi
|
|
limits:
|
|
cpu: 500m
|
|
memory: 512Mi
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /var/lib/postgresql/data
|
|
livenessProbe:
|
|
exec:
|
|
command: ["pg_isready", "-U", "plausible", "-d", "plausible_db"]
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
readinessProbe:
|
|
exec:
|
|
command: ["pg_isready", "-U", "plausible", "-d", "plausible_db"]
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 5
|
|
volumes:
|
|
- name: data
|
|
persistentVolumeClaim:
|
|
claimName: postgres-data
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: postgres
|
|
namespace: analytics
|
|
labels:
|
|
app: postgres
|
|
spec:
|
|
type: ClusterIP
|
|
selector:
|
|
app: postgres
|
|
ports:
|
|
- name: postgres
|
|
port: 5432
|
|
targetPort: 5432
|