Skip to content

Commit

Permalink
include redis-ha
Browse files Browse the repository at this point in the history
  • Loading branch information
tamcore committed Dec 9, 2023
1 parent 495ec71 commit 24acf83
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 5 deletions.
7 changes: 5 additions & 2 deletions charts/traccar/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ dependencies:
- name: mysql
repository: https://charts.bitnami.com/bitnami
version: 9.4.8
digest: sha256:c54ca45ec9055b33d96c582be62d5c4afd9501f2edfee0afaa73876b7ae13cfa
generated: "2023-01-28T11:57:35.495179799+01:00"
- name: redis-ha
repository: https://dandydeveloper.github.io/charts
version: 4.23.0
digest: sha256:91b7dd321c826a5721204763f11ac8a641c60cc23690250ca2eecd8c368cdac8
generated: "2023-12-09T13:20:23.900368+01:00"
4 changes: 4 additions & 0 deletions charts/traccar/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ dependencies:
version: 9.4.8
repository: https://charts.bitnami.com/bitnami
condition: mysql.enabled
- name: redis-ha
version: 4.23.0
repository: https://dandydeveloper.github.io/charts
condition: redis-ha.enabled
maintainers:
- email: laszlo.kondas@gmail.com
name: kondas
14 changes: 14 additions & 0 deletions charts/traccar/ci/ha-with-redis-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
replicaCount: 2

deploymentStrategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate

redis-ha:
enabled: true
# defaults to 3. but we wan't CI to run through in a reasonable time.
replicas: 1
haproxy:
replicas: 1
4 changes: 4 additions & 0 deletions charts/traccar/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,10 @@ data:
<entry key='notificator.telegram.sendLocation'>{{ .Values.traccar.notificator.telegram.sendLocation }}</entry>
{{- end }}
{{- end }}
{{- end }}
{{- if (index .Values "redis-ha").enabled }}
<entry key='broadcast.type'>redis</entry>
<entry key='broadcast.address'>redis://{{ include "traccar.fullname" . }}-redis-ha-haproxy:6379</entry>
{{- end }}
</properties>
{{- end }}
17 changes: 15 additions & 2 deletions charts/traccar/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ spec:
- name: config
configMap:
name: {{ include "traccar.fullname" . }}
{{- if or .Values.mysql.enabled .Values.initContainers }}
{{- if or .Values.mysql.enabled (index .Values "redis-ha").enabled .Values.initContainers }}
initContainers:
{{- if .Values.mysql.enabled }}
- name: wait-for-db
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "alpine:3.6"
image: "alpine:3.19"
command:
- 'sh'
- '-c'
Expand All @@ -51,6 +51,19 @@ spec:
do sleep 2;
done
{{- end }}
{{- if (index .Values "redis-ha").enabled }}
- name: wait-for-redis
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "alpine:3.19"
command:
- 'sh'
- '-c'
- >
until nc -z -w 2 {{ include "traccar.fullname" . }}-redis-master 6379 && echo redis ok;
do sleep 2;
done
{{- end }}
{{- with .Values.initContainers }}
{{- if eq (typeOf .) "string" }}
{{- tpl . $ | nindent 8 }}
Expand Down
15 changes: 14 additions & 1 deletion charts/traccar/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ mysql:
enabled: false

# NOTE: When using multiple replicas, you must configure broadcast.type and broadcast.address
# This must be done via configOverride. See https://www.traccar.org/configuration-file/#:~:text=attributes%20to%20log.-,broadcast.type,-config
# This can be done via configOverride. See https://www.traccar.org/configuration-file/#:~:text=attributes%20to%20log.-,broadcast.type,-config
# Or by setting redis.enabled=true
replicaCount: 1

deploymentStrategy:
Expand Down Expand Up @@ -907,3 +908,15 @@ nodeSelector:
tolerations: []

affinity: {}

redis-ha:
# enables the redis subchart
enabled: false
persistentVolume:
enabled: false
redis:
masterGroupName: traccar
config:
save: '""'
haproxy:
enabled: true
1 change: 1 addition & 0 deletions ct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ chart-dirs:
- charts
chart-repos:
- bitnami=https://charts.bitnami.com/bitnami
- dandydeveloper=https://dandydeveloper.github.io/charts
helm-extra-args: --timeout 600s

0 comments on commit 24acf83

Please sign in to comment.