add REDIS_SSL_CERT_REQS cli parameter (#1495)

* add REDIS_SSL_CERT_REQS cli parameter

* update docs

Co-authored-by: dan <dan@betterfin.com>
main
mgcdanny 3 years ago committed by GitHub
parent d813ea5e18
commit 76ba690aaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,7 +3,6 @@ title: "RQ: Using RQ on Heroku"
layout: patterns layout: patterns
--- ---
## Using RQ on Heroku ## Using RQ on Heroku
To setup RQ on [Heroku][1], first add it to your To setup RQ on [Heroku][1], first add it to your
@ -48,14 +47,41 @@ Now, all you have to do is spin up a worker:
$ heroku scale worker=1 $ heroku scale worker=1
{% endhighlight %} {% endhighlight %}
If you are using [Heroku Redis][5]) you might need to change the Redis connection as follows:
{% highlight console %}
conn = redis.Redis(
host=host,
password=password,
port=port,
ssl=True,
ssl_cert_reqs=None
)
{% endhighlight %}
and for using the cli:
{% highlight console %}
rq info --config rq_conf
{% endhighlight %}{% endhighlight %}
Where the rq_conf.py file looks like:
{% highlight console %}
REDIS_HOST = "host"
REDIS_PORT = port
REDIS_PASSWORD = "password"
REDIS_SSL = True
REDIS_SSL_CA_CERTS = None
REDIS_DB = 0
REDIS_SSL_CERT_REQS = None
{% endhighlight %}{% endhighlight %}
## Putting RQ under foreman ## Putting RQ under foreman
[Foreman][3] is probably the process manager you use when you host your app on [Foreman][3] is probably the process manager you use when you host your app on
Heroku, or just because it's a pretty friendly tool to use in development. Heroku, or just because it's a pretty friendly tool to use in development.
When using RQ under `foreman`, you may experience that the workers are a bit When using RQ under `foreman`, you may experience that the workers are a bit quiet sometimes. This is because of Python buffering the output, so `foreman`
quiet sometimes. This is because of Python buffering the output, so `foreman`
cannot (yet) echo it. Here's a related [Wiki page][4]. cannot (yet) echo it. Here's a related [Wiki page][4].
Just change the way you run your worker process, by adding the `-u` option (to Just change the way you run your worker process, by adding the `-u` option (to
@ -67,3 +93,4 @@ force stdin, stdout and stderr to be totally unbuffered):
[2]: https://devcenter.heroku.com/articles/redistogo [2]: https://devcenter.heroku.com/articles/redistogo
[3]: https://github.com/ddollar/foreman [3]: https://github.com/ddollar/foreman
[4]: https://github.com/ddollar/foreman/wiki/Missing-Output [4]: https://github.com/ddollar/foreman/wiki/Missing-Output
[5]: https://elements.heroku.com/addons/heroku-redis

@ -71,6 +71,7 @@ def get_redis_from_config(settings, connection_class=Redis):
'password': settings.get('REDIS_PASSWORD', None), 'password': settings.get('REDIS_PASSWORD', None),
'ssl': ssl, 'ssl': ssl,
'ssl_ca_certs': settings.get('REDIS_SSL_CA_CERTS', None), 'ssl_ca_certs': settings.get('REDIS_SSL_CA_CERTS', None),
'ssl_cert_reqs': settings.get('REDIS_SSL_CERT_REQS', 'required'),
} }
return connection_class(**kwargs) return connection_class(**kwargs)

Loading…
Cancel
Save