From 2c1d4870c0da90606f52743a1d11aae96f7947f4 Mon Sep 17 00:00:00 2001 From: Drew Bednar Date: Tue, 6 Sep 2022 23:52:18 -0400 Subject: [PATCH] Initial setup --- .gitignore | 1 + README.md | 28 ++++++++++++++++++++- dev_requirements.in | 4 +++ dev_requirements.txt | 51 +++++++++++++++++++++++++++++++++++++++ docker-compose-rabbit.yml | 45 ++++++++++++++++++++++++++++++++++ docker-compose-redis.yml | 10 ++++++++ requirements.in | 1 + requirements.txt | 45 ++++++++++++++++++++++++++++++++++ 8 files changed, 184 insertions(+), 1 deletion(-) create mode 100644 dev_requirements.in create mode 100644 dev_requirements.txt create mode 100644 docker-compose-rabbit.yml create mode 100644 docker-compose-redis.yml create mode 100644 requirements.in create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index f8b73e7..53e0254 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +rabbitdata/ # ---> Python # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/README.md b/README.md index 2a7aa1f..fa51239 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,29 @@ # learn_dramatiq -Learn Dramatiq basics \ No newline at end of file +Learn Dramatiq basics + +## Docker Compose Backends + +Since Dramatiq supports Redis and RabbitMQ as queue backends, there are two separate docker-compose files for each. These are temporary dev backends; no persistent volumes are used and there is no TLS. + +Redis: + +``` +docker compose -f docker-compose-redis.yml up -d +``` + +``` +docker compose -f docker-compose-redis.yml down +``` + +RabbitMQ: + +It takes some time for RabbitMQ to serve requests. This does have a persistent volume. + +``` +docker compose -f docker-compose-rabbit.yml up -d +``` + +``` +docker compose -f docker-compose-rabbit.yml down +``` diff --git a/dev_requirements.in b/dev_requirements.in new file mode 100644 index 0000000..615c294 --- /dev/null +++ b/dev_requirements.in @@ -0,0 +1,4 @@ +black +flake8 +invoke +pip-tools diff --git a/dev_requirements.txt b/dev_requirements.txt new file mode 100644 index 0000000..601f4a7 --- /dev/null +++ b/dev_requirements.txt @@ -0,0 +1,51 @@ +# +# This file is autogenerated by pip-compile with python 3.8 +# To update, run: +# +# pip-compile dev_requirements.in +# +black==22.8.0 + # via -r dev_requirements.in +build==0.8.0 + # via pip-tools +click==8.1.3 + # via + # black + # pip-tools +flake8==5.0.4 + # via -r dev_requirements.in +invoke==1.7.1 + # via -r dev_requirements.in +mccabe==0.7.0 + # via flake8 +mypy-extensions==0.4.3 + # via black +packaging==21.3 + # via build +pathspec==0.10.1 + # via black +pep517==0.13.0 + # via build +pip-tools==6.8.0 + # via -r dev_requirements.in +platformdirs==2.5.2 + # via black +pycodestyle==2.9.1 + # via flake8 +pyflakes==2.5.0 + # via flake8 +pyparsing==3.0.9 + # via packaging +tomli==2.0.1 + # via + # black + # build + # pep517 +typing-extensions==4.3.0 + # via black +wheel==0.37.1 + # via pip-tools + +# The following packages are considered to be unsafe in a requirements file: +# pip +# setuptools diff --git a/docker-compose-rabbit.yml b/docker-compose-rabbit.yml new file mode 100644 index 0000000..7605073 --- /dev/null +++ b/docker-compose-rabbit.yml @@ -0,0 +1,45 @@ +# version: '3.9' + +# services: + +# # my-rabbitmq: +# # # Use Alpine for docker-compose. +# # image: rabbitmq:3-management-alpine +# # container_name: my-rabbitmq +# # hostname: my-rabbitmq-host +# # ports: +# # - "15762:15762" +# # - "5762:5762" +# # volumes: +# # - ".rabbitdata:/var/lib/rabbitmq" +# # environment: +# # - RABBITMQ_DEFAULT_USER=runcible +# # - RABBITMQ_DEFAULT_PASS=Testing123 +# # - RABBITMQ_DEFAULT_VHOST=runcible +# # healthcheck: +# # test: [ "CMD", "nc", "-z", "localhost", "5672" ] +# # interval: 5s +# # timeout: 15s +# # retries: 1 + +version: "3.9" +services: + my-rabbit: + image: rabbitmq:3-management-alpine + container_name: my-rabbit + hostname: my-rabbit-host + environment: + # Defaults only created if db does not exist. + - RABBITMQ_DEFAULT_USER=runcible + - RABBITMQ_DEFAULT_PASS=Testing123 + - RABBITMQ_DEFAULT_VHOST=runcible + ports: + - "15672:15672" + - "5672:5672" + volumes: + - ".rabbitdata:/var/lib/rabbitmq" + healthcheck: + test: [ "CMD", "nc", "-z", "localhost", "5672" ] + interval: 5s + timeout: 15s + retries: 1 \ No newline at end of file diff --git a/docker-compose-redis.yml b/docker-compose-redis.yml new file mode 100644 index 0000000..05d40f5 --- /dev/null +++ b/docker-compose-redis.yml @@ -0,0 +1,10 @@ +version: '3.8' + +services: + + redis: + image: redis:7.0.4-alpine + restart: always + ports: + - 6379:6379 + diff --git a/requirements.in b/requirements.in new file mode 100644 index 0000000..6b5d58e --- /dev/null +++ b/requirements.in @@ -0,0 +1 @@ +dramatiq[all] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..797095a --- /dev/null +++ b/requirements.txt @@ -0,0 +1,45 @@ +# +# This file is autogenerated by pip-compile with python 3.8 +# To update, run: +# +# pip-compile requirements.in +# +async-timeout==4.0.2 + # via redis +deprecated==1.2.13 + # via redis +dramatiq[all]==1.13.0 + # via -r requirements.in +gevent==21.12.0 + # via + # dramatiq + # watchdog-gevent +greenlet==1.1.3 + # via gevent +packaging==21.3 + # via redis +pika==1.3.0 + # via dramatiq +prometheus-client==0.14.1 + # via dramatiq +pylibmc==1.6.3 + # via dramatiq +pyparsing==3.0.9 + # via packaging +redis==4.3.4 + # via dramatiq +watchdog==2.1.9 + # via + # dramatiq + # watchdog-gevent +watchdog-gevent==0.1.1 + # via dramatiq +wrapt==1.14.1 + # via deprecated +zope-event==4.5.0 + # via gevent +zope-interface==5.4.0 + # via gevent + +# The following packages are considered to be unsafe in a requirements file: +# setuptools