use redis for session caching

This commit is contained in:
Denis Lehmann 2022-06-12 11:23:03 +02:00
parent 3abc11d873
commit 8969cff842
4 changed files with 93 additions and 30 deletions

View file

@ -60,9 +60,7 @@
A WSGI server like [[https://gunicorn.org/][Gunicorn]] can then be used to serve the app for example like this:
: $ gunicorn "raincloud:create_app(base_path='public')"
*Note* that currently only one worker makes sense due to server side session caching.
: $ gunicorn "raincloud:create_app(base_path='public', secret_key='i_am_a_key', redis_url='redis://127.0.0.1:6379/0')"
*** NixOS
@ -80,15 +78,18 @@
All configuration options are:
| Option | Description | Type | Default value | Example |
|-----------------+-----------------------------------+-------+---------------+----------------------|
| =address= | Bind address of the server | =str= | =127.0.0.1= | =0.0.0.0= |
| =port= | Port on which the server listens | =int= | =8000= | =5000= |
| =user= | User under which the server runs | =str= | =raincloud= | =alice= |
| =group= | Group under which the server runs | =str= | =raincloud= | =users= |
| =cloudName= | Name of the raincloud | =str= | =raincloud= | =bobsCloud= |
| =basePath= | Base path of the raincloud | =str= | | =/var/lib/raincloud= |
| =workerTimeout= | Gunicorn worker timeout | =int= | =300= | =360= |
| Option | Description | Type | Default value | Example |
|-----------------+---------------------------------------------------------------+-------+----------------------------+-------------------------------|
| =address= | Bind address of the server | =str= | =127.0.0.1= | =0.0.0.0= |
| =port= | Port on which the server listens | =int= | =8000= | =5000= |
| =user= | User under which the server runs | =str= | =raincloud= | =alice= |
| =group= | Group under which the server runs | =str= | =raincloud= | =users= |
| =cloudName= | Name of the raincloud | =str= | =raincloud= | =bobsCloud= |
| =basePath= | Base path of the raincloud | =str= | | =/var/lib/raincloud= |
| =secretKey= | Flask secret key | =str= | | =i_am_a_key= |
| =redisUrl= | URL of redis database | =str= | =redis://127.0.0.1:6379/0= | =redis://my_db_server:6379/0= |
| =numWorkers= | Number of Gunicorn workers (recommendation is: 2 x #CPUs + 1) | =int= | =5= | =17= |
| =workerTimeout= | Gunicorn worker timeout | =int= | =300= | =360= |
*** Docker
@ -111,13 +112,15 @@
** Configuration
/raincloud/ provides two configuration options which can be passed to =raincloud.create_app()=:
/raincloud/ provides four configuration options which can be passed to =raincloud.create_app()=:
- =base_path= :: Base path of the raincloud
- =secret_key= :: Flask secret key
- =redis_url= :: URL of redis database (default: =redis://127.0.0.1:6379/0=)
- =cloud_name= :: Cloud name (default: =raincloud=)
Set them for example like this:
: >>> app = raincloud.create_app(base_path='/home/alice/public', cloud_name='myCloud')
: >>> app = raincloud.create_app(base_path='/home/alice/public', secret_key='i_am_a_key', redis_url='redis://127.0.0.1:6379/0', cloud_name='raincloud')
*** =rc.conf=
:properties: