mirror of
https://github.com/aykhans/series-robot-web.git
synced 2025-04-21 06:13:34 +00:00
celery added to docker-compose
This commit is contained in:
parent
202f86bdc2
commit
9cc2fe24ec
@ -19,10 +19,14 @@ services:
|
|||||||
context: ../../
|
context: ../../
|
||||||
dockerfile: Docker/Prod/Dockerfile
|
dockerfile: Docker/Prod/Dockerfile
|
||||||
command: >
|
command: >
|
||||||
bash -c "python3 src/manage.py makemigrations
|
bash -c "cd src
|
||||||
&& python3 src/manage.py migrate
|
&& python3 manage.py makemigrations
|
||||||
&& python3 src/manage.py collectstatic --noinput
|
&& echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ makemigrations completed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
|
||||||
&& gunicorn --chdir src --bind 0.0.0.0:8000 config.wsgi"
|
&& python3 manage.py migrate
|
||||||
|
&& echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ migrate completed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
|
||||||
|
&& python3 manage.py collectstatic --noinput
|
||||||
|
&& echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ collectstatic completed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
|
||||||
|
&& gunicorn --bind 0.0.0.0:8000 config.wsgi"
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
depends_on:
|
depends_on:
|
||||||
@ -31,6 +35,32 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- static_volume:/django_static
|
- static_volume:/django_static
|
||||||
|
|
||||||
|
celery-worker:
|
||||||
|
restart: always
|
||||||
|
build:
|
||||||
|
context: ../../
|
||||||
|
dockerfile: Docker/Prod/Dockerfile
|
||||||
|
environment:
|
||||||
|
- DJANGO_SETTINGS_MODULE=config.settings.production
|
||||||
|
command: >
|
||||||
|
bash -c "cd src
|
||||||
|
&& celery -A config worker -l info -f worker.log"
|
||||||
|
depends_on:
|
||||||
|
- django
|
||||||
|
|
||||||
|
celery-beat:
|
||||||
|
restart: always
|
||||||
|
build:
|
||||||
|
context: ../../
|
||||||
|
dockerfile: Docker/Prod/Dockerfile
|
||||||
|
environment:
|
||||||
|
- DJANGO_SETTINGS_MODULE=config.settings.production
|
||||||
|
command: >
|
||||||
|
bash -c "cd src
|
||||||
|
&& celery -A config beat -l info -f beat.log"
|
||||||
|
depends_on:
|
||||||
|
- celery-worker
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx
|
image: nginx
|
||||||
ports:
|
ports:
|
||||||
@ -41,6 +71,7 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- django
|
- django
|
||||||
|
|
||||||
|
#TODO: add volume for celery logs
|
||||||
volumes:
|
volumes:
|
||||||
dbdata:
|
dbdata:
|
||||||
static_volume:
|
static_volume:
|
@ -19,10 +19,14 @@ services:
|
|||||||
context: ../../
|
context: ../../
|
||||||
dockerfile: Docker/Prod/Dockerfile
|
dockerfile: Docker/Prod/Dockerfile
|
||||||
command: >
|
command: >
|
||||||
bash -c "python3 src/manage.py makemigrations
|
bash -c "cd src
|
||||||
&& python3 src/manage.py migrate
|
&& python3 manage.py makemigrations
|
||||||
&& python3 src/manage.py collectstatic --noinput
|
&& echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ makemigrations completed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
|
||||||
&& gunicorn --chdir src --bind 0.0.0.0:8000 config.wsgi"
|
&& python3 manage.py migrate
|
||||||
|
&& echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ migrate completed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
|
||||||
|
&& python3 manage.py collectstatic --noinput
|
||||||
|
&& echo '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ collectstatic completed ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
|
||||||
|
&& gunicorn --bind 0.0.0.0:8000 config.wsgi"
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
depends_on:
|
depends_on:
|
||||||
@ -31,6 +35,32 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- static_volume:/django_static
|
- static_volume:/django_static
|
||||||
|
|
||||||
|
celery-worker:
|
||||||
|
restart: always
|
||||||
|
build:
|
||||||
|
context: ../../
|
||||||
|
dockerfile: Docker/Prod/Dockerfile
|
||||||
|
environment:
|
||||||
|
- DJANGO_SETTINGS_MODULE=config.settings.production
|
||||||
|
command: >
|
||||||
|
bash -c "cd src
|
||||||
|
&& celery -A config worker -l info -f worker.log"
|
||||||
|
depends_on:
|
||||||
|
- django
|
||||||
|
|
||||||
|
celery-beat:
|
||||||
|
restart: always
|
||||||
|
build:
|
||||||
|
context: ../../
|
||||||
|
dockerfile: Docker/Prod/Dockerfile
|
||||||
|
environment:
|
||||||
|
- DJANGO_SETTINGS_MODULE=config.settings.production
|
||||||
|
command: >
|
||||||
|
bash -c "cd src
|
||||||
|
&& celery -A config beat -l info -f beat.log"
|
||||||
|
depends_on:
|
||||||
|
- celery-worker
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx
|
image: nginx
|
||||||
ports:
|
ports:
|
||||||
@ -52,6 +82,7 @@ services:
|
|||||||
- ../../config/certbot/www:/var/www/certbot
|
- ../../config/certbot/www:/var/www/certbot
|
||||||
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
|
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
|
||||||
|
|
||||||
|
#TODO: add volume for celery logs
|
||||||
volumes:
|
volumes:
|
||||||
dbdata:
|
dbdata:
|
||||||
static_volume:
|
static_volume:
|
@ -1,12 +1,3 @@
|
|||||||
"""
|
|
||||||
ASGI config for config project.
|
|
||||||
|
|
||||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
|
||||||
|
|
||||||
For more information on this file, see
|
|
||||||
https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from django.core.asgi import get_asgi_application
|
from django.core.asgi import get_asgi_application
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import os
|
|
||||||
from celery import Celery
|
from celery import Celery
|
||||||
from celery.schedules import crontab
|
from celery.schedules import crontab
|
||||||
|
# import os
|
||||||
|
|
||||||
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.development")
|
# os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
|
||||||
app = Celery("django_celery")
|
app = Celery("django_celery")
|
||||||
app.config_from_object("django.conf:settings", namespace="CELERY")
|
app.config_from_object("django.conf:settings", namespace="CELERY")
|
||||||
app.autodiscover_tasks()
|
app.autodiscover_tasks()
|
||||||
|
@ -93,3 +93,5 @@ EMAIL_HOST_USER = 'series.notification@gmail.com'
|
|||||||
EMAIL_PORT = 465
|
EMAIL_PORT = 465
|
||||||
EMAIL_USE_SSL = True
|
EMAIL_USE_SSL = True
|
||||||
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
|
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
|
||||||
|
|
||||||
|
CELERY_BROKER_URL = "amqp://guest:guest@rabbitmq:5672/"
|
@ -23,5 +23,3 @@ STATIC_ROOT = os.path.join(os.path.dirname(os.path.dirname(BASE_DIR)), 'django_s
|
|||||||
STATICFILES_DIRS = [
|
STATICFILES_DIRS = [
|
||||||
BASE_DIR / 'static'
|
BASE_DIR / 'static'
|
||||||
]
|
]
|
||||||
|
|
||||||
CELERY_BROKER_URL = "amqp://guest:guest@rabbitmq:5672/"
|
|
Loading…
x
Reference in New Issue
Block a user