Web portal built for ShakeMap4 package
  • JavaScript 57.5%
  • Dockerfile 18.5%
  • HTML 14.8%
  • CSS 3.5%
  • Python 3.3%
  • Other 2.4%
Find a file
2021-04-12 21:42:57 -04:00
.circleci Moved all javascript files but config.js into the folder scripts. 2020-11-15 23:14:28 +01:00
data Fixed bug where the events.js file was not updating when specifying a new event_id as the argument 2020-10-21 12:44:03 +02:00
Docker I don't know why I'm getting a bug on pip upgrade 2021-04-05 11:34:54 -04:00
images PRSMP Rebrand 2021-04-05 11:35:47 -04:00
inc PRSMP Rebrand 2021-04-05 11:35:47 -04:00
scripts Fixed a bug where the event time and date was wrongly assigned when using magnitude sorting 2020-12-26 22:54:54 +01:00
.gitignore see #55 2020-11-20 14:12:51 +01:00
archive.html PRSMP Rebrand 2021-04-05 11:35:47 -04:00
AUTHORS.md Added the initial part of station analysis page 2020-06-18 19:19:17 +02:00
bBox.txt Changed bBox.txt max and min values to encompass the whole world. 2020-10-21 15:28:32 +02:00
config-example.js eliminated contributorsLogo as asked in #61 2020-12-17 21:55:20 +01:00
crontabScriptToUpdateEvents.sh fix bug on overlap script 2021-01-02 12:20:27 +01:00
disclaimer.html Rebrand the disclaimer 2021-04-06 17:48:58 -04:00
downloadPage.html added logo in teh footer and manage footer with a separate footer.html 2020-12-15 23:34:36 +01:00
events.js.tmp PRSMP Rebrand 2021-04-05 11:35:47 -04:00
favicon.ico PRSMP Rebrand 2021-04-05 11:35:47 -04:00
index.html PRSMP Rebrand 2021-04-05 11:35:47 -04:00
LICENSE Initial commit 2020-05-20 17:17:42 +02:00
metaDataPage.html PRSMP Rebrand 2021-04-05 11:35:47 -04:00
productsDownloadList.json Updated product descriptions 2020-02-28 12:37:38 +01:00
publiccode.yml Start new deveop version 2020-11-19 14:14:31 +01:00
ReadFilePage.html Added legend from static ShakeMaps 2019-12-30 13:36:01 +01:00
README.md Updated README.md file with the new way to configure images on the pages. Issue #47 2020-11-16 15:48:01 +01:00
runWeb.py Added a link to the scientific background page. Created a javascript script to change header parameters in all the pages. Changed the style of the scientific background page 2020-10-15 12:27:19 +02:00
scientificBackground.html PRSMP Rebrand 2021-04-05 11:35:47 -04:00
stationList.html PRSMP Rebrand 2021-04-05 11:35:47 -04:00
style.css Fix broken map on mobile 2021-04-12 21:42:57 -04:00
updateEventList.py fix bug where json is not working correctly 2021-04-06 19:39:14 -04:00
VERSION Introduced the file VERSION that contains the software version to be showed. Also resolved a minor bug on footer visualization. 2020-12-19 11:08:23 +01:00
view.html PRSMP Rebrand 2021-04-05 11:35:47 -04:00
viewAnalysis.html PRSMP Rebrand 2021-04-05 11:35:47 -04:00
viewLeaflet.html Change jQuery to https 2021-04-06 00:54:51 -04:00
viewLeaflet2.html Change jQuery to https 2021-04-06 00:54:51 -04:00

Service Master Develop
CircleCI CircleCI CircleCI
Version Version Version

TeamDigitale

License GitHub issues

shakemap4-web

The development presented in this project is aimed towards providing a simple web interface to show the products of the USGS ShakeMap v. 4 software (http://usgs.github.io/shakemap/sm4_index.html). The web interface renders the standard products provided by ShakeMap dynamically (using leafelet https://github.com/Leaflet/Leaflet) and statically (standard shakemaps).
The apperance of the web portal is easily configurable by replacing the logo and banners. The software can be installed both laptops and on server computers.

Installation

$ git clone https://github.com/INGV/shakemap4-web
$ cd shakemap4-web

Configure docker

Copy docker environment file:

$ cp ./Docker/env-example ./Docker/.env

Set NGINX port

Set NGINX_HOST_HTTP_PORT in ./Docker/.env file (default port is 8091).

Set 'data' path

Set SHAKEMAP_DATA_PATH with the absolute data path; ie: /home/shake/shakemap4/shakemap_profiles/world/data

!!! On Linux machine and no 'root' user !!!

To run containers as linux-user (intead of root), set WORKSPACE_PUID and WORKSPACE_PGID in ./Docker/.env file with:

  • WORKSPACE_PUID should be equal to the output of id -u command
  • WORKSPACE_PGID should be equal to the output of id -g command

Configure web page

Copy config-example.js to config.js:

$ cp config-example.js config.js

and update params if you need.

Start shakemap4-web

First, build docker images:

$ cd Docker
$ docker-compose up -d
$ cd ..

How to use it

When all containers are started, connect to:

  • http://<your_host>:<your_port>/

default is:

If all works, you should see ShakeMap4-Web web page.

Under the hood

ShakeMap4-Web project runs 3 containers:

  • nginx and php-fpm: are used to implement web server
  • workspace: is used to implements managment script/tools like wget, crontab, etc...

The workspace container, implements a crontab file to run every minute the script crontabScriptToUpdateEvents.sh; this script checks the SHAKEMAP_DATA_PATH path (set previously) to find all <eventid> to process, modified in the last 2 days. The crontab runs every minute.

You can also runs the update process by hand with command:

!!! On Linux machine and no 'root' user !!!

$ cd Docker
$ docker-compose exec -T --user=laradock workspace bash -c '/usr/bin/python3 /var/www/updateEventList.py --eventid=<eventid>'
$ cd ..

!!! Others !!!

$ cd Docker
$ docker-compose exec -T workspace bash -c '/usr/bin/python3 /var/www/updateEventList.py --eventid=<eventid>'
$ cd ..

Restart containers at boot

To restart the containers automatically at boot, insert into crontab the lines:

# Restart shakemap4-web
@reboot (sleep 30s ; cd <absolute_path>/shakemap4-web/Docker ; /usr/local/bin/docker-compose up -d )&

Tips and tricks

To change nginx port live:

  1. Update NGINX_HOST_HTTP_PORT in .env
  2. run:
$ docker-compose build nginx
  1. Restart docker:
$ docker-compose up --no-deps -d nginx

Rebuild an image (if new) e restart container

$ docker-compose up --build -d workspace

Rebuild an image from existing Dockerfile (es: workspace)

$ docker-compose build --no-cache workspace

Rebuild an image from a remote image (es: nginx)

$ docker-compose pull nginx

Changing the website images

To change the banners and logo images (e.g. the INGV banner that can be seen on the screenshots below), you can change the paths in the config.js file (banner above the menu bar and the image below the table on the homepage) and the inc/header.html file (image below the menu bar).

Example screenshot

alt text alt text

Thanks to

This project uses the Laradock idea to start docker containers.
This work has been partially funded by the Seismology and Earthquake Engineering Research Infrastructure Alliance for Europe (SERA) project (European Union’s Horizon 2020 research and innovation program Grant Agreement Number 730900) and by the Italian Civil Protection (2019–2021) B2 ShakeMap adjournment project.

Contribute

Please, feel free to contribute.

Author

(c) 2019 Dario Jozinović dario.jozinovic[at]ingv.it
(c) 2019 Valentino Lauciani valentino.lauciani[at]ingv.it

Istituto Nazionale di Geofisica e Vulcanologia, Italia