From 867e2ad629a03a5678dc5bea87fcd06b94099599 Mon Sep 17 00:00:00 2001 From: Demetris Stavrou Date: Thu, 21 Jun 2018 23:11:08 +0300 Subject: [PATCH 1/5] Redis config in local is now conditional on Celery. --- {{cookiecutter.project_slug}}/.envs/.local/.django | 2 ++ 1 file changed, 2 insertions(+) diff --git a/{{cookiecutter.project_slug}}/.envs/.local/.django b/{{cookiecutter.project_slug}}/.envs/.local/.django index 8aa9a994..a145c6bc 100644 --- a/{{cookiecutter.project_slug}}/.envs/.local/.django +++ b/{{cookiecutter.project_slug}}/.envs/.local/.django @@ -2,6 +2,8 @@ # ------------------------------------------------------------------------------ USE_DOCKER=yes +{%- if cookiecutter.use_celery == 'y' %} # Redis # ------------------------------------------------------------------------------ REDIS_URL=redis://redis:6379/0 +{% endif %} From 6f638078ebe6edcf6b1930658ba2ee4451c94c95 Mon Sep 17 00:00:00 2001 From: Demetris Stavrou Date: Fri, 22 Jun 2018 17:32:10 +0300 Subject: [PATCH 2/5] Moved CELERY_BROKER_URL definition to .django env file to resolve error when Celery is not used (PR #1693) --- {{cookiecutter.project_slug}}/.envs/.production/.django | 7 +++++++ .../compose/production/django/entrypoint.sh | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/.envs/.production/.django b/{{cookiecutter.project_slug}}/.envs/.production/.django index 2e9eefea..1203ce64 100644 --- a/{{cookiecutter.project_slug}}/.envs/.production/.django +++ b/{{cookiecutter.project_slug}}/.envs/.production/.django @@ -43,3 +43,10 @@ DJANGO_SENTRY_DSN= # Redis # ------------------------------------------------------------------------------ REDIS_URL=redis://redis:6379/0 + +{% if cookiecutter.use_celery == "y" %} +# Celery +# ------------------------------------------------------------------------------ +CELERY_BROKER_URL=redis://redis:6379/0 + +{% endif %} \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh index 74242bde..ae0858e1 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh +++ b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint.sh @@ -7,9 +7,6 @@ set -o nounset cmd="$@" -# N.B. If only .env files supported variable expansion... -export CELERY_BROKER_URL="${REDIS_URL}" - if [ -z "${POSTGRES_USER}" ]; then base_postgres_image_default_user='postgres' export POSTGRES_USER="${base_postgres_image_default_user}" From 72893b1d0678b9e248e16660e419fbd680b30d4f Mon Sep 17 00:00:00 2001 From: Demetris Stavrou Date: Thu, 21 Jun 2018 23:11:08 +0300 Subject: [PATCH 3/5] Redis config in local is now conditional on Celery. --- {{cookiecutter.project_slug}}/.envs/.local/.django | 2 ++ 1 file changed, 2 insertions(+) diff --git a/{{cookiecutter.project_slug}}/.envs/.local/.django b/{{cookiecutter.project_slug}}/.envs/.local/.django index 8aa9a994..a145c6bc 100644 --- a/{{cookiecutter.project_slug}}/.envs/.local/.django +++ b/{{cookiecutter.project_slug}}/.envs/.local/.django @@ -2,6 +2,8 @@ # ------------------------------------------------------------------------------ USE_DOCKER=yes +{%- if cookiecutter.use_celery == 'y' %} # Redis # ------------------------------------------------------------------------------ REDIS_URL=redis://redis:6379/0 +{% endif %} From 065becf277d1d56207114aeefbb25f85f62a678d Mon Sep 17 00:00:00 2001 From: Demetris Stavrou Date: Fri, 22 Jun 2018 17:32:10 +0300 Subject: [PATCH 4/5] Moved CELERY_BROKER_URL definition to .django env file to resolve error when Celery is not used (PR #1693) --- {{cookiecutter.project_slug}}/.envs/.production/.django | 7 +++++++ .../compose/production/django/entrypoint | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_slug}}/.envs/.production/.django b/{{cookiecutter.project_slug}}/.envs/.production/.django index 5cb90897..34ab71a2 100644 --- a/{{cookiecutter.project_slug}}/.envs/.production/.django +++ b/{{cookiecutter.project_slug}}/.envs/.production/.django @@ -43,3 +43,10 @@ SENTRY_DSN= # Redis # ------------------------------------------------------------------------------ REDIS_URL=redis://redis:6379/0 + +{% if cookiecutter.use_celery == "y" %} +# Celery +# ------------------------------------------------------------------------------ +CELERY_BROKER_URL=redis://redis:6379/0 + +{% endif %} \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint index 4845e343..e2c22de5 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint +++ b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint @@ -5,9 +5,6 @@ set -o pipefail set -o nounset -# N.B. If only .env files supported variable expansion... -export CELERY_BROKER_URL="${REDIS_URL}" - if [ -z "${POSTGRES_USER}" ]; then base_postgres_image_default_user='postgres' export POSTGRES_USER="${base_postgres_image_default_user}" From c3026e7dfbf94960bc7416bf782dc69285cc0de1 Mon Sep 17 00:00:00 2001 From: Demetris Stavrou Date: Wed, 27 Jun 2018 23:36:06 +0300 Subject: [PATCH 5/5] Added CELERY_BROKER_URL back to entrypoint and surrounded it with a conditional --- .../compose/production/django/entrypoint | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint index e2c22de5..0a76b310 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint +++ b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint @@ -5,6 +5,11 @@ set -o pipefail set -o nounset +{% if cookiecutter.use_celery == 'y' %} +# N.B. If only .env files supported variable expansion... +export CELERY_BROKER_URL="${REDIS_URL}" +{% endif %} + if [ -z "${POSTGRES_USER}" ]; then base_postgres_image_default_user='postgres' export POSTGRES_USER="${base_postgres_image_default_user}"