From c53ba7b119a319dc53ef2099e20c5b34ca993722 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 3 Sep 2022 17:02:57 +0200 Subject: [PATCH] Exported defaults for env vars in docker only when the runtime is RoadRunner --- docker/docker-entrypoint.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 065afa2a..1955f0ec 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -32,9 +32,12 @@ if [ $ENABLE_PERIODIC_VISIT_LOCATE ]; then fi # RoadRunner config needs these to have been set, so falling back to default values if not set yet -export PORT="${PORT:-"8080"}" -export WEB_WORKER_NUM="${WEB_WORKER_NUM:-"16"}" -export TASK_WORKER_NUM="${TASK_WORKER_NUM:-"16"}" +if [ "$SHLINK_RUNTIME" == 'rr' ]; then + export PORT="${PORT:-"8080"}" + # Default to 0 so that RoadRunner decides the number of workers based on the amount of logical CPUs + export WEB_WORKER_NUM="${WEB_WORKER_NUM:-"0"}" + export TASK_WORKER_NUM="${TASK_WORKER_NUM:-"0"}" +fi if [ "$SHLINK_RUNTIME" == 'openswoole' ]; then # When restarting the container, openswoole might think it is already in execution