Skip to content
Open
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
18 changes: 15 additions & 3 deletions helm/charts/celery_beat/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ spec:
tolerations:
{{- toYaml .Values.global.tolerations | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: 30
initContainers:
- name: wait-for-redis
image: busybox:1.36
Expand All @@ -33,9 +34,16 @@ spec:
- -c
- |
echo "Waiting for Redis to be ready..."
TIMEOUT=120
ELAPSED=0
until nc -z redis-service 6379; do
echo "Redis is unavailable - sleeping"
echo "Redis is unavailable - sleeping (${ELAPSED}s/${TIMEOUT}s)"
sleep 2
ELAPSED=$((ELAPSED + 2))
if [ "$ELAPSED" -ge "$TIMEOUT" ]; then
echo "ERROR: Redis did not become ready within ${TIMEOUT}s"
exit 1
fi
done
echo "Redis is ready!"
resources:
Expand Down Expand Up @@ -85,10 +93,10 @@ spec:
command:
- /bin/sh
- -c
- "test -f /code/celerybeat.pid && ps -p $(cat /code/celerybeat.pid) > /dev/null"
- "test -f /code/celerybeat.pid && ps -p $(cat /code/celerybeat.pid) > /dev/null && python -c \"import redis; r = redis.Redis.from_url('$CELERY_BROKER_URL'); r.ping()\""
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 5
timeoutSeconds: 10
failureThreshold: 3
startupProbe:
exec:
Expand All @@ -100,6 +108,10 @@ spec:
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 12
lifecycle:
preStop:
exec:
command: ["/bin/sh", "-c", "sleep 5"]
volumes:
- name: credentials-volume
configMap:
Expand Down
58 changes: 54 additions & 4 deletions helm/charts/celery_worker/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ spec:
tolerations:
{{- toYaml .Values.global.tolerations | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: 30
initContainers:
- name: wait-for-redis
image: busybox:1.36
Expand All @@ -33,9 +34,16 @@ spec:
- -c
- |
echo "Waiting for Redis to be ready..."
TIMEOUT=120
ELAPSED=0
until nc -z redis-service 6379; do
echo "Redis is unavailable - sleeping"
echo "Redis is unavailable - sleeping (${ELAPSED}s/${TIMEOUT}s)"
sleep 2
ELAPSED=$((ELAPSED + 2))
if [ "$ELAPSED" -ge "$TIMEOUT" ]; then
echo "ERROR: Redis did not become ready within ${TIMEOUT}s"
exit 1
fi
done
echo "Redis is ready!"
resources:
Expand Down Expand Up @@ -68,7 +76,7 @@ spec:
- name: CELERY_QUEUE
value: "celery"
- name: CELERY_WORKER_COUNT
value: "2"
value: "4"
- name: CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP
value: "true"
- name: CELERY_BROKER_CONNECTION_MAX_RETRIES
Expand All @@ -94,6 +102,16 @@ spec:
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 12
readinessProbe:
exec:
command:
- /bin/sh
- -c
- "celery -A agent inspect ping -d celery@$HOSTNAME -t 5"
initialDelaySeconds: 10
periodSeconds: 15
timeoutSeconds: 10
failureThreshold: 2
livenessProbe:
exec:
command:
Expand All @@ -104,6 +122,10 @@ spec:
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3
lifecycle:
preStop:
exec:
command: ["/bin/sh", "-c", "sleep 5"]

- name: celery-worker-task-executor # Task executor for high-priority tasks
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
Expand All @@ -127,7 +149,7 @@ spec:
- name: CELERY_QUEUE
value: "exec"
- name: CELERY_WORKER_COUNT
value: "3"
value: "4"
- name: CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP
value: "true"
- name: CELERY_BROKER_CONNECTION_MAX_RETRIES
Expand All @@ -153,6 +175,16 @@ spec:
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 12
readinessProbe:
exec:
command:
- /bin/sh
- -c
- "celery -A agent inspect ping -d celery@$HOSTNAME -t 5"
initialDelaySeconds: 10
periodSeconds: 15
timeoutSeconds: 10
failureThreshold: 2
livenessProbe:
exec:
command:
Expand All @@ -163,6 +195,10 @@ spec:
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3
lifecycle:
preStop:
exec:
command: ["/bin/sh", "-c", "sleep 5"]

- name: celery-worker-asset-extractor # Task executor for asset extraction tasks, which run rarely and are long-running
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
Expand All @@ -186,7 +222,7 @@ spec:
- name: CELERY_QUEUE
value: "asset_extraction"
- name: CELERY_WORKER_COUNT
value: "1"
value: "3"
- name: CELERY_BROKER_CONNECTION_RETRY_ON_STARTUP
value: "true"
- name: CELERY_BROKER_CONNECTION_MAX_RETRIES
Expand All @@ -212,6 +248,16 @@ spec:
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 12
readinessProbe:
exec:
command:
- /bin/sh
- -c
- "celery -A agent inspect ping -d celery@$HOSTNAME -t 5"
initialDelaySeconds: 10
periodSeconds: 15
timeoutSeconds: 10
failureThreshold: 2
livenessProbe:
exec:
command:
Expand All @@ -222,6 +268,10 @@ spec:
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3
lifecycle:
preStop:
exec:
command: ["/bin/sh", "-c", "sleep 5"]

volumes:
- name: credentials-volume
Expand Down
2 changes: 1 addition & 1 deletion helm/charts/redis/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
memory: "256Mi"
cpu: "200m"
limits:
memory: "1Gi"
memory: "1536Mi"
cpu: "1000m"
livenessProbe:
tcpSocket:
Expand Down