Skip to content

Commit

Permalink
Add celery flower
Browse files Browse the repository at this point in the history
  • Loading branch information
thenav56 committed Dec 6, 2024
1 parent 6c43482 commit 9304394
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 1 deletion.
54 changes: 54 additions & 0 deletions helm/templates/celery-flower/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{{- if .Values.worker.enabled }}
{{- if .Values.worker.flower.enabled }}

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "ifrcgo-alert-hub.fullname" . }}-celery-flower
labels:
app: {{ include "ifrcgo-alert-hub.fullname" . }}
component: worker-flower
environment: {{ .Values.environment }}
release: {{ .Release.Name }}
annotations:
reloader.stakater.com/auto: "true"
spec:
replicas: 1
selector:
matchLabels:
app: {{ include "ifrcgo-alert-hub.fullname" . }}
component: worker-flower
template:
metadata:
{{- if not .Values.azure.aksSecretsProviderAvailable }}
annotations:
checksum/secret: {{ include (print .Template.BasePath "/config/secret.yaml") . | sha256sum }}
checksum/configmap: {{ include (print .Template.BasePath "/config/configmap.yaml") . | sha256sum }}
{{- end }}
labels:
app: {{ include "ifrcgo-alert-hub.fullname" . }}
component: worker-flower
spec:
containers:
- name: worker
image: "{{ .Values.image.name }}:{{ .Values.image.tag }}"
command: ["celery", "-A", "main", "flower", "--port=8000"]
# TODO: livenessProbe
resources:
{{- toYaml .Values.worker.flower.resources | nindent 12 }}
env:
- name: DJANGO_APP_TYPE
value: worker
envFrom:
- secretRef:
name: {{ template "ifrcgo-alert-hub.secretname" . }}
- configMapRef:
name: {{ template "ifrcgo-alert-hub.fullname" . }}-api-configmap

{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}

{{- end }}
{{- end }}
24 changes: 24 additions & 0 deletions helm/templates/celery-flower/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if .Values.worker.enabled }}
{{- if .Values.worker.flower.enabled }}

apiVersion: v1
kind: Service
metadata:
name: {{ template "ifrcgo-alert-hub.fullname" . }}-celery-flower
labels:
app: {{ include "ifrcgo-alert-hub.fullname" . }}
component: celery-flower
environment: {{ .Values.environment }}
release: {{ .Release.Name }}
spec:
type: ClusterIP
selector:
app: {{ include "ifrcgo-alert-hub.fullname" . }}
component: worker-flower
ports:
- protocol: TCP
port: 80
targetPort: 8000

{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ worker:
limits:
cpu: "1"
memory: 1Gi
flower:
enabled: true
resources:
requests:
cpu: "0.1"
memory: 0.5Gi
limits:
cpu: "1"
memory: 1Gi
queues:
# NOTE: Make sure keys are lowercase
default:
Expand Down
68 changes: 67 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package-mode = false
python = "^3.11"
Django = ">=4.2,<4.3"
celery = "^5.3"
flower="*" # celery-dashboard
django-celery-beat = "*"
django-cors-headers = "*"
django-environ = "*"
Expand Down

0 comments on commit 9304394

Please sign in to comment.