Flask based website to display University of Miami geodesylab volcano displacement timeseries data.
| Location | Role |
|---|---|
$MINSAR_HOME/tools/VolcDef_web (this repo) |
Where you edit code in development (e.g. under minsar/tools/VolcDef_web). |
/var/www/VolcDef_web |
What Apache/WSGI actually runs (web.wsgi, volcdef_web/app.py, web_env). |
Changes made in the MinSAR repo are not live until you deploy them to /var/www/VolcDef_web, for example:
# Example: sync Python package (adjust host/user as needed)
sudo rsync -a --delete /path/to/minsar/tools/VolcDef_web/volcdef_web/ /var/www/VolcDef_web/volcdef_web/
sudo systemctl reload apache2Or maintain /var/www/VolcDef_web as a git clone / git pull of VolcDef_web and pull on the server after merging changes from the minsar copy.
- Go to
/var/www/and clone the repository:
git clone git@github.com:geodesymiami/VolcDef_web
(preferred), or if cloned into the $MINSAR_HOME/tools directory create a symbilic link:
sudo ln -s /home/exouser/code/minsar/tools/VolcDef_web /var/www
- In the VolcDef_web dir, install the required packages into a virtual environment:
python -m venv web_env
source web_env/bin/activate
pip install -r requirements.txt
-
Make sure the MAPBOX_ACCESS_TOKEN is set in
mapbox_access_token.env(orcp ~/accounts/mapbox_access_token.env .). -
Volcano list (production)
The app prefers/var/www/webconfig/volcanoes_volcdef.json, then sibling../webconfig/volcanoes_volcdef.json, thenWEBCONFIG_DIR/volcanoes_volcdef.jsonandvolcanoes.json, then bundleddata/. Seevolcdef_web/app.py(get_volcanoes_json_path).
In production,volcdef_web.confsetsSetEnv WEBCONFIG_DIR /var/www/webconfig.
To update the volcano list, runmake_volcdef_volcanoes_json.pywith--outdir /var/www/webconfig(or from that directory). Reload Apache after updating the JSON so WSGI reloads if you change code; JSON alone may require a process reload depending on setup. -
Run the website
cd volcdef_web/
python run.py
- Open Website at the given address (chrome/safari)
127.0.0.1:5000
or check using
curl -s http://127.0.0.1:5000
- On a remote server, to configure Apache copy volcdef_web.conf to /etc/apache2/sites-available/ (
sudo cp volcdef_web.conf /etc/apache2/sites-available/. It contains
<VirtualHost *:80>
# Alias directives must come BEFORE WSGIScriptAlias to prevent Flask from catching these URLs
# Serve /data/HDF5EOS/ as static files (bypass WSGI/Flask)
Alias /data/HDF5EOS/ /data/HDF5EOS/
<Directory /data/HDF5EOS/>
Options Indexes FollowSymLinks
Require all granted
</Directory>
# Serve /data/precip_plots/ as static files
Alias /data/precip_plots/ /data/precip_plots/
<Directory /data/precip_plots/>
Options Indexes FollowSymLinks
Require all granted
</Directory>
# Flask/WSGI configuration (must come AFTER Alias directives)
WSGIDaemonProcess precip_web python-home=/var/www/Precip_web/web_env python-path=/var/www/Precip_web
WSGIProcessGroup precip_web
WSGIScriptAlias / /var/www/Precip_web/web.wsgi
<Directory /var/www/Precip_web/>
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/precip_web_error.log
CustomLog ${APACHE_LOG_DIR}/precip_web_access.log combined
</VirtualHost>
- Start Apache using:
sudo a2ensite volcdef_web.conf
sudo systemctl restart apache2
- Check for errors using:
sudo tail -20 /var/log/apache2/error.log
If you see a Traceback, then python could not properly run your web.wsgi or app.py.