Skip to content

Commit

Permalink
Update docker-compose file
Browse files Browse the repository at this point in the history
- Add `notification` service
- Update docker settings to include `NOTIFICATION_BACKENDS`
- Switch `queue` service to redis
  • Loading branch information
DavisRayM committed Jun 2, 2021
1 parent e9206c7 commit 8d4fc2b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
12 changes: 10 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: .
Expand All @@ -31,4 +31,12 @@ services:
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
34 changes: 32 additions & 2 deletions onadata/settings/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

0 comments on commit 8d4fc2b

Please sign in to comment.