From 031c274762eee24552f0c2c2ff05fbfb915bfa84 Mon Sep 17 00:00:00 2001 From: Davis Raymond Muro Date: Wed, 2 Jun 2021 11:58:43 +0300 Subject: [PATCH] Update docker-compose file - Add `notification` service - Update docker settings to include `NOTIFICATION_BACKENDS` - Switch `queue` service to redis --- docker-compose.yml | 15 ++++++++++----- onadata/settings/docker.py | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index fc1fc52013..85ac9354ca 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: # it everytime we rebuild. - ../.onadata_db:/var/lib/postgresql/data queue: - image: rabbitmq + image: redis:6-alpine web: build: context: . @@ -28,7 +28,12 @@ services: depends_on: - db - queue - environment: - - SELECTED_PYTHON=python3.6 - - INITDB=false - + notifications: + image: emqx/emqx:4.3.2 + ports: + - "1883:1883" + - "8080:8080" + volumes: + - ../.onadata_mqtt/data:/opt/emqx/data + - ../.onadata_mqtt/etc:/opt/emqx/etc + - ../.onadata_mqtt/log:/opt/emqx/log diff --git a/onadata/settings/docker.py b/onadata/settings/docker.py index 1d0c178518..5eaf840c15 100644 --- a/onadata/settings/docker.py +++ b/onadata/settings/docker.py @@ -50,13 +50,39 @@ else: TESTING_MODE = False -CELERY_BROKER_URL = 'amqp://guest:@queue:5672//' -CELERY_TASK_ALWAYS_EAGER = False +CELERY_BROKER_URL = 'redis://queue:6379' +CELERY_RESULT_BACKEND = 'redis://queue:6379' +CELERY_TASK_ALWAYS_EAGER = True CELERY_ACCEPT_CONTENT = ['json'] CELERY_TASK_SERIALIZER = 'json' CELERY_CACHE_BACKEND = 'memory' CELERY_BROKER_CONNECTION_MAX_RETRIES = 2 +CACHES = { + 'default': { + 'BACKEND': 'django_redis.cache.RedisCache', + 'LOCATION': 'redis://queue:6379', + "OPTIONS": { + "CLIENT_CLASS": "django_redis.client.DefaultClient" + }, + } +} + +NOTIFICATION_BACKENDS = { + 'mqtt': { + 'BACKEND': 'onadata.apps.messaging.backends.mqtt.MQTTBackend', + 'OPTIONS': { + 'HOST': 'notifications', + 'PORT': 1883, + 'QOS': 1, + 'RETAIN': False, + 'SECURE': False, + 'TOPIC_BASE': 'onadata' + } + } +} +FULL_MESSAGE_PAYLOAD = True + EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' if TESTING_MODE: @@ -76,3 +102,7 @@ ENKETO_API_INSTANCE_IFRAME_URL = ENKETO_URL + "api_v1/instance/iframe" else: MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media/') # noqa + +ENKETO_API_ALL_SURVEY_LINKS_PATH = '/api_v2/survey/all' +SUBMISSION_RETRIEVAL_THRESHOLD = 1000 +CSV_FILESIZE_IMPORT_ASYNC_THRESHOLD = 100000 \ No newline at end of file