mirror of
https://github.com/plausible/hosting.git
synced 2024-11-15 04:15:58 -06:00
151 lines
4.1 KiB
YAML
151 lines
4.1 KiB
YAML
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: plausible-events-db
|
|
labels:
|
|
app.kubernetes.io/name: clickhouse
|
|
app.kubernetes.io/component: database
|
|
app.kubernetes.io/part-of: plausible
|
|
spec:
|
|
type: ClusterIP
|
|
ports:
|
|
- name: db
|
|
port: 8123
|
|
targetPort: 8123
|
|
protocol: TCP
|
|
selector:
|
|
app.kubernetes.io/name: clickhouse
|
|
app.kubernetes.io/component: database
|
|
app.kubernetes.io/part-of: plausible
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: plausible-events-db-config
|
|
data:
|
|
clickhouse-config.xml: |
|
|
<yandex>
|
|
<logger>
|
|
<level>warning</level>
|
|
<console>true</console>
|
|
</logger>
|
|
|
|
<!-- Stop all the unnecessary logging -->
|
|
<query_thread_log remove="remove"/>
|
|
<query_log remove="remove"/>
|
|
<text_log remove="remove"/>
|
|
<trace_log remove="remove"/>
|
|
<metric_log remove="remove"/>
|
|
<asynchronous_metric_log remove="remove"/>
|
|
</yandex>
|
|
clickhouse-user-config.xml: |
|
|
<yandex>
|
|
<profiles>
|
|
<default>
|
|
<log_queries>0</log_queries>
|
|
<log_query_threads>0</log_query_threads>
|
|
</default>
|
|
</profiles>
|
|
</yandex>
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: plausible-events-db
|
|
labels:
|
|
app.kubernetes.io/name: clickhouse
|
|
app.kubernetes.io/component: database
|
|
app.kubernetes.io/part-of: plausible
|
|
spec:
|
|
replicas: 1
|
|
serviceName: plausible-events-db
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: clickhouse
|
|
app.kubernetes.io/component: database
|
|
app.kubernetes.io/part-of: plausible
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: clickhouse
|
|
app.kubernetes.io/component: database
|
|
app.kubernetes.io/part-of: plausible
|
|
spec:
|
|
restartPolicy: Always
|
|
# see https://github.com/ClickHouse/ClickHouse/blob/master/docker/server/Dockerfile
|
|
securityContext:
|
|
runAsUser: 101
|
|
runAsGroup: 101
|
|
fsGroup: 101
|
|
containers:
|
|
- name: plausible-events-db
|
|
image: yandex/clickhouse-server:latest
|
|
imagePullPolicy: Always
|
|
ports:
|
|
- containerPort: 8123
|
|
volumeMounts:
|
|
- name: data
|
|
mountPath: /var/lib/clickhouse
|
|
- name: config
|
|
mountPath: /etc/clickhouse-server/config.d/logging.xml
|
|
subPath: clickhouse-config.xml
|
|
readOnly: true
|
|
- name: config
|
|
mountPath: /etc/clickhouse-server/users.d/logging.xml
|
|
subPath: clickhouse-user-config.xml
|
|
readOnly: true
|
|
env:
|
|
- name: CLICKHOUSE_DB
|
|
value: plausible
|
|
- name: CLICKHOUSE_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: plausible-events-db-user
|
|
key: username
|
|
- name: CLICKHOUSE_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: plausible-events-db-user
|
|
key: password
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
resources:
|
|
limits:
|
|
memory: 2Gi
|
|
cpu: 1500m
|
|
requests:
|
|
memory: 80Mi
|
|
cpu: 10m
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /ping
|
|
port: 8123
|
|
initialDelaySeconds: 20
|
|
failureThreshold: 6
|
|
periodSeconds: 10
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /ping
|
|
port: 8123
|
|
initialDelaySeconds: 30
|
|
failureThreshold: 3
|
|
periodSeconds: 10
|
|
volumes:
|
|
- name: config
|
|
configMap:
|
|
name: plausible-events-db-config
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: data
|
|
labels:
|
|
app.kubernetes.io/name: clickhouse
|
|
app.kubernetes.io/component: database
|
|
app.kubernetes.io/part-of: plausible
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
resources:
|
|
requests:
|
|
storage: 128Mi
|
|
limits:
|
|
storage: 20Gi
|