From 28506b4034c2d376fbb2a55c8eb2bbe6bfac2ea1 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Mon, 11 Apr 2022 22:12:27 +0200 Subject: [PATCH 1/4] README.rst: Document enviroment variables --- README.rst | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/README.rst b/README.rst index 5955f967..6c2d1720 100644 --- a/README.rst +++ b/README.rst @@ -100,6 +100,111 @@ You can then build and run a docker image using ``docker-compose up --build``. PostgreSQL data is saved to ``~/.jawanndenn-docker-pgdata/`` on the host system. The app is served on ``localhost:54080``. +There is a few more environment variables that you could want to adjust in your environment. +Altogether, there are these variables: + + +Environment variables +--------------------- + +``DJANGO_SETTINGS_MODULE`` +~~~~~~~~~~~~~~~~~~~~~~~~~~ +Django settings module to use, leave as is, defaults to ``jawanndenn.settings`` +(see ``docker-compose.yml``) + + +``JAWANNDENN_ALLOWED_HOSTS`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Hostnames to serve jawanndenn at, list separated by comma, +is set to ``jawanndenn.de,www.jawanndenn.de`` on the main production server, +defaults to ``127.0.0.1,0.0.0.0,localhost`` +(see ``jawanndenn/settings.py``) + + +``JAWANNDENN_DEBUG`` +~~~~~~~~~~~~~~~~~~~~ +Debug mode, disabled for all values but ``True``, disabled by default, +should never be enabled in production for security +(see ``jawanndenn/settings.py``) + + +``JAWANNDENN_MAX_POLLS`` +~~~~~~~~~~~~~~~~~~~~~~~~ +Maximum total number of polls to store, denial of service protection, +defaults to ``1000`` +(see ``jawanndenn/settings.py`` and ``docker-compose.yml``) + + +``JAWANNDENN_MAX_VOTES_PER_POLL`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Maximum total number of polls to store, denial of service protection, +defaults to ``40`` +(see ``jawanndenn/settings.py``) + + +``JAWANNDENN_POSTGRES_HOST`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Hostname of the PostgreSQL database to connect to; defaults to ``postgres`` +(see ``docker-compose.yml``) + + +``JAWANNDENN_POSTGRES_NAME`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Database name of the PostgreSQL database to connect to; +no default, always required + + +``JAWANNDENN_POSTGRES_PASSWORD`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Password for log-in with the PostgreSQL database; +no default, always required + + +``JAWANNDENN_POSTGRES_PORT`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Port of the PostgreSQL database to connect to; defaults to ``5432`` +(see ``docker-compose.yml``) + + +``JAWANNDENN_POSTGRES_USER`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Username for log-in with the PostgreSQL database; +no default, always required + + +``JAWANNDENN_REDIS_HOST`` +~~~~~~~~~~~~~~~~~~~~~~~~~ +Hostname of the Redis database to connect to; defaults to ``redis`` +(see ``docker-compose.yml``) + + +``JAWANNDENN_REDIS_PORT`` +~~~~~~~~~~~~~~~~~~~~~~~~~ +Port of the Redis database to connect to; defaults to ``6379`` +(see ``docker-compose.yml``) + + +``JAWANNDENN_SECRET_KEY`` +~~~~~~~~~~~~~~~~~~~~~~~~~ +`Django secret key `_; +should be long, generated, not used elsewhere; no default, always required + + +``JAWANNDENN_SENTRY_DSN`` +~~~~~~~~~~~~~~~~~~~~~~~~~ +`Data source name (DSN) `_ +for use with `Sentry `_, disabled/empty by default +(see ``jawanndenn/settings.py``) + + +``JAWANNDENN_URL_PREFIX`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Prefix string to insert into URLs rather after the domain name +to help with hosting multiple apps under the same domain side by side; +e.g. prefix ``prefix123`` will result in URLs like ``https:///prefix123/poll/``; +empty by default +(see ``jawanndenn/settings.py``) + Command line usage ================== From 3815c229a47ec7cfd4936144045a3eb2a014ac6f Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Mon, 11 Apr 2022 22:13:46 +0200 Subject: [PATCH 2/4] README.rst: Highlight need for adjustment after copy-n-paste --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 6c2d1720..3c4372a9 100644 --- a/README.rst +++ b/README.rst @@ -93,7 +93,7 @@ Create a simple file ``.env`` like this one: JAWANNDENN_POSTGRES_PASSWORD=dEb2PIcinemA8poH JAWANNDENN_SECRET_KEY=606ea88f183a27919d5c27ec7f948906d23fdd7821684eb59e8bcf7377e3853b -Make sure to use your own values! +Make sure to **adjust these values** after copy and paste! You can then build and run a docker image using ``docker-compose up --build``. From cef28467dc29c3ae1142d655dadf7c694cc08952 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Mon, 11 Apr 2022 22:14:51 +0200 Subject: [PATCH 3/4] README.rst: Explain purpose of cron and Redis containers --- README.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 3c4372a9..84ed68fa 100644 --- a/README.rst +++ b/README.rst @@ -97,8 +97,11 @@ Make sure to **adjust these values** after copy and paste! You can then build and run a docker image using ``docker-compose up --build``. -PostgreSQL data is saved to ``~/.jawanndenn-docker-pgdata/`` on the host system. The app is served on ``localhost:54080``. +PostgreSQL data is saved to ``~/.jawanndenn-docker-pgdata/`` on the host system. +There is also an instance of Redis used for cross-process rate limiting, +and a "cron" housekeeping container that will go delete polls that have exceeded their +configured lifetime, every 60 minutes. There is a few more environment variables that you could want to adjust in your environment. Altogether, there are these variables: From a66fbd487c46853bf1d9f8a9c06b8b23a8c8bd69 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Mon, 11 Apr 2022 22:15:18 +0200 Subject: [PATCH 4/4] README.rst: Suggest docker-ssl-reverse-proxy for easy SSL https://github.com/hartwork/docker-ssl-reverse-proxy --- README.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.rst b/README.rst index 84ed68fa..1f00ae49 100644 --- a/README.rst +++ b/README.rst @@ -103,6 +103,10 @@ There is also an instance of Redis used for cross-process rate limiting, and a "cron" housekeeping container that will go delete polls that have exceeded their configured lifetime, every 60 minutes. +(If you need a low-maintenance SSL reverse proxy in front of jawanndenn, +`docker-ssl-reverse-proxy `_ +could be of interest.) + There is a few more environment variables that you could want to adjust in your environment. Altogether, there are these variables: