Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compose/production/django/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -o nounset


# N.B. If only .env files supported variable expansion...
export CELERY_BROKER_URL="${REDIS_URL}"
export CELERY_BROKER_URL="${CELERY_BROKER_URL:-${REDIS_URL}}"


if [ -z "${POSTGRES_USER}" ]; then
Expand Down
7 changes: 6 additions & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,11 @@
CELERY_BROKER_URL = env("CELERY_BROKER_URL")
# http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-result_backend
CELERY_RESULT_BACKEND = CELERY_BROKER_URL
# Redis broker/backend connection pools are per process. Keep them bounded so
# web, worker, beat and monitoring replicas cannot accumulate thousands of idle
# sockets after traffic or pod churn.
CELERY_BROKER_POOL_LIMIT = env.int("CELERY_BROKER_POOL_LIMIT", default=5)
CELERY_REDIS_MAX_CONNECTIONS = env.int("CELERY_REDIS_MAX_CONNECTIONS", default=20)
# http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-accept_content
CELERY_ACCEPT_CONTENT = ["json"]
# http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-task_serializer
Expand Down Expand Up @@ -721,4 +726,4 @@


# LINK TO OLD SCIELO
SCIELO_OLD_URL = env.str("SCIELO_OLD_URL", default="http://old.scielo.org/")
SCIELO_OLD_URL = env.str("SCIELO_OLD_URL", default="http://old.scielo.org/")
12 changes: 12 additions & 0 deletions config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@
"LOCATION": "redis://redis:6379",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"CONNECTION_POOL_CLASS": "redis.BlockingConnectionPool",
"CONNECTION_POOL_KWARGS": {
"max_connections": env.int("REDIS_CACHE_MAX_CONNECTIONS", default=20),
"timeout": env.int("REDIS_CACHE_POOL_TIMEOUT", default=2),
"health_check_interval": env.int(
"REDIS_HEALTH_CHECK_INTERVAL", default=30
),
},
"SOCKET_CONNECT_TIMEOUT": env.int(
"REDIS_SOCKET_CONNECT_TIMEOUT", default=2
),
"SOCKET_TIMEOUT": env.int("REDIS_SOCKET_TIMEOUT", default=2),
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@
"LOCATION": env("REDIS_URL"),
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"CONNECTION_POOL_CLASS": "redis.BlockingConnectionPool",
"CONNECTION_POOL_KWARGS": {
"max_connections": env.int("REDIS_CACHE_MAX_CONNECTIONS", default=20),
"timeout": env.int("REDIS_CACHE_POOL_TIMEOUT", default=2),
"health_check_interval": env.int(
"REDIS_HEALTH_CHECK_INTERVAL", default=30
),
},
"SOCKET_CONNECT_TIMEOUT": env.int(
"REDIS_SOCKET_CONNECT_TIMEOUT", default=2
),
"SOCKET_TIMEOUT": env.int("REDIS_SOCKET_TIMEOUT", default=2),
# Mimicing memcache behavior.
# https://github.com/jazzband/django-redis#memcached-exceptions-behavior
"IGNORE_EXCEPTIONS": True,
Expand Down
Loading