From ebc01362e6884157746b031d2974459d58cf91cd Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 22 Mar 2021 10:44:42 -0700 Subject: [PATCH] Adds redis image for activity streams --- .env.example | 9 +++++++-- bookwyrm/settings.py | 3 +++ docker-compose.yml | 15 ++++++++++++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index 7a67045c..7f80a72c 100644 --- a/.env.example +++ b/.env.example @@ -22,8 +22,13 @@ POSTGRES_USER=fedireads POSTGRES_DB=fedireads POSTGRES_HOST=db -CELERY_BROKER=redis://redis:6379/0 -CELERY_RESULT_BACKEND=redis://redis:6379/0 +# Redis activity stream manager +REDIS_ACTIVITY_HOST=redis_activity +REDIS_ACTIVITY_PORT=6379 + +# Celery config with redis broker +CELERY_BROKER=redis://redis_broker:6379/0 +CELERY_RESULT_BACKEND=redis://redis_broker:6379/0 EMAIL_HOST="smtp.mailgun.org" EMAIL_PORT=587 diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py index bcff5828..cd844850 100644 --- a/bookwyrm/settings.py +++ b/bookwyrm/settings.py @@ -92,6 +92,9 @@ TEMPLATES = [ WSGI_APPLICATION = "bookwyrm.wsgi.application" +# redis +REDIS_ACTIVITY_HOST = env("REDIS_ACTIVITY_HOST", "localhost") +REDIS_ACTIVITY_PORT = env("REDIS_ACTIVITY_PORT", 6379) # Database # https://docs.djangoproject.com/en/2.0/ref/settings/#databases diff --git a/docker-compose.yml b/docker-compose.yml index 5d9cbf1b..3ee9037f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,11 +31,20 @@ services: depends_on: - db - celery_worker + - redis_activity networks: - main ports: - 8000:8000 - redis: + redis_activity: + image: redis + env_file: .env + ports: + - 6378:6378 + networks: + - main + restart: on-failure + redis_broker: image: redis env_file: .env ports: @@ -55,7 +64,7 @@ services: - media_volume:/app/images depends_on: - db - - redis + - redis_broker restart: on-failure flower: build: . @@ -67,7 +76,7 @@ services: - main depends_on: - db - - redis + - redis_broker restart: on-failure ports: - 8888:8888