webodm.sh: remove default_nodes and respect WO_DEFAULT_NODES from .env

This fixes #1131 and harmonizes the way WO_DEFAULT_NODES is managed.
pull/1132/head
Romain Bazile 2022-02-01 12:19:59 +01:00
rodzic 6a16b1593c
commit 90dd3db1b7
1 zmienionych plików z 6 dodań i 8 usunięć

Wyświetl plik

@ -18,7 +18,6 @@ if [[ $platform = "Windows" ]]; then
export COMPOSE_CONVERT_WINDOWS_PATHS=1 export COMPOSE_CONVERT_WINDOWS_PATHS=1
fi fi
default_nodes=1
dev_mode=false dev_mode=false
gpu=false gpu=false
@ -37,6 +36,7 @@ DEFAULT_MEDIA_DIR="$WO_MEDIA_DIR"
DEFAULT_SSL="$WO_SSL" DEFAULT_SSL="$WO_SSL"
DEFAULT_SSL_INSECURE_PORT_REDIRECT="$WO_SSL_INSECURE_PORT_REDIRECT" DEFAULT_SSL_INSECURE_PORT_REDIRECT="$WO_SSL_INSECURE_PORT_REDIRECT"
DEFAULT_BROKER="$WO_BROKER" DEFAULT_BROKER="$WO_BROKER"
DEFAULT_NODES="$WO_DEFAULT_NODES"
# Parse args for overrides # Parse args for overrides
POSITIONAL=() POSITIONAL=()
@ -103,7 +103,6 @@ case $key in
shift # past value shift # past value
;; ;;
--no-default-node) --no-default-node)
default_nodes=0
echo "ATTENTION: --no-default-node is deprecated. Use --default-nodes instead." echo "ATTENTION: --no-default-node is deprecated. Use --default-nodes instead."
export WO_DEFAULT_NODES=0 export WO_DEFAULT_NODES=0
shift # past argument shift # past argument
@ -117,7 +116,6 @@ case $key in
shift # past argument shift # past argument
;; ;;
--default-nodes) --default-nodes)
default_nodes="$2"
export WO_DEFAULT_NODES="$2" export WO_DEFAULT_NODES="$2"
shift # past argument shift # past argument
shift # past value shift # past value
@ -149,7 +147,7 @@ usage(){
echo " --port <port> Set the port that WebODM should bind to (default: $DEFAULT_PORT)" echo " --port <port> Set the port that WebODM should bind to (default: $DEFAULT_PORT)"
echo " --hostname <hostname> Set the hostname that WebODM will be accessible from (default: $DEFAULT_HOST)" echo " --hostname <hostname> Set the hostname that WebODM will be accessible from (default: $DEFAULT_HOST)"
echo " --media-dir <path> Path where processing results will be stored to (default: $DEFAULT_MEDIA_DIR (docker named volume))" echo " --media-dir <path> Path where processing results will be stored to (default: $DEFAULT_MEDIA_DIR (docker named volume))"
echo " --default-nodes The amount of default NodeODM nodes attached to WebODM on startup (default: 1)" echo " --default-nodes The amount of default NodeODM nodes attached to WebODM on startup (default: $DEFAULT_NODES)"
echo " --with-micmac Create a NodeMICMAC node attached to WebODM on startup. Experimental! (default: disabled)" echo " --with-micmac Create a NodeMICMAC node attached to WebODM on startup. Experimental! (default: disabled)"
echo " --ssl Enable SSL and automatically request and install a certificate from letsencrypt.org. (default: $DEFAULT_SSL)" echo " --ssl Enable SSL and automatically request and install a certificate from letsencrypt.org. (default: $DEFAULT_SSL)"
echo " --ssl-key <path> Manually specify a path to the private key file (.pem) to use with nginx to enable SSL (default: None)" echo " --ssl-key <path> Manually specify a path to the private key file (.pem) to use with nginx to enable SSL (default: None)"
@ -279,7 +277,7 @@ start(){
command="docker-compose -f docker-compose.yml" command="docker-compose -f docker-compose.yml"
if [[ $default_nodes > 0 ]]; then if [[ $WO_DEFAULT_NODES > 0 ]]; then
if [ "${GPU_NVIDIA}" = true ]; then if [ "${GPU_NVIDIA}" = true ]; then
command+=" -f docker-compose.nodeodm.gpu.nvidia.yml" command+=" -f docker-compose.nodeodm.gpu.nvidia.yml"
elif [ "${GPU_INTEL}" = true ]; then elif [ "${GPU_INTEL}" = true ]; then
@ -341,8 +339,8 @@ start(){
command+=" -d" command+=" -d"
fi fi
if [[ $default_nodes > 0 ]]; then if [[ $WO_DEFAULT_NODES > 0 ]]; then
command+=" --scale node-odm=$default_nodes" command+=" --scale node-odm=$WO_DEFAULT_NODES"
fi fi
run "$command" run "$command"
@ -461,7 +459,7 @@ elif [[ $1 = "update" ]]; then
command="docker-compose -f docker-compose.yml" command="docker-compose -f docker-compose.yml"
if [[ $default_nodes > 0 ]]; then if [[ $WO_DEFAULT_NODES > 0 ]]; then
if [ "${GPU_NVIDIA}" = true ]; then if [ "${GPU_NVIDIA}" = true ]; then
command+=" -f docker-compose.nodeodm.gpu.nvidia.yml" command+=" -f docker-compose.nodeodm.gpu.nvidia.yml"
elif [ "${GPU_INTEL}" = true ]; then elif [ "${GPU_INTEL}" = true ]; then