The code uses Python Flask to trigger the processing of input files from Hydroshare. By sending an HTTP GET request with the Hydroshare ID of the input files it will download them and run the engine.
To setup this Python Flask webserver on an Ubuntu System follow the steps below:
First obtain the scripts from this repository:
git clone https://github.com/uva-hydroinformatics-lab/AWS_MODFLOW.gitOn a fresh ubuntu instance install nginx, python, and gunicorn:
sudo apt-get install -y python python-pip nginx gunicornInstall the required python packages:
pip install flask hs_restclient numpy fiona rasterio flopySetup Nginx:
sudo /etc/init.d/nginx start
sudo rm /etc/nginx/sites-enabled/default
sudo touch /etc/nginx/sites-available/flask_project
sudo ln -s /etc/nginx/sites-available/flask_project /etc/nginx/sites-enabled/flask_project Then edit the config file
sudo vim /etc/nginx/sites-enabled/flask_projectserver {
location / {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}Restart Nginx:
sudo /etc/init.d/nginx restartStart the scrript using gunicorn:
cd AWS_MODFLOW
gunicorn app:app -b localhost:8000