Skip to content

Commit

Permalink
Merge pull request #1277 from christianhuth/dev-shlink
Browse files Browse the repository at this point in the history
Upgrade to v4 and rework the implementation of the configuration
  • Loading branch information
christianhuth authored Jan 31, 2025
2 parents ae19e7b + 6ece306 commit 8f0990c
Show file tree
Hide file tree
Showing 29 changed files with 1,899 additions and 249 deletions.
15 changes: 13 additions & 2 deletions charts/shlink-backend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# shlink-backend

## 4.5.5
## 5.0.0

### Added

- Changelog
- option to define image registry (image.registry)
- options to define the configuration (config.*)

### Changed

- app version to 4.4.0
- dependency to mariadb to 20.2.1
- dependency to mysql to 12.2.2
- dependency to postgresql to 16.4.5
- dependency to rabbitmq to 15.2.3
- dependency to redis to 20.6.3
- option to define additional environment variables (extraEnv)
42 changes: 29 additions & 13 deletions charts/shlink-backend/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: shlink-backend
description: A PHP-based self-hosted URL shortener that can be used to serve shortened URLs under your own domain.
type: application
version: 4.5.5
appVersion: "3.7.4"
version: 5.0.0
appVersion: "4.4.0"
home: https://github.com/christianhuth/helm-charts
icon: https://shlink.io/images/shlink-logo-blue.svg
maintainers:
Expand All @@ -14,29 +14,45 @@ sources:
- https://shlink.io
dependencies:
- name: mariadb
repository: https://charts.bitnami.com/bitnami
version: 16.5.0
repository: oci://registry-1.docker.io/bitnamicharts
version: 20.2.1
condition: mariadb.enabled
- name: mysql
repository: https://charts.bitnami.com/bitnami
version: 9.23.0
repository: oci://registry-1.docker.io/bitnamicharts
version: 12.2.2
condition: mysql.enabled
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 14.3.3
repository: oci://registry-1.docker.io/bitnamicharts
version: 16.4.5
condition: postgresql.enabled
- name: rabbitmq
repository: https://charts.bitnami.com/bitnami
version: 12.15.0
repository: oci://registry-1.docker.io/bitnamicharts
version: 15.2.3
condition: rabbitmq.enabled
- name: redis
repository: https://charts.bitnami.com/bitnami
version: 18.19.4
repository: oci://registry-1.docker.io/bitnamicharts
version: 20.6.3
condition: redis.enabled
annotations:
artifacthub.io/changes: |
- kind: changed
description: app version to 4.4.0
- kind: changed
description: dependency to mariadb to 20.2.1
- kind: changed
description: dependency to mysql to 12.2.2
- kind: changed
description: dependency to postgresql to 16.4.5
- kind: changed
description: dependency to rabbitmq to 15.2.3
- kind: changed
description: dependency to redis to 20.6.3
- kind: changed
description: option to define additional environment variables (extraEnv)
- kind: added
description: Changelog
description: option to define image registry (image.registry)
- kind: added
description: options to define the configuration (config.*)
artifacthub.io/signKey: |
fingerprint: EE24F8BB6D099E78FD704F83B5ECDBCDDD485D0E
url: https://charts.christianhuth.de/public.key
127 changes: 106 additions & 21 deletions charts/shlink-backend/README.md

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions charts/shlink-backend/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ helm install my-release -f values.yaml christianhuth/shlink-backend

## Upgrading the Chart

### To 5.0.0

This major updates the following dependencies:

- MariaDB to its newest major, 20.2.0: [Here](https://github.com/bitnami/charts/tree/main/bitnami/mariadb#to-2020) you can find more information about the changes introduced in that version.
- MySQL to its newest major, 12.2.0: [Here](https://github.com/bitnami/charts/tree/main/bitnami/mysql#to-1220) you can find more information about the changes introduced in that version.
- PostgreSQL to its newest major, 16.3.0: [Here](https://github.com/bitnami/charts/tree/main/bitnami/postgresql#to-1630) you can find more information about the changes introduced in that version.
- RabbitMQ to its newest major, 15.2.0: [Here](https://github.com/bitnami/charts/tree/main/bitnami/rabbitmq#to-1520) you can find more information about the changes introduced in that version.
- Redis to its newest major, 20.5.0: [Here](https://github.com/bitnami/charts/tree/main/bitnami/redis#to-2050) you can find more information about the changes introduced in that version.

It also upgrades the Shlink Backend to its newest major, 4.4.0 and introduces a new way to define the configuration using the `config.*` Values.
If you have been using the `env` attribute so far to configure Shlink it is strongly recommended to migrate to the corresponding `config.*` Value.
The `env` attribute further has been replaced by an `extraEnv` attribute.

### To 4.0.0

This major updates the PostgreSQL subchart to its newest major, 14.0.0. [Here](https://github.com/bitnami/charts/tree/master/bitnami/postgresql#to-1400) you can find more information about the changes introduced in that version.
Expand Down
1 change: 1 addition & 0 deletions charts/shlink-backend/ci/00-sqlite-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
3 changes: 3 additions & 0 deletions charts/shlink-backend/ci/01-mariadb-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
mariadb:
enabled: true
3 changes: 3 additions & 0 deletions charts/shlink-backend/ci/02-mysql-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
mysql:
enabled: true
3 changes: 3 additions & 0 deletions charts/shlink-backend/ci/03-postgresql-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
postgresql:
enabled: true
14 changes: 14 additions & 0 deletions charts/shlink-backend/ci/04-integrations-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
config:
matomo:
enabled: true
auth:
apiToken: "a-test-api-tokeen"
baseUrl: "my-matomo.com"
siteId: "SMj6N3zV5eK0Y8dO7TXG41I9LvfDoRl2"
mercure:
enabled: true
auth:
jwtSecret: "a-test-jwt-secret"
publicHubUrl: "my-public-mercure-hub.com"
internalHubUrl: "my-internal-mercure-hub.com"
5 changes: 5 additions & 0 deletions charts/shlink-backend/ci/05-rabbitmq-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
rabbitmq:
enabled: true
auth:
password: my-test-password
3 changes: 3 additions & 0 deletions charts/shlink-backend/ci/06-redis-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
redis:
enabled: true
144 changes: 144 additions & 0 deletions charts/shlink-backend/templates/database/_database.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
{{/*
Define the database driver
*/}}
{{- define "shlink-backend.database.driver" -}}
{{- $driver := "" -}}
{{- if .Values.mariadb.enabled -}}
{{- $driver = "maria" -}}
{{- else if .Values.mysql.enabled -}}
{{- $driver = "mysql" -}}
{{- else if .Values.postgresql.enabled -}}
{{- $driver = "postgres" -}}
{{- else -}}
{{- $driver = .Values.config.database.driver -}}
{{- end -}}
{{- if not $driver -}}
{{- fail "Unable to determine the database driver. Use config.database.driver or activate one of the integrated databases" -}}
{{- end -}}
{{- $driver -}}
{{- end }}

{{/*
Define the database host
*/}}
{{- define "shlink-backend.database.host" -}}
{{- $host := "" -}}
{{- if .Values.mariadb.enabled -}}
{{- $host = (include "mariadb.primary.fullname" .Subcharts.mariadb) -}}
{{- else if .Values.mysql.enabled -}}
{{- $host = (include "mysql.primary.fullname" .Subcharts.mysql) -}}
{{- else if .Values.postgresql.enabled -}}
{{- $host = (include "postgresql.v1.primary.fullname" .Subcharts.postgresql) -}}
{{- else -}}
{{- $host = .Values.config.database.host -}}
{{- end -}}
{{- if and (not $host) (not (eq (include "shlink-backend.database.driver" .) "sqlite")) -}}
{{- fail "Unable to determine the database host. Use config.database.host or activate one of the integrated databases" -}}
{{- end -}}
{{- $host -}}
{{- end }}

{{/*
Define the database port
*/}}
{{- define "shlink-backend.database.port" -}}
{{- $port := "" -}}
{{- if .Values.mariadb.enabled -}}
{{- $port = .Values.mariadb.primary.service.ports.mysql -}}
{{- else if .Values.mysql.enabled -}}
{{- $port = .Values.mysql.primary.service.ports.mysql -}}
{{- else if .Values.postgresql.enabled -}}
{{- $port = (include "postgresql.v1.service.port" .Subcharts.postgresql) -}}
{{- else -}}
{{- $port = .Values.config.database.port -}}
{{- end -}}
{{- if not $port -}}
{{- $driver := (include "shlink-backend.database.driver" .) -}}
{{- if (eq $driver "maria") -}}
{{- $port = 3306 -}}
{{- else if (eq $driver "mysql") -}}
{{- $port = 3306 -}}
{{- else if (eq $driver "postgres") -}}
{{- $port = 5432 -}}
{{- else if (eq $driver "sqlite") -}}
{{- $port = 0 -}}
{{- end -}}
{{- end -}}
{{- $port -}}
{{- end }}

{{/*
Define the database username
*/}}
{{- define "shlink-backend.database.auth.username" -}}
{{- $username := "" -}}
{{- if .Values.mariadb.enabled -}}
{{- $username = .Values.mariadb.auth.username -}}
{{- else if .Values.mysql.enabled -}}
{{- $username = .Values.mysql.auth.username -}}
{{- else if .Values.postgresql.enabled -}}
{{- $username = (include "postgresql.v1.username" .Subcharts.postgresql) -}}
{{- else -}}
{{- $username = .Values.config.database.auth.username -}}
{{- end -}}
{{- if not $username -}}
{{- fail "Unable to determine the database username. Use config.database.auth.username or activate one of the integrated databases" -}}
{{- end -}}
{{- $username -}}
{{- end }}

{{/*
Define the name of the database
*/}}
{{- define "shlink-backend.database.auth.database" -}}
{{- $database := "" -}}
{{- if .Values.mariadb.enabled -}}
{{- $database = .Values.mariadb.auth.database -}}
{{- else if .Values.mysql.enabled -}}
{{- $database = .Values.mysql.auth.database -}}
{{- else if .Values.postgresql.enabled -}}
{{- $database = (include "postgresql.v1.database" .Subcharts.postgresql) -}}
{{- else -}}
{{- $database = .Values.config.database.auth.database -}}
{{- end -}}
{{- if not $database -}}
{{- fail "Unable to determine the database name. Use config.database.auth.database or activate one of the integrated databases" -}}
{{- end -}}
{{- $database -}}
{{- end }}

{{/*
Get the name of the secret containing the database password
*/}}
{{- define "shlink-backend.database.auth.secretName" -}}
{{- $secretName := "" -}}
{{- if .Values.mariadb.enabled -}}
{{- $secretName = (include "mariadb.secretName" .Subcharts.mariadb) -}}
{{- else if .Values.mysql.enabled -}}
{{- $secretName = (include "mysql.secretName" .Subcharts.mysql) -}}
{{- else if .Values.postgresql.enabled -}}
{{- $secretName = (include "postgresql.v1.secretName" .Subcharts.postgresql) -}}
{{- else if .Values.config.database.auth.existingSecret -}}
{{- $secretName = .Values.config.database.auth.existingSecret -}}
{{- else -}}
{{- $secretName = printf "%s-database" (include "shlink-backend.fullname" .) -}}
{{- end -}}
{{- $secretName -}}
{{- end -}}

{{/*
Get the key of the secret containing the database password
*/}}
{{- define "shlink-backend.database.auth.secretKey" -}}
{{- $secretKey := "" -}}
{{- if .Values.mariadb.enabled -}}
{{- $secretKey = "mariadb-password" -}}
{{- else if .Values.mysql.enabled -}}
{{- $secretKey = "mysql-password" -}}
{{- else if .Values.postgresql.enabled -}}
{{- $secretKey = (include "postgresql.v1.userPasswordKey" .Subcharts.postgresql) -}}
{{- else -}}
{{- $secretKey = "database-password" -}}
{{- end -}}
{{- $secretKey -}}
{{- end -}}
11 changes: 11 additions & 0 deletions charts/shlink-backend/templates/database/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if and (not .Values.mariadb.enabled) (not .Values.mysql.enabled) (not .Values.postgresql.enabled) (not .Values.config.database.auth.existingSecret) -}}
---
apiVersion: v1
kind: Secret
metadata:
labels:
{{- include "shlink-backend.labels" . | nindent 4 }}
name: {{ include "shlink-backend.database.auth.secretName" . }}
data:
{{- include "shlink-backend.database.auth.secretKey" . | nindent 2 }}: {{ .Values.config.database.auth.password | b64enc }}
{{- end }}
Loading

0 comments on commit 8f0990c

Please sign in to comment.