plausible-hosting/kubernetes/plausible.yaml

102 lines
3.0 KiB
YAML

apiVersion: v1
kind: Service
metadata:
name: plausible
labels:
app.kubernetes.io/name: plausible
app.kubernetes.io/component: server
spec:
type: LoadBalancer
ports:
- name: http
port: 8000
targetPort: 8000
protocol: TCP
selector:
app.kubernetes.io/name: plausible
app.kubernetes.io/component: server
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: plausible
labels:
app.kubernetes.io/name: plausible
app.kubernetes.io/component: server
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: plausible
app.kubernetes.io/component: server
template:
metadata:
labels:
app.kubernetes.io/name: plausible
app.kubernetes.io/component: server
spec:
restartPolicy: Always
containers:
- name: plausible
image: plausible/analytics:latest
imagePullPolicy: Always
args:
- /bin/sh
- -c
- sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh db init-admin && /entrypoint.sh run
ports:
- containerPort: 8000
envFrom:
- configMapRef:
name: plausible-config
env:
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: plausible-db-user
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: plausible-db-user
key: password
- name: CLICKHOUSE_USER
valueFrom:
secretKeyRef:
name: plausible-events-db-user
key: username
- name: CLICKHOUSE_PASSWORD
valueFrom:
secretKeyRef:
name: plausible-events-db-user
key: password
- name: DATABASE_URL
value: postgres://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@$(PLAUSIBLE_DB_SERVICE_HOST):$(PLAUSIBLE_DB_SERVICE_PORT)/plausible
- name: CLICKHOUSE_DATABASE_URL
value: http://$(CLICKHOUSE_USER):$(CLICKHOUSE_PASSWORD)@$(PLAUSIBLE_EVENTS_DB_SERVICE_HOST):$(PLAUSIBLE_EVENTS_DB_SERVICE_PORT)/plausible
- name: SMTP_HOST_ADDR
value: $(PLAUSIBLE_SMTP_SERVICE_HOST)
securityContext:
allowPrivilegeEscalation: false
resources:
limits:
memory: 2Gi
cpu: 1500m
requests:
memory: 200Mi
cpu: 250m
readinessProbe:
httpGet:
path: /api/health
port: 8000
initialDelaySeconds: 35
failureThreshold: 6
periodSeconds: 10
livenessProbe:
httpGet:
path: /api/health
port: 8000
initialDelaySeconds: 45
failureThreshold: 3
periodSeconds: 10