Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace mariadb with galera #16

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ dependencies:
version: 20.0.5
repository: https://charts.bitnami.com/bitnami
condition: redis.enabled
- name: mariadb
version: 19.0.5
- name: mariadb-galera
version: 14.0.12
repository: https://charts.bitnami.com/bitnami
condition: mariadb.enabled
condition: mariadb-galera.enabled
- name: seaweedfs
version: 4.0.0
repository: https://seaweedfs.github.io/seaweedfs/helm
Expand Down
4 changes: 2 additions & 2 deletions templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
░░░░▒▓█████████▓▒░░░░░░░░░░██▓░░░░░░░░░▒██░░░░░░░░░░░░░░▓███████░░█▒░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
CTFd v{{ .Values.ctfd.image.tag | default .Chart.AppVersion }}
version: {{ .Values.ctfd.image.tag | default .Chart.AppVersion }}


{{ if or .Values.mariadb.enabled .Values.redis.enabled -}}
{{ if or (index .Values "mariadb-galera" "enabled") (.Values.redis.enabled) -}}
** Please be patient while MariaDB or Redis are being deployed **
{{ end }}

Expand Down
8 changes: 4 additions & 4 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ Create the name of the service account to use
{{- end }}

{{/*
Generate CTFd DATABASE_URL (internal bitnami mariadb or external self managed mariadb)
Generate CTFd DATABASE_URL (internal bitnami mariadb-galera or external self managed mariadb-galera)
*/}}
{{- define "ctfd.DATABASE_URL" -}}
{{- if .Values.mariadb.enabled -}}
mysql+pymysql://{{ .Values.mariadb.auth.username | default "ctfd" }}:{{ .Values.mariadb.auth.password | default "ctfd" }}@{{ .Release.Name }}-mariadb{{ if eq .Values.mariadb.architecture "replication" }}-primary{{ end }}/{{ .Values.mariadb.auth.database | default "ctfd" }}
{{- if index .Values "mariadb-galera" "enabled" -}}
mysql+pymysql://{{ index .Values "mariadb-galera" "db" "user" | default "ctfd" }}:{{ index .Values "mariadb-galera" "db" "password" | default "ctfd" }}@{{ .Release.Name }}-mariadb-galera/{{ index .Values "mariadb-galera" "db" "name"| default "ctfd" }}
{{- else -}}
mysql+pymysql://{{ .Values.mariadb.external.username }}:{{ .Values.mariadb.external.password }}@{{ .Values.mariadb.external.host }}/{{ .Values.mariadb.external.database }}
mysql+pymysql://{{ index .Values "mariadb-galera" "external" "username" }}:{{ index .Values "mariadb-galera" "external" "password" }}@{{ index .Values "mariadb-galera" "external" "host" }}/{{ index .Values "mariadb-galera" "external" "database" }}
{{- end -}}
{{- end -}}

Expand Down
54 changes: 21 additions & 33 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ctfd:

ingress:
# -- Enables ingress
enabled: false
enabled: true
# -- Ingress class
className: ""
# -- Ingress annotations
Expand All @@ -75,7 +75,7 @@ ctfd:
# kubernetes.io/tls-acme: "true"
# @ignored
hosts:
- host: ctfd.local
- host: ctfd.example.com
paths:
- path: /
pathType: ImplementationSpecific
Expand Down Expand Up @@ -182,16 +182,27 @@ ctfd:
name: ""

# Override the mariadb subchart values
mariadb:
# -- Deploys bitnami's mariadb (set to false if you want to use an external database)
mariadb-galera:
# -- Deploys bitnami's mariadb-galera (set to false if you want to use an external database)
enabled: true
# -- MariaDB Architecture (`standalone`, `replication`)
architecture: standalone
auth:
rootPassword: ctfd
username: ctfd
db:
user: ctfd
password: ctfd
database: ctfd
name: ctfd
galera:
mariabackup:
password: ctfd
rootUser:
password: ctfd
resourcesPreset: large
persistence:
enabled: true
size: 2Gi
# -- MariaDB primary entrypoint extra flags
# @default -- Check `values.yaml`. Used by official CTFd `docker-compose.yml`
extraFlags: "--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --wait_timeout=28800 --log-warnings=0"
metrics:
enabled: true # prometheus metrics exporter
# -- External database connection details. Takes effect if `mariadb.enabled` is set to false
# @default -- ignored
external:
Expand All @@ -200,29 +211,6 @@ mariadb:
username: ""
password: ""
database: ""
volumePermissions:
enabled: true # set to false if you want to manage the permissions yourself
primary:
# -- MariaDB primary entrypoint extra flags
# @default -- Check `values.yaml`. Used by official CTFd `docker-compose.yml`
extraFlags: "--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --wait_timeout=28800 --log-warnings=0"
# -- Check Bintami's documentation
resourcesPreset: small
persistence:
enabled: true
size: 2Gi
secondary:
# -- MariaDB primary entrypoint extra flags
# @default -- Check `values.yaml`. Used by official CTFd `docker-compose.yml`
extraFlags: "--character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --wait_timeout=28800 --log-warnings=0"
# -- Check Bintami's documentation
resourcesPreset: small
replicaCount: 1
persistence:
enabled: true
size: 2Gi
metrics:
enabled: true # prometheus metrics exporter

# Override the redis subchart values (I am considering the switch from redis to redis-ha)
redis:
Expand Down
Loading