diff --git a/buffalogs/buffalogs/celery.py b/buffalogs/buffalogs/celery.py index c639b21..0815f01 100644 --- a/buffalogs/buffalogs/celery.py +++ b/buffalogs/buffalogs/celery.py @@ -18,7 +18,6 @@ # Load task modules from all registered Django apps. app.autodiscover_tasks() - # Dump requests @app.task(bind=True) def debug_task(self): diff --git a/buffalogs/buffalogs/settings/settings.py b/buffalogs/buffalogs/settings/settings.py index 19b31a4..6662a61 100644 --- a/buffalogs/buffalogs/settings/settings.py +++ b/buffalogs/buffalogs/settings/settings.py @@ -37,6 +37,7 @@ "django.contrib.messages", "django.contrib.staticfiles", "impossible_travel", + "django_celery_beat" ] MIDDLEWARE = [ diff --git a/buffalogs/celerybeat-schedule b/buffalogs/celerybeat-schedule new file mode 100644 index 0000000..1233601 Binary files /dev/null and b/buffalogs/celerybeat-schedule differ diff --git a/buffalogs/requirements.txt b/buffalogs/requirements.txt index 2244b7a..8aa5314 100644 --- a/buffalogs/requirements.txt +++ b/buffalogs/requirements.txt @@ -3,6 +3,7 @@ asgiref==3.5.2 billiard==3.6.4.0 black==22.12.0 celery==5.2.7 +django-celery-beat==2.5.0 certifi==2022.9.24 cfgv==3.3.1 click==8.1.3 diff --git a/buffalogs/run_beat.sh b/buffalogs/run_beat.sh old mode 100644 new mode 100755 index ae7e09e..c9d2ea7 --- a/buffalogs/run_beat.sh +++ b/buffalogs/run_beat.sh @@ -1,3 +1,3 @@ #!/bin/bash -celery -A buffalogs beat \ No newline at end of file +celery -A buffalogs beat -l info --loglevel=debug \ No newline at end of file diff --git a/build/Dockerfile b/build/Dockerfile index 6361e4d..1b6cfee 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -3,7 +3,7 @@ FROM python:3.10-slim-bullseye ENV INSTALL_PATH /opt/certego RUN mkdir -p $INSTALL_PATH WORKDIR $INSTALL_PATH -COPY requirements.txt requirements.txt +COPY buffalogs/requirements.txt requirements.txt RUN sed -i 's/main/main non-free/g' /etc/apt/sources.list \ @@ -16,7 +16,6 @@ RUN sed -i 's/main/main non-free/g' /etc/apt/sources.list \ RUN pip install --no-cache-dir -r requirements.txt \ && rm -f requirements.txt && apt-get -y purge gcc && apt-get -y autoremove && apt-get -y clean - COPY buffalogs/ /opt/certego/buffalogs/ RUN chmod +x /opt/certego/buffalogs/run.sh; chmod +x /opt/certego/buffalogs/run_worker.sh; chmod +x /opt/certego/buffalogs/run_beat.sh; WORKDIR /opt/certego/buffalogs/ diff --git a/docker-compose.yaml b/docker-compose.yaml index 2591a86..b139415 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,7 +1,6 @@ version: '3.2' services: - postgres: container_name: buffalogs_postgres image: postgres:15.1-alpine @@ -12,7 +11,7 @@ services: - postgres_data:/var/lib/postgresql/data ports: - "127.0.0.1:5432:5432" - + elasticsearch: container_name: buffalogs_elasticsearch image: docker.elastic.co/elasticsearch/elasticsearch:7.17.7 @@ -35,8 +34,6 @@ services: - "127.0.0.1:9200:9200" volumes: - elasticsearch_data:/usr/share/elasticsearch/data - expose: - - "9200" healthcheck: test: curl -XGET 'localhost:9200/_cluster/health?wait_for_status=yellow&timeout=180s&pretty' @@ -85,12 +82,12 @@ services: volumes: - django_static:/var/www - nginx_sockets:/var/run/nginx-sockets + - ./buffalogs:/opt/certego/buffalogs depends_on: - postgres - elasticsearch - rabbitmq - rabbitmq: container_name: rabbitmq image: rabbitmq:3.11-management-alpine @@ -120,6 +117,7 @@ services: - ./run_worker.sh volumes: - ./config:/opt/certego/config:ro + - ./buffalogs:/opt/certego/buffalogs depends_on: - postgres - elasticsearch @@ -138,13 +136,13 @@ services: - ./run_beat.sh volumes: - ./config:/opt/certego/config:ro + - ./buffalogs:/opt/certego/buffalogs depends_on: - postgres - elasticsearch - rabbitmq volumes: - elasticsearch_data: driver: local postgres_data: