From c4ba8cc7355bbfa1f03a627bc55a57cc62da1f0d Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Sun, 21 May 2017 15:08:19 -0400 Subject: [PATCH] Added contrib install script, updated readme, start.sh --- README.md | 23 ++++++++++--- contrib/ubuntu_1604_install.sh | 62 ++++++++++++++++++++++++++++++++++ start.sh | 2 +- 3 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 contrib/ubuntu_1604_install.sh diff --git a/README.md b/README.md index b7cb5b9f..00757297 100644 --- a/README.md +++ b/README.md @@ -135,17 +135,22 @@ screen -r webodm ## Run it natively -If you want to run WebODM natively, you will need to install: +WebODM can run natively on Windows, MacOS and Linux. + +Ubuntu 16.04 LTS users can refer to this [script](/contrib/ubuntu_1604_install.sh) to install WebODM natively on a new machine. + +To run WebODM, you will need to install: * PostgreSQL (>= 9.5) * PostGIS 2.3 * Python 3.5 * GDAL (>= 2.1) * Node.js (>= 6.0) + * Nginx (Linux/MacOS) - OR - Apache + mod_wsgi (Windows) On Linux, make sure you have: ```bash -apt-get install binutils libproj-dev gdal-bin +apt-get install binutils libproj-dev gdal-bin nginx ``` On Windows use the [OSGeo4W](https://trac.osgeo.org/osgeo4w/) installer to install GDAL. MacOS users can use: @@ -189,7 +194,17 @@ pip install -r requirements.txt sudo npm install -g webpack npm install webpack -chmod +x start.sh && ./start.sh +chmod +x start.sh && ./start.sh --no-gunicorn +``` + +The `start.sh` script will use Django's built-in server if you pass the `--no-gunicorn` parameter. This is good for testing, but bad for production. + +In production, if you have nginx installed, modify the configuration file in `nginx/nginx.conf` to match your system's configuration and just run `start.sh` without parameters. + +Windows users should refer to [this guide](https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/modwsgi/) to install Apache + mod_wsgi and run gunicorn: + +```bash +gunicorn webodm.wsgi --bind 0.0.0.0:8000 --preload ``` If you are getting a `rt_raster_gdal_warp: Could not create GDAL transformation object for output dataset creation`, make sure that your PostGIS installation has PROJ support: @@ -217,8 +232,6 @@ gdalinfo --version ``` Should all work without errors. -Ubuntu 16.04 LTS users can refer to this [script](https://gist.githubusercontent.com/lkpanganiban/5226cc8dd59cb39cdc1946259c3fea6e/raw/f9f41ad0c1dfdd2d26a452d3b2732dbaf3fd3608/webodm_install.sh) to install WebODM natively on a new machine. - ## OpenDroneMap, node-OpenDroneMap, WebODM... what? The [OpenDroneMap project](https://github.com/OpenDroneMap/) is composed of several components. diff --git a/contrib/ubuntu_1604_install.sh b/contrib/ubuntu_1604_install.sh new file mode 100644 index 00000000..5800c70b --- /dev/null +++ b/contrib/ubuntu_1604_install.sh @@ -0,0 +1,62 @@ +# Configure system libs +sudo apt-get autoremove -y install-info +sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable +sudo apt-get update +sudo apt-get install -y python-dev libpq-dev gdal-bin libgdal-dev libproj-dev python-virtualenv python3-dev + +# Setup Postgres +ppaexists=$( grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep postgres ) +if [ ! $ppaexists ]; then + echo "Add PostgreSQL PPA..." + add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" + sudo wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - + apt-get update +else + echo "PostgreSQL PPA already exists..." +fi + +sudo apt-get install -y postgresql-9.6 +sudo apt-get install -y postgresql-9.6-postgis-2.3 +sudo apt-get install -y python-psycopg2 +sudo -u postgres bash -c "psql -c \"CREATE USER postgres WITH PASSWORD 'postgres';\"" +sudo -u postgres bash -c "psql -c \"ALTER ROLE postgres WITH SUPERUSER;\"" +sudo -u postgres createdb -O postgres webodm_dev -E utf-8 +sudo -u postgres bash -c "psql -d webodm_dev -c \"CREATE EXTENSION postgis;\"" +sudo -u postgres bash -c "psql -d webodm_dev -c \"SET postgis.enable_outdb_rasters TO True;\"" +sudo -u postgres bash -c "psql -d webodm_dev -c \"SET postgis.gdal_enabled_drivers TO 'GTiff';\"" + +# Add nginx +sudo apt-get install nginx -y + +# Setup nodejs +curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh +sudo bash nodesource_setup.sh +sudo apt-get update +sudo apt-get install nodejs +sudo ln -s /usr/bin/nodejs /usr/bin/node +sudo npm install -g bower + +# Setup virtualenv +virtualenv -p python3 env +. env/bin/activate + +cd webodm/ + +pip install -r requirements.txt + +# Build assets +sudo npm install -g webpack +npm install +webpack + +# Configure other settings +cp webodm/settings.py webodm/local_settings.py + + +# Configure Docker (Processing Nodes) +sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D +sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main' +sudo apt-get update +sudo apt-get install -y docker-engine +sudo systemctl status docker +sudo usermod -aG docker $(whoami) diff --git a/start.sh b/start.sh index dce529a0..58929c1a 100755 --- a/start.sh +++ b/start.sh @@ -76,7 +76,7 @@ echo Open a web browser and navigate to http://localhost:8000 echo -e "\033[39m" echo -e "\033[91mNOTE:\033[39m Windows users using docker should replace localhost with the IP of their docker machine's IP. To find what that is, run: docker-machine ip") & -if [ "$1" = "--setup-devenv" ] || [ "$2" = "--setup-devenv" ]; then +if [ "$1" = "--setup-devenv" ] || [ "$2" = "--setup-devenv" ] || [ "$1" = "--no-gunicorn" ]; then python manage.py runserver 0.0.0.0:8000 else nginx -c /webodm/nginx/nginx.conf