Add Redis persistent storage when using celery

This commit is contained in:
Marios Frixou 2024-05-10 11:04:10 +03:00
parent f58530288c
commit 2c55a3d443
2 changed files with 15 additions and 0 deletions

View File

@ -3,6 +3,7 @@ version: '3'
volumes:
{{ cookiecutter.project_slug }}_local_postgres_data: {}
{{ cookiecutter.project_slug }}_local_postgres_data_backups: {}
{% if cookiecutter.use_celery == 'y' %}{{ cookiecutter.project_slug }}_local_redis_data: {}{% endif %}
services:
django:{% if cookiecutter.use_celery == 'y' %} &django{% endif %}
@ -54,6 +55,10 @@ services:
redis:
image: docker.io/redis:6
container_name: {{ cookiecutter.project_slug }}_local_redis
{% if cookiecutter.use_celery == 'y' %}
volumes:
- {{ cookiecutter.project_slug }}_local_redis_data:/data
{% endif %}
celeryworker:
<<: *django

View File

@ -7,6 +7,10 @@ volumes:
{%- if cookiecutter.cloud_provider == 'None' %}
production_django_media: {}
{%- endif %}
{% if cookiecutter.use_celery == 'y' %}
production_redis_data: {}
{% endif %}
services:
django:{% if cookiecutter.use_celery == 'y' %} &django{% endif %}
@ -68,6 +72,12 @@ services:
redis:
image: docker.io/redis:6
{% if cookiecutter.use_celery == 'y' %}
volumes:
- production_redis_data:/data
{% endif %}
{%- if cookiecutter.use_celery == 'y' %}
celeryworker: