mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-21 23:56:34 +00:00
Use redis with password in dev
This commit is contained in:
parent
629140cad4
commit
bebb2c167e
5 changed files with 28 additions and 14 deletions
|
@ -26,15 +26,15 @@ POSTGRES_HOST=db
|
|||
MAX_STREAM_LENGTH=200
|
||||
REDIS_ACTIVITY_HOST=redis_activity
|
||||
REDIS_ACTIVITY_PORT=6379
|
||||
#REDIS_ACTIVITY_PASSWORD=redispassword345
|
||||
REDIS_ACTIVITY_PASSWORD=redispassword345
|
||||
|
||||
# Redis as celery broker
|
||||
REDIS_BROKER_PORT=6379
|
||||
#REDIS_BROKER_PASSWORD=redispassword123
|
||||
REDIS_BROKER_PASSWORD=redispassword123
|
||||
|
||||
FLOWER_PORT=8888
|
||||
#FLOWER_USER=mouse
|
||||
#FLOWER_PASSWORD=changeme
|
||||
FLOWER_USER=mouse
|
||||
FLOWER_PASSWORD=changeme
|
||||
|
||||
EMAIL_HOST=smtp.mailgun.org
|
||||
EMAIL_PORT=587
|
||||
|
|
|
@ -5,10 +5,12 @@ import redis
|
|||
from bookwyrm import settings
|
||||
|
||||
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,
|
||||
)
|
||||
|
||||
|
||||
class RedisStore(ABC):
|
||||
"""sets of ranked, related objects, like statuses for a user's feed"""
|
||||
|
||||
|
|
|
@ -3,12 +3,13 @@
|
|||
# pylint: disable=unused-wildcard-import
|
||||
from bookwyrm.settings import *
|
||||
|
||||
CELERY_BROKER_URL = "redis://:{}@redis_broker:{}/0".format(
|
||||
requests.utils.quote(env("REDIS_BROKER_PASSWORD", "")), env("REDIS_BROKER_PORT")
|
||||
)
|
||||
CELERY_RESULT_BACKEND = "redis://:{}@redis_broker:{}/0".format(
|
||||
requests.utils.quote(env("REDIS_BROKER_PASSWORD", "")), env("REDIS_BROKER_PORT")
|
||||
)
|
||||
REDIS_BROKER_PASSWORD = requests.utils.quote(env("REDIS_BROKER_PASSWORD", None))
|
||||
REDIS_BROKER_HOST = env("REDIS_BROKER_HOST", "redis_broker")
|
||||
REDIS_BROKER_PORT = env("REDIS_BROKER_PORT", 6379)
|
||||
|
||||
# pylint: disable=line-too-long
|
||||
CELERY_BROKER_URL = f"redis://:{REDIS_BROKER_PASSWORD}@{REDIS_BROKER_HOST}:{REDIS_BROKER_PORT}/0"
|
||||
CELERY_RESULT_BACKEND = f"redis://:{REDIS_BROKER_PASSWORD}@{REDIS_BROKER_HOST}:{REDIS_BROKER_PORT}/0"
|
||||
|
||||
CELERY_DEFAULT_QUEUE = "low_priority"
|
||||
|
||||
|
|
|
@ -38,16 +38,17 @@ services:
|
|||
- 8000:8000
|
||||
redis_activity:
|
||||
image: redis
|
||||
command: ["redis-server", "--appendonly", "yes"]
|
||||
command: redis-server --requirepass ${REDIS_ACTIVITY_PASSWORD} --appendonly yes --port ${REDIS_ACTIVITY_PORT}
|
||||
env_file: .env
|
||||
networks:
|
||||
- main
|
||||
restart: on-failure
|
||||
volumes:
|
||||
- ./redis.conf:/etc/redis/redis.conf
|
||||
- redis_activity_data:/data
|
||||
redis_broker:
|
||||
image: redis
|
||||
command: ["redis-server", "--appendonly", "yes"]
|
||||
command: redis-server --requirepass ${REDIS_BROKER_PASSWORD} --appendonly yes --port ${REDIS_BROKER_PORT}
|
||||
env_file: .env
|
||||
ports:
|
||||
- 6379:6379
|
||||
|
@ -55,6 +56,7 @@ services:
|
|||
- main
|
||||
restart: on-failure
|
||||
volumes:
|
||||
- ./redis.conf:/etc/redis/redis.conf
|
||||
- redis_broker_data:/data
|
||||
celery_worker:
|
||||
env_file: .env
|
||||
|
|
9
redis.conf
Normal file
9
redis.conf
Normal file
|
@ -0,0 +1,9 @@
|
|||
bind 127.0.0.1 ::1
|
||||
protected-mode yes
|
||||
port 6379
|
||||
|
||||
rename-command FLUSHDB ""
|
||||
rename-command FLUSHALL ""
|
||||
rename-command DEBUG ""
|
||||
rename-command CONFIG ""
|
||||
rename-command SHUTDOWN ""
|
Loading…
Reference in a new issue