Skip to content

INGV/shakemap4-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Service Master Develop
CircleCI CircleCI CircleCI
Version Version Version

TeamDigitale TeamDigitale-reuse

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 in ./Docker/.env with the absolute data path; ie: /home/shake/shakemap4/shakemap_profiles/world/data

Set uid and gid

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

  • ENV_UID should be equal to the output of id -u command
  • ENV_GID 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 build --pull --no-cache
$ cd ..

then, starts docker containers:

$ 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 2 containers:

  • nginx: is 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.

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

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

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) and restart container

$ docker-compose up --build -d workspace

Rebuild all images and restart (useful when new version is released)

$ docker-compose build --no-cache
$ docker-compose up -d

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 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) 2021 Dario Jozinović dario.jozinovic[at]ingv.it
(c) 2021 Valentino Lauciani valentino.lauciani[at]ingv.it (c) 2021 Sergio Bruni sergio.bruni[at]ingv.it

Istituto Nazionale di Geofisica e Vulcanologia, Italia