Integrate Flower with Docker Compose setup locally

This commit is contained in:
Nikita P. Shupeyko 2018-05-21 22:06:44 +03:00
parent b069f8e40e
commit 4810d57da9
5 changed files with 24 additions and 1 deletions

View File

@ -65,7 +65,7 @@ Optional Integrations
*These features can be enabled during initial project setup.* *These features can be enabled during initial project setup.*
* Serve static files from Amazon S3 or Whitenoise_ * Serve static files from Amazon S3 or Whitenoise_
* Configuration for Celery_ * Configuration for Celery_ and Flower_ (the latter in Docker setup only)
* Integration with MailHog_ for local email testing * Integration with MailHog_ for local email testing
* Integration with Sentry_ for error logging * Integration with Sentry_ for error logging
@ -78,6 +78,7 @@ Optional Integrations
.. _Mailgun: http://www.mailgun.com/ .. _Mailgun: http://www.mailgun.com/
.. _Whitenoise: https://whitenoise.readthedocs.io/ .. _Whitenoise: https://whitenoise.readthedocs.io/
.. _Celery: http://www.celeryproject.org/ .. _Celery: http://www.celeryproject.org/
.. _Flower: https://github.com/mher/flower
.. _Anymail: https://github.com/anymail/django-anymail .. _Anymail: https://github.com/anymail/django-anymail
.. _MailHog: https://github.com/mailhog/MailHog .. _MailHog: https://github.com/mailhog/MailHog
.. _Sentry: https://sentry.io/welcome/ .. _Sentry: https://sentry.io/welcome/

View File

@ -27,6 +27,10 @@ COPY ./compose/local/django/start /start
RUN sed -i 's/\r//' /start RUN sed -i 's/\r//' /start
RUN chmod +x /start RUN chmod +x /start
{% if cookiecutter.use_celery == "y" %} {% if cookiecutter.use_celery == "y" %}
COPY ./compose/local/django/celery/flower/start /start-flower
RUN sed -i 's/\r//' /start-flower
RUN chmod +x /start-flower
COPY ./compose/local/django/celery/worker/start /start-celeryworker COPY ./compose/local/django/celery/worker/start /start-celeryworker
RUN sed -i 's/\r//' /start-celeryworker RUN sed -i 's/\r//' /start-celeryworker
RUN chmod +x /start-celeryworker RUN chmod +x /start-celeryworker

View File

@ -0,0 +1,9 @@
#!/bin/sh
set -o errexit
set -o pipefail
set -o nounset
set -o xtrace
celery flower -A {{cookiecutter.project_slug}}.taskapp worker --broker="${CELERY_BROKER_URL}"

View File

@ -44,6 +44,12 @@ services:
{%- endif %} {%- endif %}
{%- if cookiecutter.use_celery == 'y' %} {%- if cookiecutter.use_celery == 'y' %}
flower:
<<: *django
ports:
- "5555:5555"
command: /start-flower
redis: redis:
image: redis:3.2 image: redis:3.2

View File

@ -8,6 +8,9 @@ psycopg2==2.7.4 --no-binary psycopg2 # https://github.com/psycopg/psycopg2
{%- else %} {%- else %}
psycopg2-binary==2.7.4 # https://github.com/psycopg/psycopg2 psycopg2-binary==2.7.4 # https://github.com/psycopg/psycopg2
{%- endif %} {%- endif %}
{%- if cookiecutter.use_docker == 'y' and cookiecutter.use_celery == 'y' %}
flower==0.9.2 # https://github.com/mher/flower
{%- endif %}
# Testing # Testing
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------