diff --git a/docker-compose.worker-memory.yml b/docker-compose.worker-memory.yml new file mode 100644 index 00000000..b2f7b98a --- /dev/null +++ b/docker-compose.worker-memory.yml @@ -0,0 +1,4 @@ +version: '2.1' +services: + worker: + mem_limit: ${WO_WORKER_MEMORY} \ No newline at end of file diff --git a/webodm.sh b/webodm.sh index 5320cab4..6e4bb395 100755 --- a/webodm.sh +++ b/webodm.sh @@ -135,6 +135,12 @@ case $key in export WO_SETTINGS shift # past argument shift # past value + ;; + --worker-memory) + WO_WORKER_MEMORY="$2" + export WO_WORKER_MEMORY + shift # past argument + shift # past value ;; *) # unknown option POSITIONAL+=("$1") # save it in an array for later @@ -178,6 +184,8 @@ usage(){ echo " --detached Run WebODM in detached mode. This means WebODM will run in the background, without blocking the terminal (default: disabled)" echo " --gpu Use GPU NodeODM nodes (Linux only) (default: disabled)" echo " --settings Path to a settings.py file to enable modifications of system settings (default: None)" + echo " --worker-memory Maximum amount of memory allocated for the worker process (default: unlimited)" + exit } @@ -348,6 +356,7 @@ start(){ echo "Celery Broker: $WO_BROKER" echo "Default Nodes: $WO_DEFAULT_NODES" echo "Settings: $WO_SETTINGS" + echo "Worker memory limit: $WO_WORKER_MEMORY" echo "================================" echo "Make sure to issue a $0 down if you decide to change the environment." echo "" @@ -418,6 +427,10 @@ start(){ command+=" -f docker-compose.settings.yml" fi + if [ ! -z "$WO_WORKER_MEMORY" ]; then + command+=" -f docker-compose.worker-memory.yml" + fi + command="$command up" if [[ $detached = true ]]; then