Files
Mikael BergandPaperclip 5ec56f20d5 feat: k8s manifests, Plausible self-host, Dockerfile, CI, and deploy runbook for using.cash
- 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>
2026-05-20 13:56:07 +00:00

116 lines
2.6 KiB
YAML

---
apiVersion: v1
kind: ConfigMap
metadata:
name: clickhouse-config
namespace: analytics
data:
# Plausible CE requires this ClickHouse config for event storage
clickhouse-config.xml: |
<clickhouse>
<logger>
<level>warning</level>
<console>true</console>
</logger>
<query_log remove="remove"/>
<query_thread_log remove="remove"/>
<part_log remove="remove"/>
<trace_log remove="remove"/>
<text_log remove="remove"/>
<metric_log remove="remove"/>
<asynchronous_metric_log remove="remove"/>
<session_log remove="remove"/>
<zookeeper_log remove="remove"/>
</clickhouse>
clickhouse-user-config.xml: |
<clickhouse>
<profiles>
<default>
<log_queries>0</log_queries>
<log_query_threads>0</log_query_threads>
</default>
</profiles>
</clickhouse>
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: clickhouse
namespace: analytics
labels:
app: clickhouse
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: clickhouse
template:
metadata:
labels:
app: clickhouse
spec:
containers:
- name: clickhouse
image: clickhouse/clickhouse-server:24.3-alpine
ports:
- containerPort: 8123
name: http
- containerPort: 9000
name: native
resources:
requests:
cpu: 200m
memory: 512Mi
limits:
cpu: 1000m
memory: 2Gi
volumeMounts:
- name: data
mountPath: /var/lib/clickhouse
- name: config
mountPath: /etc/clickhouse-server/config.d/logging.xml
subPath: clickhouse-config.xml
- name: config
mountPath: /etc/clickhouse-server/users.d/logging.xml
subPath: clickhouse-user-config.xml
livenessProbe:
httpGet:
path: /ping
port: 8123
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /ping
port: 8123
initialDelaySeconds: 5
periodSeconds: 5
volumes:
- name: data
persistentVolumeClaim:
claimName: clickhouse-data
- name: config
configMap:
name: clickhouse-config
---
apiVersion: v1
kind: Service
metadata:
name: clickhouse
namespace: analytics
labels:
app: clickhouse
spec:
type: ClusterIP
selector:
app: clickhouse
ports:
- name: http
port: 8123
targetPort: 8123
- name: native
port: 9000
targetPort: 9000