kopia lustrzana https://github.com/OpenDroneMap/WebODM
Merge pull request #718 from nchamo/multiple-node-odm-nodes
Load multiple NodeODM nodes on WebODM startuppull/719/head^2
commit
c7ca7f0e4b
1
.env
1
.env
|
@ -8,3 +8,4 @@ WO_SSL_INSECURE_PORT_REDIRECT=80
|
|||
WO_DEBUG=NO
|
||||
WO_DEV=NO
|
||||
WO_BROKER=redis://broker
|
||||
WO_DEFAULT_NODES=1
|
||||
|
|
|
@ -6,12 +6,11 @@ version: '2.1'
|
|||
services:
|
||||
webapp:
|
||||
depends_on:
|
||||
- node-odm-1
|
||||
- node-odm
|
||||
environment:
|
||||
- WO_CREATE_DEFAULT_PNODE=YES
|
||||
node-odm-1:
|
||||
- WO_DEFAULT_NODES
|
||||
node-odm:
|
||||
image: opendronemap/nodeodm
|
||||
container_name: node-odm-1
|
||||
ports:
|
||||
- "3000"
|
||||
restart: on-failure:10
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from nodeodm.models import ProcessingNode
|
||||
|
||||
def rename_default_node(apps, schema_editor):
|
||||
for default_node in ProcessingNode.objects.filter(hostname='node-odm-1'):
|
||||
default_node.hostname = 'webodm_node-odm_1'
|
||||
default_node.label = 'node-odm-1'
|
||||
default_node.save()
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('nodeodm', '0007_auto_20190520_1258'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(rename_default_node),
|
||||
]
|
4
start.sh
4
start.sh
|
@ -57,8 +57,8 @@ fi
|
|||
echo Running migrations
|
||||
python manage.py migrate
|
||||
|
||||
if [[ "$WO_CREATE_DEFAULT_PNODE" = "YES" ]]; then
|
||||
echo "from nodeodm.models import ProcessingNode; ProcessingNode.objects.update_or_create(hostname='node-odm-1', defaults={'hostname': 'node-odm-1', 'port': 3000})" | python manage.py shell
|
||||
if [[ "$WO_DEFAULT_NODES" > 0 ]]; then
|
||||
echo -e "from nodeodm.models import ProcessingNode\nfor node_index in map(str, range(1, $WO_DEFAULT_NODES + 1)):\n\t ProcessingNode.objects.update_or_create(hostname='webodm_node-odm_' + node_index, defaults={'hostname': 'webodm_node-odm_' + node_index, 'port': 3000, 'label': 'node-odm-' + node_index})" | python manage.py shell
|
||||
fi
|
||||
|
||||
if [[ "$WO_CREATE_MICMAC_PNODE" = "YES" ]]; then
|
||||
|
|
23
webodm.sh
23
webodm.sh
|
@ -18,7 +18,7 @@ if [[ $platform = "Windows" ]]; then
|
|||
export COMPOSE_CONVERT_WINDOWS_PATHS=1
|
||||
fi
|
||||
|
||||
load_default_node=true
|
||||
default_nodes=1
|
||||
dev_mode=false
|
||||
|
||||
# Load default values
|
||||
|
@ -87,7 +87,9 @@ case $key in
|
|||
shift # past value
|
||||
;;
|
||||
--no-default-node)
|
||||
load_default_node=false
|
||||
default_nodes=0
|
||||
echo "ATTENTION: --no-default-node is deprecated. Use --default-nodes instead."
|
||||
export WO_DEFAULT_NODES=0
|
||||
shift # past argument
|
||||
;;
|
||||
--with-micmac)
|
||||
|
@ -98,6 +100,12 @@ case $key in
|
|||
detached=true
|
||||
shift # past argument
|
||||
;;
|
||||
--default-nodes)
|
||||
default_nodes="$2"
|
||||
export WO_DEFAULT_NODES="$2"
|
||||
shift # past argument
|
||||
shift # past value
|
||||
;;
|
||||
*) # unknown option
|
||||
POSITIONAL+=("$1") # save it in an array for later
|
||||
shift # past argument
|
||||
|
@ -125,7 +133,7 @@ usage(){
|
|||
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 " --media-dir <path> Path where processing results will be stored to (default: $DEFAULT_MEDIA_DIR (docker named volume))"
|
||||
echo " --no-default-node Do not create a default NodeODM node attached to WebODM on startup (default: disabled)"
|
||||
echo " --default-nodes The amount of default NodeODM nodes attached to WebODM on startup (default: 1)"
|
||||
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-key <path> Manually specify a path to the private key file (.pem) to use with nginx to enable SSL (default: None)"
|
||||
|
@ -193,13 +201,14 @@ start(){
|
|||
echo "SSL certificate: $WO_SSL_CERT"
|
||||
echo "SSL insecure port redirect: $WO_SSL_INSECURE_PORT_REDIRECT"
|
||||
echo "Celery Broker: $WO_BROKER"
|
||||
echo "Default Nodes: $WO_DEFAULT_NODES"
|
||||
echo "================================"
|
||||
echo "Make sure to issue a $0 down if you decide to change the environment."
|
||||
echo ""
|
||||
|
||||
command="docker-compose -f docker-compose.yml"
|
||||
|
||||
if [[ $load_default_node = true ]]; then
|
||||
if [[ $default_nodes > 0 ]]; then
|
||||
command+=" -f docker-compose.nodeodm.yml"
|
||||
fi
|
||||
|
||||
|
@ -255,6 +264,10 @@ start(){
|
|||
command+=" -d"
|
||||
fi
|
||||
|
||||
if [[ $default_nodes > 0 ]]; then
|
||||
command+=" --scale node-odm=$default_nodes"
|
||||
fi
|
||||
|
||||
run "$command"
|
||||
}
|
||||
|
||||
|
@ -338,7 +351,7 @@ elif [[ $1 = "update" ]]; then
|
|||
|
||||
command="docker-compose -f docker-compose.yml"
|
||||
|
||||
if [[ $load_default_node = true ]]; then
|
||||
if [[ $default_nodes > 0 ]]; then
|
||||
command+=" -f docker-compose.nodeodm.yml"
|
||||
fi
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue