set up worker for async tasks

This commit is contained in:
Julien Fastré 2024-12-30 12:34:33 +01:00
parent c6b32d6005
commit cf62dcc707
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -1,5 +1,4 @@
services: services:
frontend: frontend:
image: {{ registry_url }}/{{ registry_project }}/{{ chill_image_nginx_name }}:{{ item.chill_image_tag }} image: {{ registry_url }}/{{ registry_project }}/{{ chill_image_nginx_name }}:{{ item.chill_image_tag }}
links: links:
@ -23,7 +22,7 @@ services:
- traefik - traefik
- default - default
app: app: &defaultApp
image: {{ registry_url }}/{{ registry_project }}/{{ chill_image_php_name }}:{{ item.chill_image_tag }} image: {{ registry_url }}/{{ registry_project }}/{{ chill_image_php_name }}:{{ item.chill_image_tag }}
env_file: env_file:
- env_file.env - env_file.env
@ -43,6 +42,31 @@ services:
networks: networks:
- default - default
# temporary alter config until merge is solved
post_start:
- command:
- rm
- "/var/www/app/config/packages/chill_doc_store.yaml"
user: root
consumer:
<<: *defaultApp
entrypoint: "/usr/bin/env"
command:
- "/bin/bash"
- "-c"
- >
sleep 3 && bin/console cache:clear &&
while ! [ -f /tmp/kill_me ];
do
php -d memory_limit=2G bin/console messenger:consume priority async --limit=20 --time-limit=600 -v;
done;
pre_stop:
- command:
- "/bin/bash"
- "-c"
- "touch /tmp/kill_me && bin/console messenger:stop-workers"
{% if item.add_postgres %} {% if item.add_postgres %}
database: database: