Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Web portal built for ShakeMap4 package

License

Fran89/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

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

About

Web portal built for ShakeMap4 package

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 57.4%
  • Dockerfile 18.5%
  • HTML 14.9%
  • CSS 3.5%
  • Python 3.3%
  • Shell 2.4%