mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-28 20:44:04 +03:00
Introduce development-time Celery services (#1257)
* Introduce development-time Celery services Closes #1225. * Re-order django and postgres services in production.yml * Switch local service extension tactics * Fix celery services inheriting ports from the django's
This commit is contained in:
parent
a5129ecbe4
commit
035dc4d7ab
|
@ -13,6 +13,14 @@ COPY ./compose/django/start-dev.sh /start-dev.sh
|
||||||
RUN sed -i 's/\r//' /start-dev.sh
|
RUN sed -i 's/\r//' /start-dev.sh
|
||||||
RUN chmod +x /start-dev.sh
|
RUN chmod +x /start-dev.sh
|
||||||
|
|
||||||
|
COPY ./compose/django/celery/worker/start-dev.sh /start-celeryworker-dev.sh
|
||||||
|
RUN sed -i 's/\r//' /start-celeryworker-dev.sh
|
||||||
|
RUN chmod +x /start-celeryworker-dev.sh
|
||||||
|
|
||||||
|
COPY ./compose/django/celery/beat/start-dev.sh /start-celerybeat-dev.sh
|
||||||
|
RUN sed -i 's/\r//' /start-celerybeat-dev.sh
|
||||||
|
RUN chmod +x /start-celerybeat-dev.sh
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
set -o xtrace
|
||||||
|
|
||||||
|
rm -f './celerybeat.pid'
|
||||||
|
celery -A {{cookiecutter.project_slug}}.taskapp beat -l INFO
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
set -o xtrace
|
||||||
|
|
||||||
|
celery -A {{cookiecutter.project_slug}}.taskapp worker -l INFO
|
|
@ -5,6 +5,22 @@ volumes:
|
||||||
postgres_backup_dev: {}
|
postgres_backup_dev: {}
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
django: &django
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./compose/django/Dockerfile-dev
|
||||||
|
depends_on:
|
||||||
|
- postgres{% if cookiecutter.use_mailhog == 'y' %}
|
||||||
|
- mailhog{% endif %}
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER={{cookiecutter.project_slug}}
|
||||||
|
- USE_DOCKER=yes
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
command: /start-dev.sh
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
build: ./compose/postgres
|
build: ./compose/postgres
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -12,23 +28,6 @@ services:
|
||||||
- postgres_backup_dev:/backups
|
- postgres_backup_dev:/backups
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER={{cookiecutter.project_slug}}
|
- POSTGRES_USER={{cookiecutter.project_slug}}
|
||||||
|
|
||||||
django:
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: ./compose/django/Dockerfile-dev
|
|
||||||
command: /start-dev.sh
|
|
||||||
depends_on:
|
|
||||||
- postgres{% if cookiecutter.use_mailhog == 'y' %}
|
|
||||||
- mailhog{% endif %}
|
|
||||||
environment:
|
|
||||||
- POSTGRES_USER={{cookiecutter.project_slug}}
|
|
||||||
- USE_DOCKER=yes
|
|
||||||
volumes:
|
|
||||||
- .:/app
|
|
||||||
ports:
|
|
||||||
- "8000:8000"
|
|
||||||
|
|
||||||
{% if cookiecutter.use_pycharm == 'y' %}
|
{% if cookiecutter.use_pycharm == 'y' %}
|
||||||
pycharm:
|
pycharm:
|
||||||
build:
|
build:
|
||||||
|
@ -41,10 +40,33 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if cookiecutter.use_mailhog == 'y' %}
|
{% if cookiecutter.use_mailhog == 'y' %}
|
||||||
mailhog:
|
mailhog:
|
||||||
image: mailhog/mailhog:v1.0.0
|
image: mailhog/mailhog:v1.0.0
|
||||||
ports:
|
ports:
|
||||||
- "8025:8025"
|
- "8025:8025"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if cookiecutter.use_celery == 'y' %}
|
||||||
|
redis:
|
||||||
|
image: redis:3.0
|
||||||
|
|
||||||
|
celeryworker:
|
||||||
|
# https://github.com/docker/compose/issues/3220
|
||||||
|
<<: *django
|
||||||
|
depends_on:
|
||||||
|
- redis
|
||||||
|
- postgres{% if cookiecutter.use_mailhog == 'y' %}
|
||||||
|
- mailhog{% endif %}
|
||||||
|
ports: []
|
||||||
|
command: /start-celeryworker-dev.sh
|
||||||
|
|
||||||
|
celerybeat:
|
||||||
|
# https://github.com/docker/compose/issues/3220
|
||||||
|
<<: *django
|
||||||
|
depends_on:
|
||||||
|
- redis
|
||||||
|
- postgres{% if cookiecutter.use_mailhog == 'y' %}
|
||||||
|
- mailhog{% endif %}
|
||||||
|
ports: []
|
||||||
|
command: /start-celerybeat-dev.sh
|
||||||
|
{% endif %}
|
||||||
|
|
|
@ -5,13 +5,6 @@ volumes:
|
||||||
postgres_backup: {}
|
postgres_backup: {}
|
||||||
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
|
||||||
build: ./compose/postgres
|
|
||||||
volumes:
|
|
||||||
- postgres_data:/var/lib/postgresql/data
|
|
||||||
- postgres_backup:/backups
|
|
||||||
env_file: .env
|
|
||||||
|
|
||||||
django:
|
django:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
|
@ -22,6 +15,13 @@ services:
|
||||||
command: /gunicorn.sh
|
command: /gunicorn.sh
|
||||||
env_file: .env
|
env_file: .env
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
build: ./compose/postgres
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
- postgres_backup:/backups
|
||||||
|
env_file: .env
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
build: ./compose/nginx
|
build: ./compose/nginx
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user