milesmcc / shynet

Modern, privacy-friendly, and detailed web analytics that works without cookies or JS.
Apache License 2.0
2.91k stars 188 forks source link

chore(`celery`): add option for master_name that goes here #287

Closed kashalls closed 1 year ago

kashalls commented 1 year ago

Adds an option for celery transport options to allow sentinel options with redis Solves #285.

kashalls commented 1 year ago

Sorry about the no information being posted, needed a bit to type this up. I'm unfamiliar with Python so I'm doing my best here.

According to the celery backends and brokers documentation, when connecting to a Redis Sentinel Cluster you need to bind app.conf.broker_transport_options with { 'master_name': "cluster1" } with cluster1 being the name of the cluster.

So in the case of using shynet inside of a kubernetes cluster using bitnami's redis chart (see my use case here), you would need to pass your env with this:

BROKER_TRANSPORT_OPTIONS: "{'master_name':'redis-master'}"
CELERY_BROKER_URL: "sentinel://redis-node-0.redis-headless.default.svc.cluster.local:26379/6;sentinel://redis-node-1.redis-headless.default.svc.cluster.local:26379/6;sentinel://redis-node-2.redis-headless.default.svc.cluster.local:26379/6"

AFAIK, this should be all that is needed to make this work after talking with @ZandercraftGames who avidly uses shynet itself.

milesmcc commented 1 year ago

Thanks!