Commit acd93479 authored by David Zülke's avatar David Zülke Committed by Kenneth Reitz

Handle and produce leading 0 in WEB_CONCURRENCY (#355)

The Node buildpack now exports a leading zero in its numbers. This lets us detect that it (or another buildpack) set the value, and overwrite it accordingly.

Fixes the issue where adding the node buildpack to a Python app would cause only one gunicorn worker to be spawned for a 1X dyno, and not two.

We also need to again produce leading zeroes in the value, so that e.g. the PHP buildpack can do the same on boot.
parent d7e2f0fb
if [[ "${WEB_CONCURRENCY:-}" == 0* ]]; then
# another buildpack set a default value, with leading zero
unset WEB_CONCURRENCY
fi
case $(ulimit -u) in case $(ulimit -u) in
# Automatic configuration for Gunicorn's Workers setting. # Automatic configuration for Gunicorn's Workers setting.
# Leading zero padding so a subsequent buildpack can figure out that we set a value, and not the user
# Standard-1X (+Free, +Hobby) Dyno # Standard-1X (+Free, +Hobby) Dyno
256) 256)
export DYNO_RAM=512 export DYNO_RAM=512
export WEB_CONCURRENCY=${WEB_CONCURRENCY:-2} export WEB_CONCURRENCY=${WEB_CONCURRENCY:-02}
;; ;;
# Standard-2X Dyno # Standard-2X Dyno
512) 512)
export DYNO_RAM=1024 export DYNO_RAM=1024
export WEB_CONCURRENCY=${WEB_CONCURRENCY:-4} export WEB_CONCURRENCY=${WEB_CONCURRENCY:-04}
;; ;;
# Performance-M Dyno # Performance-M Dyno
16384) 16384)
export DYNO_RAM=2560 export DYNO_RAM=2560
export WEB_CONCURRENCY=${WEB_CONCURRENCY:-8} export WEB_CONCURRENCY=${WEB_CONCURRENCY:-08}
;; ;;
# Performance-L Dyno # Performance-L Dyno
32768) 32768)
export DYNO_RAM=6656 export DYNO_RAM=6656
export WEB_CONCURRENCY=${WEB_CONCURRENCY:-11} export WEB_CONCURRENCY=${WEB_CONCURRENCY:-011}
;; ;;
esac esac
# Automatic configuration for Gunicorn's ForwardedAllowIPS setting. # Automatic configuration for Gunicorn's ForwardedAllowIPS setting.
export FORWARDED_ALLOW_IPS='*' export FORWARDED_ALLOW_IPS='*'
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment