From 6204941a5d0d6963369752f81c56a469a32d7c3b Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Mon, 4 Jan 2021 18:30:24 +0530 Subject: [PATCH 1/2] feat(frappe-nginx): configurable nginx http timeout --- build/common/nginx-default.conf.template | 2 +- build/frappe-nginx/docker-entrypoint.sh | 11 +++++++---- docs/environment-variables.md | 22 ++++++++++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 docs/environment-variables.md diff --git a/build/common/nginx-default.conf.template b/build/common/nginx-default.conf.template index 09575391..2008e655 100644 --- a/build/common/nginx-default.conf.template +++ b/build/common/nginx-default.conf.template @@ -55,7 +55,7 @@ server { proxy_set_header X-Frappe-Site-Name $host; proxy_set_header Host $http_host; proxy_set_header X-Use-X-Accel-Redirect True; - proxy_read_timeout 120; + proxy_read_timeout ${HTTP_TIMEOUT}; proxy_redirect off; proxy_pass http://frappe-server; diff --git a/build/frappe-nginx/docker-entrypoint.sh b/build/frappe-nginx/docker-entrypoint.sh index 69431038..5d905bdf 100755 --- a/build/frappe-nginx/docker-entrypoint.sh +++ b/build/frappe-nginx/docker-entrypoint.sh @@ -31,12 +31,15 @@ if [[ -z "$SOCKETIO_PORT" ]]; then export SOCKETIO_PORT=9000 fi -envsubst '${API_HOST} - ${API_PORT} - ${FRAPPE_PY} +if [[ -z "$HTTP_TIMEOUT" ]]; then + export HTTP_TIMEOUT=120 +fi + +envsubst '${FRAPPE_PY} ${FRAPPE_PY_PORT} ${FRAPPE_SOCKETIO} - ${SOCKETIO_PORT}' \ + ${SOCKETIO_PORT} + ${HTTP_TIMEOUT}' \ < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf echo "Waiting for frappe-python to be available on $FRAPPE_PY port $FRAPPE_PY_PORT" diff --git a/docs/environment-variables.md b/docs/environment-variables.md new file mode 100644 index 00000000..943db4fc --- /dev/null +++ b/docs/environment-variables.md @@ -0,0 +1,22 @@ +List of environment variables for containers + +### frappe-worker and erpnext-worker + +Following environment variables are set into sites volume as `common_site_config.json`. It means once the file is created in volume, the variables won't have any effect, you need to edit the common_site_config.json to update the configuration + +- `DB_HOST`: MariaDB host, domain name or ip address. +- `DB_PORT`: MariaDB port. +- `REDIS_CACHE`: Redis cache host, domain name or ip address. +- `REDIS_QUEUE`: Redis queue host, domain name or ip address. +- `REDIS_SOCKETIO`: Redis queue host, domain name or ip address. +- `SOCKETIO_PORT: `: Port on which the SocketIO should start. + +### frappe-nginx and erpnext-nginx + +These variables are set on every container start. Change in these variables will reflect on every container start. + +- `FRAPPE_PY`: Gunicorn host to reverse proxy. Default: 0.0.0.0 +- `FRAPPE_PY_PORT`: Gunicorn port to reverse proxy. Default: 8000 +- `FRAPPE_SOCKETIO`: SocketIO host to reverse proxy. Default: 0.0.0.0 +- `SOCKETIO_PORT`: SocketIO port to reverse proxy. Default: 9000 +- `HTTP_TIMEOUT`: Nginx http timeout. Default: 120 From 092348d7489c86207e16851d9cd9afdceebb1b2d Mon Sep 17 00:00:00 2001 From: Revant Nandgaonkar Date: Mon, 4 Jan 2021 18:45:42 +0530 Subject: [PATCH 2/2] docs(frappe-nginx): configurable nginx http timeout [skip travis] --- README.md | 5 +++-- docs/environment-variables.md | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6b980d81..3a47895e 100644 --- a/README.md +++ b/README.md @@ -42,8 +42,9 @@ It takes care of the following: 1. [Docker Swarm](docs/docker-swarm.md) 2. [Kubernetes](https://helm.erpnext.com) 3. [Site Operations](docs/site-operations.md) -4. [Custom apps for production](docs/custom-apps-for-production.md) -5. [Tips for moving deployments](docs/tips-for-moving-deployments.md) +4. [Environment Variables](docs/environment-variables.md) +5. [Custom apps for production](docs/custom-apps-for-production.md) +6. [Tips for moving deployments](docs/tips-for-moving-deployments.md) ## Development Setup diff --git a/docs/environment-variables.md b/docs/environment-variables.md index 943db4fc..3aa2e7cc 100644 --- a/docs/environment-variables.md +++ b/docs/environment-variables.md @@ -20,3 +20,7 @@ These variables are set on every container start. Change in these variables will - `FRAPPE_SOCKETIO`: SocketIO host to reverse proxy. Default: 0.0.0.0 - `SOCKETIO_PORT`: SocketIO port to reverse proxy. Default: 9000 - `HTTP_TIMEOUT`: Nginx http timeout. Default: 120 + +### frappe-socketio + +This container takes configuration from `common_site_config.json` which is already created by erpnext gunicorn container. It doesn't use any environment variables.