diff --git a/docker-compose.nodeodm.yml b/docker-compose.nodeodm.yml new file mode 100644 index 00000000..ddb2965f --- /dev/null +++ b/docker-compose.nodeodm.yml @@ -0,0 +1,12 @@ +# Chaining this file to the main docker-compose file adds +# a default processing node instance. This is best for users +# who are just getting started with WebODM. + +services: + webapp: + entrypoint: /bin/bash -c "chmod +x /webodm/*.sh && /webodm/wait-for-it.sh db:5432 -- /webodm/start.sh --create-default-pnode" + node-odm-1: + image: pierotofy/nodeodm + container_name: node-odm-1 + ports: + - "3000" diff --git a/docker-compose.yml b/docker-compose.yml index 02bbc673..4e7797f7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,5 @@ +# This configuration does not include a processing node +# Which makes for faster setup times version: '2' services: db: diff --git a/start.sh b/start.sh index 8b1a8516..68c5b8ba 100644 --- a/start.sh +++ b/start.sh @@ -1,4 +1,25 @@ #!/bin/bash + +echo -e "\e[92m" +echo " _ __ __ ____ ____ __ ___" +echo "| | / /__ / /_ / __ \/ __ \/ |/ /" +echo "| | /| / / _ \/ __ \/ / / / / / / /|_/ / " +echo "| |/ |/ / __/ /_/ / /_/ / /_/ / / / / " +echo "|__/|__/\___/_.___/\____/_____/_/ /_/ " +echo +echo -e "\e[39m" + +python -c "import sys;ret = 1 if sys.version_info <= (3, 0) else 0;print('Checking python version... ' + ('3.x, good!' if ret == 0 else '2.x'));sys.exit(ret);" +if [ $? -eq 1 ]; then + echo + echo "====================" + echo "You're almost there!" + echo "====================" + echo -e "\e[33mYour system is currently using Python 2.x. You need to install or configure your system to use Python 3.x. Check out http://docs.python-guide.org/en/latest/dev/virtualenvs/ for information on how to setup Python 3.x alongside your Python 2.x install.\e[39m" + echo + exit +fi + echo Building asssets... webpack @@ -6,4 +27,8 @@ echo Running migrations python manage.py makemigrations python manage.py migrate +if [ $1 = "--create-default-pnode" ]; 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 +fi + python manage.py runserver 0.0.0.0:8000 \ No newline at end of file