IS-AgroSmart / AgroSmart-Web

1 stars 1 forks source link

Allow Django app to use configurable/remote NodeODM server #113

Closed jreyesr closed 3 years ago

jreyesr commented 3 years ago

This PR adds support for configurable and decoupled NodeODM servers. Currently, NodeODM is slightly coupled to the app, in a couple of ways:

  1. The NodeODM URL is hardcoded in a bunch of places (http://container-nodeodm:3000/...)
  2. The post-processing code (run in the webhook that gets called when a Flight finishes processing) assumes that the results can be reached on /flights/uuid/whatever. When the local NodeODM container has control over that folder, the assumption is correct, but when using a remote NodeODM provider, that folder won't even exist.

This PR fixes both problems:

  1. The references to the NodeODM URL have been replaced by a configuration variable that can be easily switched to point to the local NodeODM container (http://container-nodeodm:3000/) or a remote server (https://spark1.webodm.net:443).
  2. The webhook now downloads the results via HTTP (they get downloaded as a ZIP file) and decompresses them on the proper folder (/flights/uuid), after creating the directory. In this way, all post-processing code finds its desired results in the correct place, and everybody is happy.
sonarcloud[bot] commented 3 years ago

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

42.9% 42.9% Coverage
0.0% 0.0% Duplication