| Service | Master | Develop |
|---|---|---|
| CircleCI | ||
| Version |
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.
$ git clone https://github.com/INGV/shakemap4-web
$ cd shakemap4-web
Copy docker environment file:
$ cp ./Docker/env-example ./Docker/.env
Set NGINX_HOST_HTTP_PORT in ./Docker/.env file (default port is 8091).
Set SHAKEMAP_DATA_PATH with the absolute data path; ie: /home/shake/shakemap4/shakemap_profiles/world/data
To run containers as linux-user (intead of root), set WORKSPACE_PUID and WORKSPACE_PGID in ./Docker/.env file with:
WORKSPACE_PUIDshould be equal to the output ofid -ucommandWORKSPACE_PGIDshould be equal to the output ofid -gcommand
Copy config-example.js to config.js:
$ cp config-example.js config.js
and update params if you need.
First, build docker images:
$ cd Docker
$ docker-compose up -d
$ cd ..
When all containers are started, connect to:
- http://<your_host>:<your_port>/
default is:
If all works, you should see ShakeMap4-Web web page.
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:
$ cd Docker
$ docker-compose exec -T --user=laradock workspace bash -c '/usr/bin/python3 /var/www/updateEventList.py --eventid=<eventid>'
$ cd ..
$ cd Docker
$ docker-compose exec -T workspace bash -c '/usr/bin/python3 /var/www/updateEventList.py --eventid=<eventid>'
$ cd ..
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 )&
- Update
NGINX_HOST_HTTP_PORTin.env - run:
$ docker-compose build nginx
- Restart docker:
$ docker-compose up --no-deps -d nginx
$ docker-compose up --build -d workspace
$ docker-compose build --no-cache workspace
$ docker-compose pull nginx
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).
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.
Please, feel free to contribute.
(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