Skip to content

Commit

Permalink
Merge pull request #360 from zekker6/plausible-analytics
Browse files Browse the repository at this point in the history
plausible-analytics: create a new chart
  • Loading branch information
zekker6 committed Feb 25, 2024
2 parents 4d6826d + 1d90f41 commit e5eaf16
Show file tree
Hide file tree
Showing 16 changed files with 1,261 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .ci/ct/ct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ lint-conf: .ci/ct/lintconf.yaml
remote: origin
target-branch: main

helm-extra-args: --timeout 600s
helm-extra-args: --timeout 180s

chart-dirs:
- charts/library
Expand All @@ -14,3 +14,4 @@ chart-repos:
- bitnami=https://charts.bitnami.com/bitnami
- zekker6=https://zekker6.github.io/helm-charts
- k8s-at-home-lib=https://library-charts.k8s-at-home.com
- sentry=https://sentry-kubernetes.github.io/charts
23 changes: 23 additions & 0 deletions charts/apps/plausible-analytics/.helmignore
Original file line number Diff line number Diff line change
@@ -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/
32 changes: 32 additions & 0 deletions charts/apps/plausible-analytics/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
annotations:
artifacthub.io/changes: |
- kind: added
description: initial release of chart fork
apiVersion: v2
appVersion: v2.0.0
dependencies:
- condition: clickhouse.enabled
name: clickhouse
repository: https://sentry-kubernetes.github.io/charts
version: 3.5.0
- condition: postgresql.enabled
name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 12.12.10
description: A Helm Chart for Plausible Analytics - a simple and privacy-friendly alternative to Google Analytics
home: https://plausible.io/
icon: https://docs.plausible.io/img/logo.svg
keywords:
- plausible analytics
- analytics
maintainers:
- name: zekker6
email: zekker6@gmail.com
url: https://github.com/zekker6/
name: plausible-analytics
sources:
- https://github.com/zekker6/helm-charts/tree/main/charts/apps/plausible-analytics
- https://hub.docker.com/r/plausible/analytics
- https://github.com/plausible/analytics
type: application
version: 0.0.1
152 changes: 152 additions & 0 deletions charts/apps/plausible-analytics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# plausible-analytics

![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.0.0](https://img.shields.io/badge/AppVersion-v2.0.0-informational?style=flat-square)

A Helm Chart for Plausible Analytics - a simple and privacy-friendly alternative to Google Analytics

**This chart is not maintained by the upstream project and any issues with the chart should be raised [here](https://github.com/zekker6/helm-charts/issues/new)**

Chart was originally created and maintained by [Varac](https://varac.net) [here](https://0xacab.org/varac-projects/plausible-helm-chart).

This chart uses v2.0.0 version of Plausible Analytics. See release notes to learn more about upgrade steps: https://github.com/plausible/analytics/releases/tag/v2.0.0

## Source Code

* <https://github.com/zekker6/helm-charts/tree/main/charts/apps/plausible-analytics>
* <https://hub.docker.com/r/plausible/analytics>
* <https://github.com/plausible/analytics>

## Requirements

## Dependencies

| Repository | Name | Version |
|------------|------|---------|
| https://charts.bitnami.com/bitnami | postgresql | 12.12.10 |
| https://sentry-kubernetes.github.io/charts | clickhouse | 3.5.0 |

## TL;DR

```console
helm repo add zekker6 https://zekker6.github.io/helm-charts/
helm repo update
helm install plausible-analytics zekker6/plausible-analytics
```

## Installing the Chart

To install the chart with the release name `plausible-analytics`

```console
helm install plausible-analytics zekker6/plausible-analytics
```

## Uninstalling the Chart

To uninstall the `plausible-analytics` deployment

```console
helm uninstall plausible-analytics
```

The command removes all the Kubernetes components associated with the chart **including persistent volumes** and deletes the release.

## Configuration

Read through the [values.yaml](./values.yaml) file. It has several commented out suggested values.
Other values may be used from the [values.yaml](https://github.com/zekker6/helm-charts/blob/main/charts/library/common/values.yaml) from the [common library](https://github.com/zekker6/helm-charts/blob/main/charts/library/common).

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.

```console
helm install plausible-analytics \
--set env.TZ="America/New York" \
zekker6/plausible-analytics
```

Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart.

```console
helm install plausible-analytics zekker6/plausible-analytics -f values.yaml
```

## Custom configuration

N/A

## Values

**Important**: When deploying an application Helm chart you can add more values from our common library chart [here](https://github.com/zekker6/helm-charts/blob/main/charts/library/common)

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| autoscaling.enabled | bool | `false` | |
| autoscaling.maxReplicas | int | `100` | |
| autoscaling.minReplicas | int | `1` | |
| autoscaling.targetCPUUtilizationPercentage | int | `80` | |
| baseURL | string | `"http://example.com"` | The hosting url of the server, used for URL generation. In production systems, this should be your ingress host. |
| clickhouse | object | `{"clickhouse":{"image":"clickhouse/clickhouse-server","imageVersion":"22.6-alpine","replicas":1},"enabled":true}` | Clickhouse Database |
| clickhouse.clickhouse | object | `{"image":"clickhouse/clickhouse-server","imageVersion":"22.6-alpine","replicas":1}` | Sub-chart values, see https://artifacthub.io/packages/helm/sentry/clickhouse |
| clickhouse.clickhouse.image | string | `"clickhouse/clickhouse-server"` | Latest sentry/clickhouse chart ships 19.14, which doesn't work together with latest plausible https://artifacthub.io/packages/helm/sentry/clickhouse https://hub.docker.com/r/clickhouse/clickhouse-server/tags |
| disableAuth | bool | `false` | Disables authentication completely, no registration, login will be shown. |
| disableRegistration | bool | `false` | Disables registration of new users, keep your admin credentials handy ;) |
| extraEnv | list | `[]` | Extra Env Variables that are passed down to plausible 1:1 |
| fullnameOverride | string | `""` | |
| geolocation.account_id | string | `nil` | Account/User ID from maxmind.com |
| geolocation.enabled | bool | `false` | Enable/Disable the automated fetch of |
| geolocation.license_key | string | `nil` | My License Key from maxmind.com |
| google | object | `{"clientID":null,"clientSecret":null}` | Google Search Integration See: https://docs.plausible.io/self-hosting-configuration#google-search-integration |
| google.clientID | string | `nil` | The Client ID from the Google API Console for your Plausible Analytics project |
| google.clientSecret | string | `nil` | The Client Secret from the Google API Console for your Plausible Analytics project |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"plausible/analytics"` | |
| imagePullSecrets | list | `[]` | |
| ingress.annotations | object | `{}` | |
| ingress.enabled | bool | `false` | |
| ingress.hosts[0].host | string | `"chart-example.local"` | |
| ingress.hosts[0].paths | list | `[]` | |
| ingress.tls | list | `[]` | |
| labels | object | `{}` | Extra Labels to apply on your k8s deployment |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | |
| podSecurityContext | object | `{}` | |
| postgresql | object | `{"auth":{"database":"plausible","postgresPassword":"b8f1ad468e00b344b2c6bf495c4ffc28"},"enabled":true}` | Postgres Database |
| postgresql.auth | object | `{"database":"plausible","postgresPassword":"b8f1ad468e00b344b2c6bf495c4ffc28"}` | Sub-chart values, see https://artifacthub.io/packages/helm/bitnami/postgresql The URL to the Postgres Database Connection String see -> https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING |
| postmark | object | `{"apiKey":null}` | Alternatively, you can use Postmark to send transactional emails |
| replicaCount | int | `1` | |
| resources | object | `{}` | |
| secretKey | string | `""` | Secret key to be used for encryption. IF no value is provided random string will be generated during release. |
| securityContext | object | `{}` | |
| service.port | int | `80` | |
| service.type | string | `"ClusterIP"` | |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
| smtp | object | `{"enabled":false,"host":null,"mailer":{"adapter":null,"emailAddress":null},"password":null,"port":null,"retries":2,"ssl":{"enabled":false},"username":null}` | Plausible uses and SMTP server to send transactional emails e.g. account activation, password reset, weekly reports, etc. |
| smtp.enabled | bool | `false` | Enable/Disable SMTP functionality |
| smtp.host | string | `nil` | The host address of your smtp server. |
| smtp.mailer.emailAddress | string | `nil` | The email address of the email sender |
| smtp.password | string | `nil` | The password in case SMTP auth is enabled. |
| smtp.port | string | `nil` | The port of your smtp server. |
| smtp.ssl.enabled | bool | `false` | If SSL is enabled for SMTP connection |
| smtp.username | string | `nil` | The username/email in case SMTP auth is enabled. |
| tolerations | list | `[]` | |
| twitter | object | `{"access":{"secret":null,"token":null},"consumer":{"key":null,"secret":null}}` | Twitter Integration https://docs.plausible.io/self-hosting-configuration#twitter-integration |
| twitter.access.secret | string | `nil` | The access token secret you generated in the steps above |
| twitter.access.token | string | `nil` | The access token you generated in the steps above |
| twitter.consumer.key | string | `nil` | The API key from the Twitter Developer Portal |
| twitter.consumer.secret | string | `nil` | The API key secret from the Twitter Developer Portal |

### Older versions

A historical overview of changes can be found on [ArtifactHUB](https://artifacthub.io/packages/helm/zekker6/plausible-analytics?modal=changelog)

## Support

- See the [Docs](http://zekker6.github.io/helm-charts/docs/)
- Open an [issue](https://github.com/zekker6/helm-charts/issues/new)

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
18 changes: 18 additions & 0 deletions charts/apps/plausible-analytics/README_CONFIG.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{- define "custom.custom.notes" -}}
Chart was originally created and maintained by [Varac](https://varac.net) [here](https://0xacab.org/varac-projects/plausible-helm-chart).

This chart uses v2.0.0 version of Plausible Analytics. See release notes to learn more about upgrade steps: https://github.com/plausible/analytics/releases/tag/v2.0.0
{{- end -}}

{{- define "custom.custom.notes" -}}
{{- end -}}

{{- define "custom.custom.configuration.header" -}}
## Custom configuration
{{- end -}}

{{- define "custom.custom.configuration" -}}
{{ template "custom.custom.configuration.header" . }}

N/A
{{- end -}}
21 changes: 21 additions & 0 deletions charts/apps/plausible-analytics/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -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 changes: 62 additions & 0 deletions charts/apps/plausible-analytics/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -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 }}
Loading

0 comments on commit e5eaf16

Please sign in to comment.