mirror of
https://github.com/frappe/gunicorn.git
synced 2026-07-02 18:51:31 +08:00
fix: use documented worker formula (2 * CPU + 1) in Docker image
This commit is contained in:
parent
469110d647
commit
4e656d3a91
@ -20,7 +20,7 @@ RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
|||||||
# GUNICORN_BIND - full bind address (default: [::]:8000, IPv4+IPv6)
|
# GUNICORN_BIND - full bind address (default: [::]:8000, IPv4+IPv6)
|
||||||
# GUNICORN_HOST - bind host (default: [::])
|
# GUNICORN_HOST - bind host (default: [::])
|
||||||
# GUNICORN_PORT - bind port (default: 8000)
|
# GUNICORN_PORT - bind port (default: 8000)
|
||||||
# GUNICORN_WORKERS - number of workers (default: number of CPUs)
|
# GUNICORN_WORKERS - number of workers (default: 2 * CPU + 1)
|
||||||
# GUNICORN_ARGS - additional arguments (e.g., "--timeout 120")
|
# GUNICORN_ARGS - additional arguments (e.g., "--timeout 120")
|
||||||
|
|
||||||
USER gunicorn
|
USER gunicorn
|
||||||
|
|||||||
@ -15,9 +15,9 @@ if [ "${1:0:1}" = '-' ] || [ -z "${1##*:*}" ]; then
|
|||||||
set -- --bind "$BIND" "$@"
|
set -- --bind "$BIND" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add workers if not specified - default to number of CPUs
|
# Add workers if not specified - default to (2 * CPU_COUNT) + 1
|
||||||
if [[ ! " $* $GUNICORN_ARGS " =~ " --workers " ]] && [[ ! " $* $GUNICORN_ARGS " =~ " -w " ]] && [[ ! "$* $GUNICORN_ARGS" =~ --workers= ]] && [[ ! "$* $GUNICORN_ARGS" =~ -w= ]]; then
|
if [[ ! " $* $GUNICORN_ARGS " =~ " --workers " ]] && [[ ! " $* $GUNICORN_ARGS " =~ " -w " ]] && [[ ! "$* $GUNICORN_ARGS" =~ --workers= ]] && [[ ! "$* $GUNICORN_ARGS" =~ -w= ]]; then
|
||||||
WORKERS="${GUNICORN_WORKERS:-$(nproc)}"
|
WORKERS="${GUNICORN_WORKERS:-$(( 2 * $(nproc) + 1 ))}"
|
||||||
set -- --workers "$WORKERS" "$@"
|
set -- --workers "$WORKERS" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ docker run -p 8000:8000 -v $(pwd):/app ghcr.io/benoitc/gunicorn app:app
|
|||||||
| `GUNICORN_BIND` | Full bind address | `[::]:8000` (IPv4+IPv6) |
|
| `GUNICORN_BIND` | Full bind address | `[::]:8000` (IPv4+IPv6) |
|
||||||
| `GUNICORN_HOST` | Bind host | `[::]` |
|
| `GUNICORN_HOST` | Bind host | `[::]` |
|
||||||
| `GUNICORN_PORT` | Bind port | `8000` |
|
| `GUNICORN_PORT` | Bind port | `8000` |
|
||||||
| `GUNICORN_WORKERS` | Number of workers | Number of CPUs |
|
| `GUNICORN_WORKERS` | Number of workers | `(2 * CPU) + 1` |
|
||||||
| `GUNICORN_ARGS` | Additional arguments | (none) |
|
| `GUNICORN_ARGS` | Additional arguments | (none) |
|
||||||
|
|
||||||
### With Configuration
|
### With Configuration
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user