From af72488cd9b7a1757ccf43641a2330ef9b8dbc67 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 23 Mar 2021 20:05:45 -0700 Subject: [PATCH] Production config for new redis image --- .env.example | 14 ++++++++++---- bookwyrm/activitystreams.py | 5 ++++- bookwyrm/settings.py | 1 + bw-dev | 4 ---- docker-compose.yml | 5 ++++- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.env.example b/.env.example index 91516422f..d2b43e171 100644 --- a/.env.example +++ b/.env.example @@ -23,10 +23,16 @@ POSTGRES_USER=fedireads POSTGRES_DB=fedireads POSTGRES_HOST=db -REDIS_PORT=6379 -REDIS_PASSWORD=redispassword123 -CELERY_BROKER=redis://:${REDIS_PASSWORD}@redis:${REDIS_PORT}/0 -CELERY_RESULT_BACKEND=redis://:${REDIS_PASSWORD}@redis:${REDIS_PORT}/0 +# Redis as activitystreams manager +REDIS_ACTIVITY_HOST=redis_activity +REDIS_ACTIVITY_PORT=6379 +REDIS_ACTIVITY_PASSWORD=redispassword345 + +# Redis as celery broker +REDIS_BROKER_PORT=6379 +REDIS_BROKER_PASSWORD=redispassword123 +CELERY_BROKER=redis://:${REDIS_BROKER_PASSWORD}@redis_broker:${REDIS_BROKER_PORT}/0 +CELERY_RESULT_BACKEND=redis://:${REDIS_BROKER_PASSWORD}@redis_broker:${REDIS_BROKER_PORT}/0 FLOWER_PORT=8888 FLOWER_USER=mouse diff --git a/bookwyrm/activitystreams.py b/bookwyrm/activitystreams.py index 88f1f0114..5102915f7 100644 --- a/bookwyrm/activitystreams.py +++ b/bookwyrm/activitystreams.py @@ -8,7 +8,10 @@ from bookwyrm import models, settings from bookwyrm.views.helpers import privacy_filter r = redis.Redis( - host=settings.REDIS_ACTIVITY_HOST, port=settings.REDIS_ACTIVITY_PORT, db=0 + host=settings.REDIS_ACTIVITY_HOST, + port=settings.REDIS_ACTIVITY_PORT, + password=settings.REDIS_ACTIVITY_PASSWORD, + db=0 ) diff --git a/bookwyrm/settings.py b/bookwyrm/settings.py index 368064355..0f010da27 100644 --- a/bookwyrm/settings.py +++ b/bookwyrm/settings.py @@ -95,6 +95,7 @@ WSGI_APPLICATION = "bookwyrm.wsgi.application" # redis/activity streams settings REDIS_ACTIVITY_HOST = env("REDIS_ACTIVITY_HOST", "localhost") REDIS_ACTIVITY_PORT = env("REDIS_ACTIVITY_PORT", 6379) +REDIS_ACTIVITY_PASSWORD = env("REDIS_ACTIVITY_PASSWORD") MAX_STREAM_LENGTH = env("MAX_STREAM_LENGTH", 200) STREAMS = ["home", "local", "federated"] diff --git a/bw-dev b/bw-dev index f9e9dda51..b663a0e69 100755 --- a/bw-dev +++ b/bw-dev @@ -28,10 +28,6 @@ function initdb { execweb python manage.py initdb } -function makeitblack { - docker-compose run --rm web black celerywyrm bookwyrm -} - CMD=$1 shift diff --git a/docker-compose.yml b/docker-compose.yml index 5e8484c4c..1eab77f57 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -52,6 +52,9 @@ services: - 8000:8000 redis_activity: image: redis + command: redis-server --requirepass ${REDIS_ACTIVITY_PASSWORD} + volumes: + - ./redis.conf:/etc/redis/redis.conf env_file: .env ports: - 6378:6378 @@ -60,7 +63,7 @@ services: restart: on-failure redis_broker: image: redis - command: redis-server --requirepass ${REDIS_PASSWORD} + command: redis-server --requirepass ${REDIS_BROKER_PASSWORD} volumes: - ./redis.conf:/etc/redis/redis.conf env_file: .env