Skip to content

Commit

Permalink
Merge pull request #52 from bbkz/dev
Browse files Browse the repository at this point in the history
Fix celery with redis auth
  • Loading branch information
bbkz committed Jun 21, 2024
2 parents 286ad31 + 4ba372b commit 1cb7ac0
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ python3 manage.py axes_reset_username [USERNAME]

To temporary disable privacy mode to see the blocked ip in the log you can login to the container and add the following setting:

```bas
```bash
echo "AXES_SENSITIVE_PARAMETERS = []" >>settings.py
```

Expand Down
2 changes: 1 addition & 1 deletion charts/wger/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
apiVersion: v2
version: 0.2.0
version: 0.2.1-rc.1
appVersion: latest
name: wger
description: A Helm chart for Wger installation on Kubernetes
Expand Down
10 changes: 3 additions & 7 deletions charts/wger/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ environment:
value: "{{ .Release.Name }}-postgres"
- name: DJANGO_DB_PORT
value: {{ int .Values.postgres.service.port | quote }}
# django cache
# cache
- name: DJANGO_CACHE_BACKEND
value: "django_redis.cache.RedisCache"
- name: DJANGO_CACHE_LOCATION
Expand All @@ -45,6 +45,8 @@ environment:
value: "django_redis.client.DefaultClient"
- name: DJANGO_CACHE_TIMEOUT
value: {{ int .Values.app.django.cache.timeout | default "1296000" | quote }}
- name: EXERCISE_CACHE_TTL
value: "18000"
# django general
{{- if .Values.ingress.enabled }}
- name: SITE_URL
Expand Down Expand Up @@ -103,8 +105,6 @@ environment:
- name: GUNICORN_CMD_ARGS
value: "--timeout 240 --workers 4 --worker-class gthread --threads 3 --forwarded-allow-ips * --proxy-protocol True --access-logformat='%(h)s %(l)s %({client-ip}i)s %(l)s %({x-real-ip}i)s %(l)s %({x-forwarded-for}i)s %(l)s %(t)s \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s\"' --access-logfile - --error-logfile -"
{{- end }}
- name: EXERCISE_CACHE_TTL
value: "18000"
# Users won't be able to contribute to exercises if their account age is
# lower than this amount in days.
- name: MIN_ACCOUNT_AGE_TO_TRUST
Expand Down Expand Up @@ -135,10 +135,6 @@ environment:
value: {{ .Values.celery.syncVideos | default "True" | quote }}
- name: DOWNLOAD_INGREDIENTS_FROM
value: {{ .Values.celery.ingredientsFrom | default "WGER" | quote }}
- name: CELERY_BROKER
value: "redis://{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
- name: CELERY_BACKEND
value: "redis://{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
{{- end }}
{{- end }}

Expand Down
36 changes: 36 additions & 0 deletions charts/wger/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ spec:
secretKeyRef:
name: "redis"
key: "redis-password"
- name: CELERY_BROKER
value: "redis://:$(DJANGO_CACHE_CLIENT_PASSWORD)@{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
- name: CELERY_BACKEND
value: "redis://:$(DJANGO_CACHE_CLIENT_PASSWORD)@{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
{{- else }}
- name: CELERY_BROKER
value: "redis://{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
- name: CELERY_BACKEND
value: "redis://{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
{{- end }}
{{- if .Values.celery.flower.enabled }}
- name: CELERY_FLOWER_PASSWORD
Expand Down Expand Up @@ -245,6 +254,15 @@ spec:
secretKeyRef:
name: "redis"
key: "redis-password"
- name: CELERY_BROKER
value: "redis://:$(DJANGO_CACHE_CLIENT_PASSWORD)@{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
- name: CELERY_BACKEND
value: "redis://:$(DJANGO_CACHE_CLIENT_PASSWORD)@{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
{{- else }}
- name: CELERY_BROKER
value: "redis://{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
- name: CELERY_BACKEND
value: "redis://{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
{{- end }}
{{- if .Values.celery.flower.enabled }}
- name: CELERY_FLOWER_PASSWORD
Expand Down Expand Up @@ -305,6 +323,15 @@ spec:
secretKeyRef:
name: "redis"
key: "redis-password"
- name: CELERY_BROKER
value: "redis://:$(DJANGO_CACHE_CLIENT_PASSWORD)@{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
- name: CELERY_BACKEND
value: "redis://:$(DJANGO_CACHE_CLIENT_PASSWORD)@{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
{{- else }}
- name: CELERY_BROKER
value: "redis://{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
- name: CELERY_BACKEND
value: "redis://{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
{{- end }}
- name: CELERY_FLOWER_PASSWORD
valueFrom:
Expand Down Expand Up @@ -426,6 +453,15 @@ spec:
secretKeyRef:
name: "redis"
key: "redis-password"
- name: CELERY_BROKER
value: "redis://:$(DJANGO_CACHE_CLIENT_PASSWORD)@{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
- name: CELERY_BACKEND
value: "redis://:$(DJANGO_CACHE_CLIENT_PASSWORD)@{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
{{- else }}
- name: CELERY_BROKER
value: "redis://{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
- name: CELERY_BACKEND
value: "redis://{{ .Release.Name }}-redis:{{ int .Values.redis.service.serverPort }}/2"
{{- end }}
{{- if .Values.celery.flower.enabled }}
- name: CELERY_FLOWER_PASSWORD
Expand Down
2 changes: 1 addition & 1 deletion example/prod_values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ app:
- name: FROM_EMAIL
value: "fit@example.com"
- name: DJANGO_ADMINS
value: "SysAdmin, admin@test.com
value: "SysAdmin, admin@test.com"
- name: GUNICORN_CMD_ARGS
value: "--timeout 240 --workers 2 --worker-class gthread --threads 3 --forwarded-allow-ips * --proxy-protocol True --access-logformat='%(h)s %(l)s %({client-ip}i)s %(l)s %({x-real-ip}i)s %(l)s %({x-forwarded-for}i)s %(l)s %(t)s \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s\"' --access-logfile - --error-logfile -"

Expand Down

0 comments on commit 1cb7ac0

Please sign in to comment.