--- apiVersion: v1 kind: ConfigMap metadata: name: plausible-config namespace: analytics data: BASE_URL: "https://stats.using.cash" DATABASE_URL: "postgres://plausible:$(POSTGRES_PASSWORD)@postgres.analytics.svc.cluster.local:5432/plausible_db" CLICKHOUSE_DATABASE_URL: "http://clickhouse.analytics.svc.cluster.local:8123/plausible_events_db" # No cookies, no banner — Plausible default DISABLE_REGISTRATION: "invite_only" --- apiVersion: apps/v1 kind: Deployment metadata: name: plausible namespace: analytics labels: app: plausible spec: replicas: 1 strategy: type: RollingUpdate rollingUpdate: maxUnavailable: 0 maxSurge: 1 selector: matchLabels: app: plausible template: metadata: labels: app: plausible spec: initContainers: # Wait for Postgres to be ready before starting Plausible - name: wait-for-postgres image: busybox:1.36 command: - sh - -c - | until nc -z postgres.analytics.svc.cluster.local 5432; do echo "waiting for postgres..."; sleep 2; done # Wait for ClickHouse to be ready before starting Plausible - name: wait-for-clickhouse image: busybox:1.36 command: - sh - -c - | until nc -z clickhouse.analytics.svc.cluster.local 8123; do echo "waiting for clickhouse..."; sleep 2; done containers: - name: plausible image: ghcr.io/plausible/community-edition:v2.1.4 command: ["/bin/sh", "-c", "/entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh run"] env: - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: postgres-secret key: POSTGRES_PASSWORD - name: DATABASE_URL value: "postgres://plausible:$(POSTGRES_PASSWORD)@postgres.analytics.svc.cluster.local:5432/plausible_db" - name: CLICKHOUSE_DATABASE_URL value: "http://clickhouse.analytics.svc.cluster.local:8123/plausible_events_db" - name: BASE_URL value: "https://stats.using.cash" - name: DISABLE_REGISTRATION value: "invite_only" envFrom: - secretRef: name: plausible-env ports: - containerPort: 8000 name: http resources: requests: cpu: 100m memory: 256Mi limits: cpu: 500m memory: 512Mi livenessProbe: httpGet: path: /api/health port: 8000 initialDelaySeconds: 30 periodSeconds: 15 failureThreshold: 5 readinessProbe: httpGet: path: /api/health port: 8000 initialDelaySeconds: 10 periodSeconds: 10 --- apiVersion: v1 kind: Service metadata: name: plausible namespace: analytics labels: app: plausible spec: type: ClusterIP selector: app: plausible ports: - name: http port: 80 targetPort: 8000 --- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: plausible namespace: analytics annotations: kubernetes.io/ingress.class: nginx cert-manager.io/cluster-issuer: letsencrypt-prod nginx.ingress.kubernetes.io/ssl-redirect: "true" nginx.ingress.kubernetes.io/force-ssl-redirect: "true" spec: tls: - hosts: - stats.using.cash secretName: plausible-tls rules: - host: stats.using.cash http: paths: - path: / pathType: Prefix backend: service: name: plausible port: number: 80