Skip to content

Commit

Permalink
[ADD] set extraEnv, secret, refactoring
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit d06032e
Author: Alexandre Nuttinck <alexandre.nuttinck@imio.be>
Date:   Thu Aug 24 16:48:26 2023 +0200

    update chart

commit 581e5bc
Author: Alexandre Nuttinck <alexandre.nuttinck@imio.be>
Date:   Thu Aug 24 13:55:47 2023 +0200

    [MOD] fix lint errors

commit aeec37a
Author: Alexandre Nuttinck <alexandre.nuttinck@imio.be>
Date:   Thu Aug 24 11:20:52 2023 +0200

    [MOD] fix typo in gh action

commit af41099
Author: Alexandre Nuttinck <alexandre.nuttinck@imio.be>
Date:   Thu Aug 24 10:58:37 2023 +0200

    test gh action

commit 6875a6d
Author: Alexandre Nuttinck <alexandre.nuttinck@imio.be>
Date:   Thu Aug 24 10:54:54 2023 +0200

    [MOD] typo in gh action

commit 0c2705f
Author: Alexandre Nuttinck <alexandre.nuttinck@imio.be>
Date:   Thu Aug 24 10:52:28 2023 +0200

    [ADD] charts-dir and chart in gh action

commit fa53164
Author: Alexandre Nuttinck <alexandre.nuttinck@imio.be>
Date:   Thu Aug 24 10:42:08 2023 +0200

    add secret create option

commit a45a5b7
Author: Alexandre Nuttinck <alexandre.nuttinck@imio.be>
Date:   Thu Aug 24 09:31:24 2023 +0200

    [ADD] extraEnv + some refactoring
  • Loading branch information
alexnuttinck committed Aug 24, 2023
1 parent b90c8ef commit 6cac8b5
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 58 deletions.
15 changes: 2 additions & 13 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,12 @@ jobs:
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.4.0

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
run: ct lint --chart-dirs . --charts . --target-branch ${{ github.event.repository.default_branch }}

- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/kind-action@v1.7.0

- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --target-branch ${{ github.event.repository.default_branch }}
run: ct install --chart-dirs . --charts . --target-branch ${{ github.event.repository.default_branch }}

6 changes: 3 additions & 3 deletions Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v2
name: plausible-analytics
description: A Helm Chart for Plausible Analytics - Simple, open-source, lightweight (< 1 KB) and privacy-friendly web analytics alternative to Google Analytics.
type: application
version: 0.1.0
version: 0.1.1
appVersion: 2.0.0
keywords:
- web analytics
Expand All @@ -25,6 +25,6 @@ dependencies:
condition: postgresql.enabled
- name: clickhouse
alias: clickhouse
version: 3.6.8
version: 3.6.7
repository: https://charts.bitnami.com/bitnami
condition: clickhouse.enabled
condition: clickhouse.enabled
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ The following items can be set via `--set` flag during installation or configure

Feel free to modify the options in the [values.yaml file](values.yaml) before installation.

You will need to set the sensitive values in the values.yaml file before installing the chart. (Passwords and URL of the databases).

### Install the chart

```bash
Expand Down
24 changes: 18 additions & 6 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ spec:
command: ['sh', '-c', 'until pg_isready -h {{ .Values.postgresql.host }} -p {{ .Values.postgresql.port }} -U {{ .Values.postgresql.auth.username }}; do echo "Waiting for PostgreSQL to be ready..."; sleep 2; done;']
- name: wait-for-clickhouse
image: bitnami/clickhouse:23.3.9
command: ['sh', '-c', 'until clickhouse-client --host {{ .Values.clickhouse.host }} --port 9000 --user {{ .Values.clickhouse.auth.username }} --password {{ .Values.clickhouse.auth.password }} --query "SELECT version()"; do echo "Waiting for ClickHouse to be ready..."; sleep 2; done;']
command: ['sh', '-c', 'until clickhouse-client --host {{ .Values.clickhouse.host }} --port 9000 --user {{ .Values.clickhouse.auth.username }} --password "$CLICKHOUSE_PASSWORD" --query "SELECT version()"; do echo "Waiting for ClickHouse to be ready..."; sleep 2; done;']
env:
- name: CLICKHOUSE_PASSWORD
valueFrom:
secretKeyRef:
key: CLICKHOUSE_PASSWORD
name: {{ include "plausible-analytics.fullname" . }}
containers:
- name: {{ .Chart.Name }}
securityContext:
Expand Down Expand Up @@ -62,47 +68,47 @@ spec:
key: ADMIN_USER_EMAIL
name: {{ include "plausible-analytics.fullname" . }}
{{- end }}
{{- if .Values.adminUser.email }}
{{- if .Values.adminUser.name }}
- name: ADMIN_USER_NAME
valueFrom:
secretKeyRef:
key: ADMIN_USER_NAME
name: {{ include "plausible-analytics.fullname" . }}
{{- end }}
{{- if .Values.adminUser.email }}
{{- if .Values.adminUser.password }}
- name: ADMIN_USER_PWD
valueFrom:
secretKeyRef:
key: ADMIN_USER_PWD
name: {{ include "plausible-analytics.fullname" . }}
{{- end }}
{{- if .Values.postgresql.enabled }}
{{- if .Values.postgresql.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 }}
{{- if .Values.clickhouse.auth.username }}
- name: CLICKHOUSE_USER
valueFrom:
secretKeyRef:
key: CLICKHOUSE_USER
name: {{ include "plausible-analytics.fullname" . }}
{{- end }}
{{- if .Values.clickhouse.auth.password }}
- name: CLICKHOUSE_PASSWORD
valueFrom:
secretKeyRef:
Expand Down Expand Up @@ -243,6 +249,12 @@ spec:
- name: http
containerPort: 8000
protocol: TCP
startupProbe:
httpGet:
path: /
port: http
failureThreshold: 30
periodSeconds: 5
livenessProbe:
httpGet:
path: /
Expand Down
2 changes: 1 addition & 1 deletion templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
7 changes: 4 additions & 3 deletions templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
{{- if .Values.secret.create -}}
apiVersion: v1
kind: Secret
metadata:
Expand Down Expand Up @@ -26,7 +26,7 @@ data:
{{- if .Values.clickhouse.auth.username }}
CLICKHOUSE_USER: {{ .Values.clickhouse.auth.username | toString | b64enc }}
{{- end }}
{{- if .Values.clickhouse.auth.password }}
{{- if .Values.clickhouse.auth.password }}
CLICKHOUSE_PASSWORD: {{ .Values.clickhouse.auth.password | toString | b64enc }}
{{- end }}
SECRET_KEY_BASE: {{ randAlphaNum 90 | toString | b64enc }}
Expand Down Expand Up @@ -82,4 +82,5 @@ data:
{{- end }}
{{- if .Values.geolocation.license_key }}
GEOIPUPDATE_LICENSE_KEY: {{ .Values.geolocation.license_key | toString | b64enc }}
{{- end }}
{{- end }}
{{- end }}
74 changes: 42 additions & 32 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,55 @@
# plausible analytics configuration
## see https://plausible.io/docs/self-hosting-configuration

disableAuth: false # Disables authentication completely, no registration, login will be shown.
disableRegistration: false # Disables registration of new users.
baseURL: http://plausible-analytics.local # The hosting url of the server, used for URL generation. In production systems, this should be your ingress host.
disableAuth: false # Disables authentication completely, no registration, login will be shown.
disableRegistration: false # Disables registration of new users.
baseURL: http://plausible-analytics.local # The hosting url of the server, used for URL generation. In production systems, this should be your ingress host.
listenIP: 0.0.0.0

adminUser:
email: admin@example.com # Admin user's email
name: Administrator # Display name admin user
password: secr3t # Admin user password
name: Administrator # Display name admin user
password: secr3t # Admin user password

# SECRET_KEY_BASE is Helm randAlphaNum 90

smtp: # Plausible uses and SMTP server to send transactional emails e.g. account activation, password reset, weekly reports, etc.
enabled: false # Enable/Disable SMTP functionality
smtp: # Plausible uses and SMTP server to send transactional emails e.g. account activation, password reset, weekly reports, etc.
enabled: false # Enable/Disable SMTP functionality
mailer:
emailAddress: # the email address of the email sender
emailAddress: # the email address of the email sender
adapter:
host: # The host address of your smtp server.
port: # The port of your smtp server.
username: # The username/email in case SMTP auth is enabled.
password: # The password in case SMTP auth is enabled.
host: # The host address of your smtp server.
port: # The port of your smtp server.
username: # The username/email in case SMTP auth is enabled.
password: # The password in case SMTP auth is enabled.
ssl:
enabled: false # If SSL is enabled for SMTP connection
retries: 2 # Number of retries to make until mailer gives up.
enabled: false # If SSL is enabled for SMTP connection
retries: 2 # Number of retries to make until mailer gives up.

postmark: #Alternatively, you can use Postmark to send transactional emails. In this case, use the following parameters:
postmark: # Alternatively, you can use Postmark to send transactional emails. In this case, use the following parameters:
apiKey:

geolocation: # MaxMind geolocation database#
enabled: false # Enable/Disable the automated fetch of
account_id: # Account/User ID from maxmind.com
license_key: # My License Key from maxmind.com
geolocation: # MaxMind geolocation database#
enabled: false # Enable/Disable the automated fetch of
account_id: # Account/User ID from maxmind.com
license_key: # My License Key from maxmind.com

# Google Search Integration
# See: https://docs.plausible.io/self-hosting-configuration#google-search-integration
google:
clientID: # The Client ID from the Google API Console for your Plausible Analytics project
clientSecret: # The Client Secret from the Google API Console for your Plausible Analytics project
#Twitter Integration
clientID: # The Client ID from the Google API Console for your Plausible Analytics project
clientSecret: # The Client Secret from the Google API Console for your Plausible Analytics project
# Twitter Integration
# https://docs.plausible.io/self-hosting-configuration#twitter-integration
twitter:
consumer:
key: # The API key from the Twitter Developer Portal
secret: # The API key secret from the Twitter Developer Portal
key: # The API key from the Twitter Developer Portal
secret: # The API key secret from the Twitter Developer Portal
access:
token: # The access token you generated in the steps above
secret: # The access token secret you generated in the steps above
token: # The access token you generated in the steps above
secret: # The access token secret you generated in the steps above

labels: {} # Extra Labels to apply on your k8s deployment
extraEnv: [] # Extra Env Variables that are passed down to plausible 1:1
labels: {} # Extra Labels to apply on your k8s deployment

# ------------------------------------------------------------------------------
# Postgresql:
Expand All @@ -66,9 +65,11 @@ postgresql:
## ref: https://github.com/bitnami/charts/blob/master/bitnami/postgresql/values.yaml
enabled: true
# The URL to the Postgres Database Connection String see -> https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
# url postgres://postgres:postgres@plausible-analytics-postgresql:5432/plausible_db
url: postgres://postgres:postgres@plausible-analytics-postgresql:5432/plausible_db
auth:
username: postgres
# check auth.existingSecret from https://github.com/bitnami/charts/tree/main/bitnami/postgresql
password: postgres
database: plausible_db
port: 5432
Expand All @@ -84,17 +85,19 @@ postgresql:
# Clickhouse:
# ------------------------------------------------------------------------------

clickhouse: # Clickhouse Database
clickhouse: # Clickhouse Database
enabled: true
# The URL Connection String to clickhouse DB see -> https://clickhouse.tech/docs/en/interfaces/http/
url: http://clickhouse:password@plausible-analytics-clickhouse:8123/plausible_events_db
auth:
username: clickhouse
# password: password or check auth.existingSecret from https://github.com/bitnami/charts/tree/main/bitnami/clickhouse
password: password
database: plausible_events_db
host: plausible-analytics-clickhouse
initdbScripts: {CREATE DATABASE IF NOT EXISTS plausible_events_db}

#CLICKHOUSE_DATABASE_URL=http://user:password@plausible-events-db.plausible:8123/plausible
initdbScripts:
db-init.sql: |
CREATE DATABASE IF NOT EXISTS plausible_events_db
# kubernetes ressources

Expand All @@ -110,6 +113,10 @@ imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

secret:
# Specifies if the helm chart should create a secret file
create: true

serviceAccount:
# Specifies whether a service account should be created
create: true
Expand Down Expand Up @@ -176,3 +183,6 @@ nodeSelector: {}
tolerations: []

affinity: {}

## Extra environment variables definition
extraEnv: []

0 comments on commit 6cac8b5

Please sign in to comment.