mirror of
https://github.com/plausible/hosting.git
synced 2024-09-27 10:08:59 -05:00
Add Helm chart
This commit is contained in:
parent
445910ca62
commit
8388e00386
26
chart/README.org
Normal file
26
chart/README.org
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#+TITLE: Helm chart
|
||||||
|
|
||||||
|
* Installation
|
||||||
|
|
||||||
|
#+begin_src shell :pwd ./ :results silent
|
||||||
|
helm install plausible -n plausible \
|
||||||
|
--debug \
|
||||||
|
--set baseURL=http://localhost:8000 \
|
||||||
|
--set adminUser.email=myemail@example.com \
|
||||||
|
--set adminUser.name="Test User" \
|
||||||
|
--set adminUser.password="password" \
|
||||||
|
--set database.url="postgres://plausible:plausible@postgres/plausible?ssl=false" \
|
||||||
|
--set clickhouse.url="http://plausible-events-db:8123/plausible" \
|
||||||
|
--set disableRegistration=true \
|
||||||
|
--set disableAuth=true \
|
||||||
|
--set image.tag=dev \
|
||||||
|
plausible-analytics
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src shell :pwd ./
|
||||||
|
kubectl -n plausible get pods,svc
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src shell :pwd ./ :results silent
|
||||||
|
helm uninstall plausible -n plausible
|
||||||
|
#+end_src
|
23
chart/plausible-analytics/.helmignore
Normal file
23
chart/plausible-analytics/.helmignore
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Patterns to ignore when building packages.
|
||||||
|
# This supports shell glob matching, relative path matching, and
|
||||||
|
# negation (prefixed with !). Only one pattern per line.
|
||||||
|
.DS_Store
|
||||||
|
# Common VCS dirs
|
||||||
|
.git/
|
||||||
|
.gitignore
|
||||||
|
.bzr/
|
||||||
|
.bzrignore
|
||||||
|
.hg/
|
||||||
|
.hgignore
|
||||||
|
.svn/
|
||||||
|
# Common backup files
|
||||||
|
*.swp
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
*.orig
|
||||||
|
*~
|
||||||
|
# Various IDEs
|
||||||
|
.project
|
||||||
|
.idea/
|
||||||
|
*.tmproj
|
||||||
|
.vscode/
|
23
chart/plausible-analytics/Chart.yaml
Normal file
23
chart/plausible-analytics/Chart.yaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
apiVersion: v2
|
||||||
|
name: plausible-analytics
|
||||||
|
description: Simple and privacy-friendly alternative to Google Analytics
|
||||||
|
|
||||||
|
# A chart can be either an 'application' or a 'library' chart.
|
||||||
|
#
|
||||||
|
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||||
|
# to be deployed.
|
||||||
|
#
|
||||||
|
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||||
|
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||||
|
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||||
|
type: application
|
||||||
|
|
||||||
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
|
# to the chart and its templates, including the app version.
|
||||||
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
|
version: 0.0.1
|
||||||
|
|
||||||
|
# This is the version number of the application being deployed. This version number should be
|
||||||
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
|
appVersion: v1.1.1
|
21
chart/plausible-analytics/templates/NOTES.txt
Normal file
21
chart/plausible-analytics/templates/NOTES.txt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
1. Get the application URL by running these commands:
|
||||||
|
{{- if .Values.ingress.enabled }}
|
||||||
|
{{- range $host := .Values.ingress.hosts }}
|
||||||
|
{{- range .paths }}
|
||||||
|
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else if contains "NodePort" .Values.service.type }}
|
||||||
|
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "plausible-analytics.fullname" . }})
|
||||||
|
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||||
|
echo http://$NODE_IP:$NODE_PORT
|
||||||
|
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||||
|
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||||
|
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "plausible-analytics.fullname" . }}'
|
||||||
|
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "plausible-analytics.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||||
|
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||||
|
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||||
|
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "plausible-analytics.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||||
|
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||||
|
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
|
||||||
|
{{- end }}
|
62
chart/plausible-analytics/templates/_helpers.tpl
Normal file
62
chart/plausible-analytics/templates/_helpers.tpl
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
{{/*
|
||||||
|
Expand the name of the chart.
|
||||||
|
*/}}
|
||||||
|
{{- define "plausible-analytics.name" -}}
|
||||||
|
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create a default fully qualified app name.
|
||||||
|
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||||
|
If release name contains chart name it will be used as a full name.
|
||||||
|
*/}}
|
||||||
|
{{- define "plausible-analytics.fullname" -}}
|
||||||
|
{{- if .Values.fullnameOverride }}
|
||||||
|
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- else }}
|
||||||
|
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||||
|
{{- if contains $name .Release.Name }}
|
||||||
|
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- else }}
|
||||||
|
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create chart name and version as used by the chart label.
|
||||||
|
*/}}
|
||||||
|
{{- define "plausible-analytics.chart" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Common labels
|
||||||
|
*/}}
|
||||||
|
{{- define "plausible-analytics.labels" -}}
|
||||||
|
helm.sh/chart: {{ include "plausible-analytics.chart" . }}
|
||||||
|
{{ include "plausible-analytics.selectorLabels" . }}
|
||||||
|
{{- if .Chart.AppVersion }}
|
||||||
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||||
|
{{- end }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Selector labels
|
||||||
|
*/}}
|
||||||
|
{{- define "plausible-analytics.selectorLabels" -}}
|
||||||
|
app.kubernetes.io/name: {{ include "plausible-analytics.name" . }}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Create the name of the service account to use
|
||||||
|
*/}}
|
||||||
|
{{- define "plausible-analytics.serviceAccountName" -}}
|
||||||
|
{{- if .Values.serviceAccount.create }}
|
||||||
|
{{- default (include "plausible-analytics.fullname" .) .Values.serviceAccount.name }}
|
||||||
|
{{- else }}
|
||||||
|
{{- default "default" .Values.serviceAccount.name }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
319
chart/plausible-analytics/templates/deployment.yaml
Normal file
319
chart/plausible-analytics/templates/deployment.yaml
Normal file
@ -0,0 +1,319 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
labels:
|
||||||
|
app: plausible
|
||||||
|
{{- include "plausible-analytics.labels" . | nindent 4 }}
|
||||||
|
{{- if .Values.labels }}
|
||||||
|
{{- with .Values.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
annotations:
|
||||||
|
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
|
||||||
|
spec:
|
||||||
|
{{- if not .Values.autoscaling.enabled }}
|
||||||
|
replicas: {{ .Values.replicaCount }}
|
||||||
|
{{- end }}
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: plausible
|
||||||
|
{{- include "plausible-analytics.selectorLabels" . | nindent 6 }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
{{- with .Values.podAnnotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
labels:
|
||||||
|
app: plausible
|
||||||
|
{{- include "plausible-analytics.selectorLabels" . | nindent 8 }}
|
||||||
|
{{- if .Values.labels }}
|
||||||
|
{{- with .Values.labels }}
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- with .Values.imagePullSecrets }}
|
||||||
|
imagePullSecrets:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
serviceAccountName: {{ include "plausible-analytics.serviceAccountName" . }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||||
|
containers:
|
||||||
|
- name: {{ .Chart.Name }}
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
command:
|
||||||
|
- /entrypoint.sh
|
||||||
|
- run
|
||||||
|
env:
|
||||||
|
{{- if .Values.adminUser.email }}
|
||||||
|
- name: ADMIN_USER_EMAIL
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: ADMIN_USER_EMAIL
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.adminUser.email }}
|
||||||
|
- name: ADMIN_USER_NAME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: ADMIN_USER_NAME
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.adminUser.email }}
|
||||||
|
- name: ADMIN_USER_PWD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: ADMIN_USER_PWD
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.database.enabled }}
|
||||||
|
{{- if .Values.database.url }}
|
||||||
|
- name: DATABASE_URL
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: DATABASE_URL
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
- name: SECRET_KEY_BASE
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: SECRET_KEY_BASE
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- if .Values.clickhouse.enabled }}
|
||||||
|
{{- if .Values.clickhouse.url }}
|
||||||
|
- name: CLICKHOUSE_DATABASE_URL
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: CLICKHOUSE_DATABASE_URL
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.baseURL }}
|
||||||
|
- name: BASE_URL
|
||||||
|
value: {{ .Values.baseURL | toString | quote }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: {{ .Values.service.port }}
|
||||||
|
protocol: TCP
|
||||||
|
volumeMounts:
|
||||||
|
- name: app-tmp
|
||||||
|
mountPath: /app/tmp
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: http
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: http
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.resources | nindent 12 }}
|
||||||
|
initContainers:
|
||||||
|
- name: plausible-init
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -x
|
||||||
|
- -c
|
||||||
|
- /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh db init-admin
|
||||||
|
env:
|
||||||
|
{{- if .Values.adminUser.email }}
|
||||||
|
- name: ADMIN_USER_EMAIL
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: ADMIN_USER_EMAIL
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.adminUser.email }}
|
||||||
|
- name: ADMIN_USER_NAME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: ADMIN_USER_NAME
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.adminUser.email }}
|
||||||
|
- name: ADMIN_USER_PWD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: ADMIN_USER_PWD
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.database.enabled }}
|
||||||
|
{{- if .Values.database.url }}
|
||||||
|
- name: DATABASE_URL
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: DATABASE_URL
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
- name: SECRET_KEY_BASE
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: SECRET_KEY_BASE
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- if .Values.clickhouse.enabled }}
|
||||||
|
{{- if .Values.clickhouse.url }}
|
||||||
|
- name: CLICKHOUSE_DATABASE_URL
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: CLICKHOUSE_DATABASE_URL
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.disableAuth }}
|
||||||
|
- name: DISABLE_AUTH
|
||||||
|
value: {{ .Values.disableAuth | toString | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.disableRegistration }}
|
||||||
|
- name: DISABLE_REGISTRATION
|
||||||
|
value: {{ .Values.disableRegistration | toString | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.disableAuth }}
|
||||||
|
- name: BASE_URL
|
||||||
|
value: {{ .Values.baseURL | toString | quote }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.smtp.enabled }}
|
||||||
|
{{- if .Values.smtp.mailer.emailAddress }}
|
||||||
|
- name: MAILER_EMAIL
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: MAILER_EMAIL
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.smtp.adapter }}
|
||||||
|
- name: MAILER_ADAPTER
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: MAILER_ADAPTER
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.smtp.host }}
|
||||||
|
- name: SMTP_HOST_ADDR
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: SMTP_HOST_ADDR
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.smtp.port }}
|
||||||
|
- name: SMTP_HOST_PORT
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: SMTP_HOST_PORT
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.smtp.username }}
|
||||||
|
- name: SMTP_USER_NAME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: SMTP_USER_NAME
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.smtp.password }}
|
||||||
|
- name: SMTP_USER_PWD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: SMTP_USER_PWD
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.smtp.ssl.enabled }}
|
||||||
|
- name: SMTP_HOST_SSL_ENABLED
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: SMTP_HOST_SSL_ENABLED
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.smtp.retires }}
|
||||||
|
- name: SMTP_RETRIES
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: SMTP_HOST_SSL_ENABLED
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.google.clientID }}
|
||||||
|
- name: GOOGLE_CLIENT_ID
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: GOOGLE_CLIENT_ID
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.google.clientSecret }}
|
||||||
|
- name: GOOGLE_CLIENT_SECRET
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: GOOGLE_CLIENT_SECRET
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.twitter.consumer.key }}
|
||||||
|
- name: TWITTER_CONSUMER_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: TWITTER_CONSUMER_KEY
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.twitter.consumer.secret }}
|
||||||
|
- name: TWITTER_CONSUMER_SECRET
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: TWITTER_CONSUMER_SECRET
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.twitter.access.token }}
|
||||||
|
- name: TWITTER_ACCESS_TOKEN
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: TWITTER_ACCESS_TOKEN
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.twitter.access.secret }}
|
||||||
|
- name: TWITTER_ACCESS_TOKEN_SECRET
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: TWITTER_ACCESS_TOKEN_SECRET
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postmark.apiKey }}
|
||||||
|
- name: POSTMARK_API_KEY
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: POSTMARK_API_KEY
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.geoliteCountryDB }}
|
||||||
|
- name: GEOLITE2_COUNTRY_DB
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
key: GEOLITE2_COUNTRY_DB
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
{{- end }}
|
||||||
|
volumeMounts:
|
||||||
|
- name: app-tmp
|
||||||
|
mountPath: /app/tmp
|
||||||
|
{{- with .Values.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.affinity }}
|
||||||
|
affinity:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
volumes:
|
||||||
|
- name: app-tmp
|
||||||
|
emptyDir: {}
|
33
chart/plausible-analytics/templates/hpa.yaml
Normal file
33
chart/plausible-analytics/templates/hpa.yaml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{{- if .Values.autoscaling.enabled }}
|
||||||
|
apiVersion: autoscaling/v2beta1
|
||||||
|
kind: HorizontalPodAutoscaler
|
||||||
|
metadata:
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "plausible-analytics.labels" . | nindent 4 }}
|
||||||
|
{{- if .Values.labels }}
|
||||||
|
{{- with .Values.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
scaleTargetRef:
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||||
|
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||||
|
metrics:
|
||||||
|
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||||
|
- type: Resource
|
||||||
|
resource:
|
||||||
|
name: cpu
|
||||||
|
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||||
|
- type: Resource
|
||||||
|
resource:
|
||||||
|
name: memory
|
||||||
|
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
46
chart/plausible-analytics/templates/ingress.yaml
Normal file
46
chart/plausible-analytics/templates/ingress.yaml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{{- if .Values.ingress.enabled -}}
|
||||||
|
{{- $fullName := include "plausible-analytics.fullname" . -}}
|
||||||
|
{{- $svcPort := .Values.service.port -}}
|
||||||
|
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
|
||||||
|
apiVersion: networking.k8s.io/v1beta1
|
||||||
|
{{- else -}}
|
||||||
|
apiVersion: extensions/v1beta1
|
||||||
|
{{- end }}
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{ $fullName }}
|
||||||
|
labels:
|
||||||
|
{{- include "plausible-analytics.labels" . | nindent 4 }}
|
||||||
|
{{- if .Values.labels }}
|
||||||
|
{{- with .Values.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.ingress.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if .Values.ingress.tls }}
|
||||||
|
tls:
|
||||||
|
{{- range .Values.ingress.tls }}
|
||||||
|
- hosts:
|
||||||
|
{{- range .hosts }}
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
secretName: {{ .secretName }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
{{- range .Values.ingress.hosts }}
|
||||||
|
- host: {{ .host | quote }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
{{- range .paths }}
|
||||||
|
- path: {{ . }}
|
||||||
|
backend:
|
||||||
|
serviceName: {{ $fullName }}
|
||||||
|
servicePort: {{ $svcPort }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
75
chart/plausible-analytics/templates/secret.yaml
Normal file
75
chart/plausible-analytics/templates/secret.yaml
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
labels:
|
||||||
|
app: plausible
|
||||||
|
{{- include "plausible-analytics.labels" . | nindent 4 }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
{{- if .Values.adminUser.email }}
|
||||||
|
ADMIN_USER_EMAIL: {{ .Values.adminUser.email | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.adminUser.password }}
|
||||||
|
ADMIN_USER_PWD: {{ .Values.adminUser.password | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.adminUser.name }}
|
||||||
|
ADMIN_USER_NAME: {{ .Values.adminUser.name | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.database.url }}
|
||||||
|
DATABASE_URL: {{ .Values.database.url | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.clickhouse.url }}
|
||||||
|
CLICKHOUSE_DATABASE_URL: {{ .Values.clickhouse.url | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
SECRET_KEY_BASE: {{ randAlphaNum 90 | toString | b64enc }}
|
||||||
|
{{- if .Values.smtp.enabled }}
|
||||||
|
{{- if .Values.smtp.mailer.emailAddress }}
|
||||||
|
MAILER_EMAIL: {{ .Values.smtp.mailer.emailAddress | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.smtp.adapter }}
|
||||||
|
MAILER_ADAPTER: {{ .Values.smtp.mailer.adapter | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.smtp.host }}
|
||||||
|
SMTP_HOST_ADDR: {{ .Values.smtp.host | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.smtp.port }}
|
||||||
|
SMTP_HOST_PORT: {{ .Values.smtp.port | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.smtp.username }}
|
||||||
|
SMTP_USER_NAME: {{ .Values.smtp.username | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.smtp.password }}
|
||||||
|
SMTP_USER_PWD: {{ .Values.smtp.password | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.smtp.ssl.enabled }}
|
||||||
|
SMTP_HOST_SSL_ENABLED: {{ .Values.smtp.ssl.enabled | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.smtp.retries }}
|
||||||
|
SMTP_RETRIES: {{ .Values.smtp.retries | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.google.clientID }}
|
||||||
|
GOOGLE_CLIENT_ID: {{ .Values.google.clientID | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.google.clientSecret }}
|
||||||
|
GOOGLE_CLIENT_SECRET: {{ .Values.google.clientSecret | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.twitter.consumer.key }}
|
||||||
|
TWITTER_CONSUMER_KEY: {{ .Values.twitter.consumer.key | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.twitter.consumer.secret }}
|
||||||
|
TWITTER_CONSUMER_SECRET: {{ .Values.twitter.consumer.secret | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.twitter.access.token }}
|
||||||
|
TWITTER_ACCESS_TOKEN: {{ .Values.twitter.access.token | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.twitter.access.secret }}
|
||||||
|
TWITTER_ACCESS_TOKEN_SECRET: {{ .Values.twitter.access.secret | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.postmark.apiKey }}
|
||||||
|
POSTMARK_API_KEY: {{ .Values.postmark.apiKey | toString | b64enc }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.geoliteCountryDB }}
|
||||||
|
GEOLITE2_COUNTRY_DB: {{ .Values.geoliteCountryDB | toString | b64enc }}
|
||||||
|
{{- end }}
|
20
chart/plausible-analytics/templates/service.yaml
Normal file
20
chart/plausible-analytics/templates/service.yaml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: {{ include "plausible-analytics.fullname" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "plausible-analytics.labels" . | nindent 4 }}
|
||||||
|
{{- if .Values.labels }}
|
||||||
|
{{- with .Values.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
type: {{ .Values.service.type }}
|
||||||
|
ports:
|
||||||
|
- port: {{ .Values.service.port }}
|
||||||
|
targetPort: http
|
||||||
|
protocol: TCP
|
||||||
|
name: http
|
||||||
|
selector:
|
||||||
|
{{- include "plausible-analytics.selectorLabels" . | nindent 4 }}
|
17
chart/plausible-analytics/templates/serviceaccount.yaml
Normal file
17
chart/plausible-analytics/templates/serviceaccount.yaml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{{- if .Values.serviceAccount.create -}}
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: {{ include "plausible-analytics.serviceAccountName" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "plausible-analytics.labels" . | nindent 4 }}
|
||||||
|
{{- if .Values.labels }}
|
||||||
|
{{- with .Values.labels }}
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.serviceAccount.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
@ -0,0 +1,15 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: "{{ include "plausible-analytics.fullname" . }}-test-connection"
|
||||||
|
labels:
|
||||||
|
{{- include "plausible-analytics.labels" . | nindent 4 }}
|
||||||
|
annotations:
|
||||||
|
"helm.sh/hook": test-success
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: wget
|
||||||
|
image: busybox
|
||||||
|
command: ['wget']
|
||||||
|
args: ['{{ include "plausible-analytics.fullname" . }}:{{ .Values.service.port }}']
|
||||||
|
restartPolicy: Never
|
129
chart/plausible-analytics/values.yaml
Normal file
129
chart/plausible-analytics/values.yaml
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
# Default values for plausible-analytics.
|
||||||
|
# This is a YAML-formatted file.
|
||||||
|
# Declare variables to be passed into your templates.
|
||||||
|
|
||||||
|
disableAuth: false
|
||||||
|
disableRegistration: false
|
||||||
|
baseURL:
|
||||||
|
|
||||||
|
adminUser:
|
||||||
|
email:
|
||||||
|
name:
|
||||||
|
password:
|
||||||
|
|
||||||
|
# SECRET_KEY_BASE is Helm randAlphaNum 90
|
||||||
|
|
||||||
|
database:
|
||||||
|
enabled: true
|
||||||
|
url:
|
||||||
|
|
||||||
|
clickhouse:
|
||||||
|
enabled: true
|
||||||
|
url:
|
||||||
|
|
||||||
|
smtp:
|
||||||
|
enabled: true
|
||||||
|
mailer:
|
||||||
|
emailAddress:
|
||||||
|
adapter:
|
||||||
|
host:
|
||||||
|
port:
|
||||||
|
username:
|
||||||
|
password:
|
||||||
|
ssl:
|
||||||
|
enabled: false
|
||||||
|
retries: 2
|
||||||
|
|
||||||
|
postmark:
|
||||||
|
apiKey:
|
||||||
|
|
||||||
|
geoliteCountryDB:
|
||||||
|
|
||||||
|
google:
|
||||||
|
clientID:
|
||||||
|
clientSecret:
|
||||||
|
|
||||||
|
twitter:
|
||||||
|
consumer:
|
||||||
|
key:
|
||||||
|
secret:
|
||||||
|
access:
|
||||||
|
token:
|
||||||
|
secret:
|
||||||
|
|
||||||
|
labels: {}
|
||||||
|
extraEnv: []
|
||||||
|
|
||||||
|
replicaCount: 1
|
||||||
|
|
||||||
|
image:
|
||||||
|
repository: plausible/analytics
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
|
# Overrides the image tag whose default is the chart appVersion.
|
||||||
|
tag: ""
|
||||||
|
|
||||||
|
imagePullSecrets: []
|
||||||
|
nameOverride: ""
|
||||||
|
fullnameOverride: ""
|
||||||
|
|
||||||
|
serviceAccount:
|
||||||
|
# Specifies whether a service account should be created
|
||||||
|
create: false
|
||||||
|
# Annotations to add to the service account
|
||||||
|
annotations: {}
|
||||||
|
# The name of the service account to use.
|
||||||
|
# If not set and create is true, a name is generated using the fullname template
|
||||||
|
name: ""
|
||||||
|
|
||||||
|
podAnnotations: {}
|
||||||
|
|
||||||
|
podSecurityContext: {}
|
||||||
|
# fsGroup: 2000
|
||||||
|
|
||||||
|
securityContext:
|
||||||
|
readOnlyRootFilesystem: true
|
||||||
|
runAsNonRoot: true
|
||||||
|
runAsUser: 1000
|
||||||
|
runAsGroup: 1000
|
||||||
|
|
||||||
|
service:
|
||||||
|
type: ClusterIP
|
||||||
|
port: 8000
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: false
|
||||||
|
annotations: {}
|
||||||
|
# kubernetes.io/ingress.class: nginx
|
||||||
|
# kubernetes.io/tls-acme: "true"
|
||||||
|
hosts:
|
||||||
|
- host: chart-example.local
|
||||||
|
paths: []
|
||||||
|
tls: []
|
||||||
|
# - secretName: chart-example-tls
|
||||||
|
# hosts:
|
||||||
|
# - chart-example.local
|
||||||
|
|
||||||
|
resources: {}
|
||||||
|
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||||
|
# choice for the user. This also increases chances charts run on environments with little
|
||||||
|
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||||
|
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||||
|
# limits:
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
# requests:
|
||||||
|
# cpu: 100m
|
||||||
|
# memory: 128Mi
|
||||||
|
|
||||||
|
autoscaling:
|
||||||
|
enabled: false
|
||||||
|
minReplicas: 1
|
||||||
|
maxReplicas: 100
|
||||||
|
targetCPUUtilizationPercentage: 80
|
||||||
|
# targetMemoryUtilizationPercentage: 80
|
||||||
|
|
||||||
|
nodeSelector: {}
|
||||||
|
|
||||||
|
tolerations: []
|
||||||
|
|
||||||
|
affinity: {}
|
Loading…
Reference in New Issue
Block a user