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

View File

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