diff --git a/.env-file b/.env-file new file mode 100644 index 0000000..b541f65 --- /dev/null +++ b/.env-file @@ -0,0 +1,3 @@ +CELERY_ACCEPT_CONTENT="json,pickle,application/json,application/x-python-serialize" +CE_BROKER_URL="rabbitmq" +CE_GENERIC_HOSTNAME_TASK_SENT_METRIC="true" \ No newline at end of file diff --git a/.env-file.sample b/.env-file.sample new file mode 100644 index 0000000..f6fd8ee --- /dev/null +++ b/.env-file.sample @@ -0,0 +1,3 @@ +CELERY_ACCEPT_CONTENT= +CE_BROKER_URL= +CE_GENERIC_HOSTNAME_TASK_SENT_METRIC= \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 82538c3..04952ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ FROM python:3.10-slim-bullseye EXPOSE 9808 ENV PYTHONUNBUFFERED 1 +ENV CELERY_ACCEPT_CONTENT "json" WORKDIR /app/ COPY pyproject.toml poetry.lock /app/ @@ -19,4 +20,4 @@ RUN apt-get update && \ COPY . /app/ -ENTRYPOINT ["python", "/app/cli.py"] +ENTRYPOINT python /app/cli.py --accept-content=${CELERY_ACCEPT_CONTENT} diff --git a/README.md b/README.md index ddf2cfc..0f8e3ac 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,11 @@ Using Docker: docker run -p 9808:9808 danihodovic/celery-exporter --broker-url=redis://redis.service.consul/1 ``` +Using Docker Compose: +```sh +docker-compose build && docker-compose -p celery-exporter up -d +``` + Using the Python binary (for-non Docker environments): ```sh curl -L https://github.com/danihodovic/celery-exporter/releases/download/latest/celery-exporter -o ./celery-exporter diff --git a/docker-compose.yml b/docker-compose.yml index c2e4640..6f4692e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,25 @@ --- -version: '2.4' +version: "3.9" services: - redis: - image: 'redis:6' - ports: ['6379:6379'] - + celery-exporter: + container_name: celery-exporter + build: . + env_file: + - .env-file + ports: + - "9808:9808" + depends_on: + - rabbitmq + restart: unless-stopped rabbitmq: + container_name: rabbitmq image: rabbitmq:3 - ports: ['5672:5672'] + ports: + - "5672:5672" + restart: unless-stopped + redis: + container_name: redis + image: redis:6 + ports: + - "6379:6379" + restart: unless-stopped