Skip to content
Snippets Groups Projects
Commit 01e8b5fc authored by Powers, Peter M.'s avatar Powers, Peter M.
Browse files

updated build and run docs; separate docker page

parent 8174a284
No related branches found
No related tags found
2 merge requests!705Production Release | nshmp-haz,!697Doc edits
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
***nshmp-haz*** is a U.S. Geological Survey ([USGS](https://www.usgs.gov)) developed software stack ***nshmp-haz*** is a U.S. Geological Survey ([USGS](https://www.usgs.gov)) developed software stack
that supports probabilistic seismic hazard (PSHA) and related analyses. It is maintained by the that supports probabilistic seismic hazard (PSHA) and related analyses. It is maintained by the
National Seismic Hazard Model Project ([NSHMP](https://earthquake.usgs.gov/hazards/)) within the National Seismic Hazard Model Project ([NSHMP](https://earthquake.usgs.gov/hazards/)) within the
USGS's earthquake hazards program ([EHP](http://earthquake.usgs.gov)). USGS [Earthquake Hazards Program](http://earthquake.usgs.gov).
*nshmp-haz* supports high performance seismic hazard calculations required to generate detailed *nshmp-haz* supports high performance seismic hazard calculations required to generate detailed
maps over large areas and supports a variety of web services and applications related to maps over large areas and supports a variety of web services and applications related to
...@@ -18,8 +18,8 @@ use *nshmp-haz* as well as underlying model implementation details. ...@@ -18,8 +18,8 @@ use *nshmp-haz* as well as underlying model implementation details.
* [Developer Basics](./pages/Developer-Basics.md) * [Developer Basics](./pages/Developer-Basics.md)
* [Calculation Configuration](./pages/Calculation-Configuration.md) * [Calculation Configuration](./pages/Calculation-Configuration.md)
* [Site Specification](./pages/Site-Specification.md) * [Site Specification](./pages/Site-Specification.md)
* [Examples](../../etc/examples) * [Using Docker](./pages/Using-Docker.md)
* [Web Services](./pages/Web-Services.md) * See also the [examples](../../etc/examples) directory
* [Hazard Model](./pages/Hazard-Model.md) * [Hazard Model](./pages/Hazard-Model.md)
* [Model Structure](./pages/Model-Structure.md) * [Model Structure](./pages/Model-Structure.md)
* [Model Files](./pages/Model-Files.md) * [Model Files](./pages/Model-Files.md)
......
...@@ -6,13 +6,8 @@ ...@@ -6,13 +6,8 @@
* [Developer Basics](./Developer-Basics.md#developer-basics) * [Developer Basics](./Developer-Basics.md#developer-basics)
* [Calculation Configuration](./Calculation-Configuration.md#calculation-configuration) * [Calculation Configuration](./Calculation-Configuration.md#calculation-configuration)
* [Site Specification](./Site-Specification.md#site-specification) * [Site Specification](./Site-Specification.md#site-specification)
* [Examples](../../etc/examples) * [Using Docker](./Using-Docker.md#using-docker)
* [Web Services](./Web-Services.md) * See also the [examples](../../etc/examples) directory
## Build & Run Options
* [Build and run locally](#build-and-run-locally)
* [Run with Docker](#run-with-docker)
## Build and Run Locally ## Build and Run Locally
...@@ -40,28 +35,29 @@ downloading all required dependencies, including Gradle itself. ...@@ -40,28 +35,29 @@ downloading all required dependencies, including Gradle itself.
_nshmp-haz_ applications may be run from the command line or as a local web service. Command line _nshmp-haz_ applications may be run from the command line or as a local web service. Command line
applications are recommended for long running hazard and disaggregation calculations, but most applications are recommended for long running hazard and disaggregation calculations, but most
users will find a web service endpoint to be more flexible. Web services return users will find the web service endpoints to be more flexible. Web services return
[JSON](https://www.json.org/json-en.html) responses that can be parsed by most programming [JSON](https://www.json.org/json-en.html) responses that can be parsed by most programming
languages and data analaysis and visualization programs (e.g. Matlab). languages and data analaysis and visualization programs (e.g. Matlab).
### Web Servies ### Web Servies
To run _nshmp-haz_ as a web service: To run _nshmp-haz_ web services:
```bash ```bash
./gradlew run ./gradlew run
``` ```
Services (and documentation) are then avialable on <http://localhost:8080/> By default, when the web services start up, they load the 2018 NSHM for the conterminous U.S.
To use a different model run the web services using Java and specify model path:
ALternatively, run:
code, run:
```bash ```bash
./gradlew run -t java -jar build/libs/nshmp-haz.jar --model=path/to/model
``` ```
to have the services automatically recompile when the source code changes. After startup, web services and documentation are now available at
[http://localhost:8080/](http://localhost:8080/).
See the [Matlab](../../etc/matlab) directory for examples of how to call the web services.
### Command Line Hazard Calculation ### Command Line Hazard Calculation
...@@ -72,16 +68,16 @@ measures. For example: ...@@ -72,16 +68,16 @@ measures. For example:
java -cp path/to/nshmp-haz.jar gov.usgs.earthquake.nshmp.HazardCalc model sites [config] java -cp path/to/nshmp-haz.jar gov.usgs.earthquake.nshmp.HazardCalc model sites [config]
``` ```
At a minimum, the hazard source [model](./Hazard-Model.md) and the [site](./Site-Specification.md)(s) At a minimum, the hazard source [model](./Hazard-Model.md) and the
at which to perform calculations must be specified. The source model should specified a path to a [site](./Site-Specification.md)(s) at which to perform calculations must be specified. The source
directory. A single site may be specified with a string; multiple sites must be specified using model should specified a path to a directory. A single site may be specified with a string;
either a comma-delimited (CSV) or [GeoJSON](http://geojson.org) file. The path to a custom multiple sites must be specified using either a comma-delimited (CSV) or
[configuration](./Calculation-Configuration.md) file containing user-specific settings may optionally [GeoJSON](http://geojson.org) file. The path to a custom
be supplied as a third argument. It can be used to override any calculation settings; if absent [configuration](./Calculation-Configuration.md) file containing user-specific settings may
[default](./Calculation-Configuration.md) values are used. optionally be supplied as a third argument. It can be used to override any calculation settings;
if absent [default](./Calculation-Configuration.md) values are used.
See the [examples](../../etc/examples) directory for more details (or See the [examples](../../etc/examples) directory for more details.
[on GitLab](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/main/etc/examples))
### Command Line Disaggregation Calculation ### Command Line Disaggregation Calculation
...@@ -98,169 +94,6 @@ Disaggregations build on and output `HazardCalc` results along with other disagg ...@@ -98,169 +94,6 @@ Disaggregations build on and output `HazardCalc` results along with other disagg
files. Disaggregations also have some independent files. Disaggregations also have some independent
[configuration](./Calculation-Configuration.md#calculation-configuration-parameters) options. [configuration](./Calculation-Configuration.md#calculation-configuration-parameters) options.
## Run with [Docker](https://docs.docker.com/install/)
nshmp-haz is available as a public image from [Docker hub](https://hub.docker.com/r/usgs/nshmp-haz)
with tags:
* `latest`: Refers to the latest updates from the main or production branch
* `development-latest`: Refers to forks of the repository.
* `staging-latest`: Latest updates associated with the
[main](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/main) branch
* `production-latest`: Latest stable release associated with the
[production](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/production) branch
To ensure you have the latest *nshmp-haz* update associated with a specific tag,
always first pull the image from Docker:
```bash
docker pull usgs/nshmp-haz:<tag>
```
> Replace `<tag>` with one of the above tags.
Example:
```bash
docker pull usgs/nshmp-haz:production-latest
```
### Docker Memory on Mac
By default, Docker Desktop for Mac is set to use 2 GB runtime memory. To run *nshmp-haz*, the
memory available to Docker must be [increased](https://docs.docker.com/docker-for-mac/#advanced)
to a minimum of 4 GB.
### Run nshmp-haz in Docker
The *nshmp-haz* application may be run as a Docker container which mitigates the need to install
Git, Java, or other dependencies besides Docker. A public image is available
from [Docker hub](https://hub.docker.com/r/usgs/nshmp-haz)
which can be run with:
```bash
# Pull docker image
docker pull usgs/nshmp-haz:latest
# Run docker image
docker run \
--env CLASS_NAME=<DisaggCalc | HazardCalc | RateCalc> \
--env IML=<NUMBER> \
--env RETURN_PERIOD=<NUMBER> \
--volume /absolute/path/to/sites/file:/app/sites.<geojson | csv> \
--volume /absolute/path/to/config/file:/app/config.json \
--volume /absolute/path/to/output:/app/output \
usgs/nshmp-haz
```
Where:
* `CLASS_NAME` is the nshmp-haz class to run:
* [DisaggCalc](../../src/main/java/gov/usgs/earthquake/nshmp/DisaggCalc.java)
* [HazardCalc](../../src/main/java/gov/usgs/earthquake/nshmp/HazardCalc.java)
* [RateCalc](../../src/main/java/gov/usgs/earthquake/nshmp/RateCalc.java)
* Other arguments (local files mapped to files within the Docker container with `:/app/...`):
* (required) The absolute path to a [USGS model (NSHM)](./USGS-Models.md)
* Example: `$(pwd)/nshm-hawaii:/app/model`
* (required) The absolute path to a GeoJSON or CSV [site(s)](./Site-Specification.md) file
* CSV example: `$(pwd)/my-csv-sites.csv:/app/sites.csv`
* GeoJSON example: `$(pwd)/my-geojson-sites.geojson:/app/sites.geojson`
* (required) The absolute path to an output directory
* Example: `$(pwd)/my-hazard-output:/app/output`
* (optional) The absolute path to a [configuration](./Calculation-Configuration.md) file
* Example: `$(pwd)/my-custom-config.json:/app/config.json`
### Docker Examples
#### [`HazardCalc`](../../src/main/java/gov/usgs/earthquake/nshmp/HazardCalc.java) Example
The following example runs the `HazardCalc` program in nshmp-haz with the
[nshm-hawaii](https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git) model and the
assumption a GeoJSON [site](./Site-Specification.md) file exists named `sites.geojson`.
```bash
# Download Hawaii NSHM
git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git
# Pull image
docker pull usgs/nshmp-haz:latest
# Run nshmp-haz HazardCalc
docker run \
--env CLASS_NAME="HazardCalc" \
--volume "$(pwd)/nshm-hawaii:/app/model" \
--volume "$(pwd)/sites.geojson" \
--volume "$(pwd)/hawaii-hazard-output:/app/output" \
usgs/nshmp-haz
```
#### [`DisaggCalc`](../../src/main/java/gov/usgs/earthquake/nshmp/DisaggCalc.java) Example
The following example runs the `DisaggCalc` program in nshmp-haz with the
[nshm-hawaii](https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git) model and the
assumption a GeoJSON [site](./Site-Specification.md) file exists named `sites.geojson`.
```bash
# Download Hawaii NSHM
git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git
# Pull image
docker pull usgs/nshmp-haz:latest
# Run nshmp-haz DisaggCalc
docker run \
--env CLASS_NAME="DisaggCalc" \
--env RETURN_PERIOD=475 \
--volume "$(pwd)/nshm-hawaii:/app/model" \
--volume "$(pwd)/sites.geojson" \
--volume "$(pwd)/hawaii-disagg-output:/app/output" \
usgs/nshmp-haz:latest
```
#### [`RateCalc`](../../src/main/java/gov/usgs/earthquake/nshmp/RateCalc.java) Example
The following example runs the `RateCalc` program in nshmp-haz with the
[nshm-hawaii](https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git) model and the
assumption a GeoJSON [site](./Site-Specification.md) file exists named `sites.geojson`.
```bash
# Download Hawaii NSHM
git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git
# Pull image
docker pull usgs/nshmp-haz:latest
# Run nshmp-haz RateCalc
docker run \
--env CLASS_NAME="RateCalc" \
--volume "$(pwd)/nshm-hawaii:/app/model" \
--volume "$(pwd)/sites.geojson" \
--volume "$(pwd)/hawaii-rate-output:/app/output" \
usgs/nshmp-haz
```
### Run Customization
When running *nshmp-haz* with Docker the maximum JVM memory size can
be set with the environment flag (-e, -env):
```bash
docker run \
--env JAVA_MEMORY=<MEMORY> \
...
usgs/nshmp-haz
# Example
docker run \
--env JAVA_MEMORY="12g" \
...
usgs/nshmp-haz
```
Where:
* `JAVA_MEMORY` is the maximum memory for the JVM (default: 8g)
--- ---
* [**Documentation Index**](../README.md) * [**Documentation Index**](../README.md)
......
...@@ -109,8 +109,8 @@ T ≤ 10 s | 0.000333, 0.000499, 0.000749, 0.00112, 0.00169, 0.00253, <br>0.00 ...@@ -109,8 +109,8 @@ T ≤ 10 s | 0.000333, 0.000499, 0.000749, 0.00112, 0.00169, 0.00253, <br>0.00
* [Developer Basics](./Developer-Basics.md#developer-basics) * [Developer Basics](./Developer-Basics.md#developer-basics)
* [Calculation Configuration](./Calculation-Configuration.md#calculation-configuration) * [Calculation Configuration](./Calculation-Configuration.md#calculation-configuration)
* [Site Specification](./Site-Specification.md#site-specification) * [Site Specification](./Site-Specification.md#site-specification)
* [Examples](../../etc/examples) (or * [Using Docker](./Using-Docker.md#using-docker)
[on GitLab](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/main/etc/examples)) * See also the [examples](../../etc/examples) directory
* [__Documentation Index__](../README.md) * [__Documentation Index__](../README.md)
--- ---
......
...@@ -58,9 +58,9 @@ git clone https://code.usgs.gov/ghsc/nshmp/nshmp-haz.git ...@@ -58,9 +58,9 @@ git clone https://code.usgs.gov/ghsc/nshmp/nshmp-haz.git
* [Developer Basics](./Developer-Basics.md#developer-basics) * [Developer Basics](./Developer-Basics.md#developer-basics)
* [Calculation Configuration](./Calculation-Configuration.md#calculation-configuration) * [Calculation Configuration](./Calculation-Configuration.md#calculation-configuration)
* [Site Specification](./Site-Specification.md#site-specification) * [Site Specification](./Site-Specification.md#site-specification)
* [Examples](../../etc/examples) (or * [Using Docker](./Using-Docker.md#using-docker)
[on GitLab](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/main/etc/examples)) * See also the [examples](../../etc/examples) directory
* [**Documentation Index**](../README.md) * [__Documentation Index__](../README.md)
--- ---
![USGS logo](./images/usgs-icon.png) &nbsp;[U.S. Geological Survey](https://www.usgs.gov) ![USGS logo](./images/usgs-icon.png) &nbsp;[U.S. Geological Survey](https://www.usgs.gov)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
The following page details the logic trees of epistemic uncertainty considered in NSHMs supported The following page details the logic trees of epistemic uncertainty considered in NSHMs supported
by *nshmp-haz*. Logic trees are represented in a NSHM using files ending in `-tree.json`. by *nshmp-haz*. Logic trees are represented in a NSHM using files ending in `-tree.json`.
[[*TOC*]] [[_TOC_]]
## Terminology ## Terminology
......
...@@ -104,8 +104,8 @@ outside the 'calculation' polygon are set to zero. For an example, see the ...@@ -104,8 +104,8 @@ outside the 'calculation' polygon are set to zero. For an example, see the
* [Developer Basics](./Developer-Basics.md#developer-basics) * [Developer Basics](./Developer-Basics.md#developer-basics)
* [Calculation Configuration](./Calculation-Configuration.md#calculation-configuration) * [Calculation Configuration](./Calculation-Configuration.md#calculation-configuration)
* [Site Specification](./Site-Specification.md#site-specification) * [Site Specification](./Site-Specification.md#site-specification)
* [Examples](../../etc/examples) (or * [Using Docker](./Using-Docker.md#using-docker)
[on GitLab](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/main/etc/examples)) * See also the [examples](../../etc/examples) directory
* [__Documentation Index__](../README.md) * [__Documentation Index__](../README.md)
--- ---
......
# Using [Docker](https://docs.docker.com/install/)
*nshmp-haz* is available as a public image from
[Docker hub](https://hub.docker.com/r/usgs/nshmp-haz) with tags:
* `latest`: Refers to the latest updates from the main or production branch
* `development-latest`: Refers to forks of the repository.
* `staging-latest`: Latest updates associated with the
[main](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/main) branch
* `production-latest`: Latest stable release associated with the
[production](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/production) branch
To ensure you have the latest *nshmp-haz* update associated with a specific tag,
always first pull the image from Docker:
```bash
docker pull usgs/nshmp-haz:<tag>
```
> Replace `<tag>` with one of the above tags.
Example:
```bash
docker pull usgs/nshmp-haz:production-latest
```
## Docker Memory on Mac
By default, Docker Desktop for Mac is set to use 2 GB runtime memory. To run *nshmp-haz*, the
memory available to Docker must be [increased](https://docs.docker.com/docker-for-mac/#advanced)
to a minimum of 4 GB.
## Run *nshmp-haz* in Docker
```bash
# Pull docker image
docker pull usgs/nshmp-haz:latest
# Run docker image
docker run \
--env CLASS_NAME=<DisaggCalc | HazardCalc | RateCalc> \
--env IML=<NUMBER> \
--env RETURN_PERIOD=<NUMBER> \
--volume /absolute/path/to/sites/file:/app/sites.<geojson | csv> \
--volume /absolute/path/to/config/file:/app/config.json \
--volume /absolute/path/to/output:/app/output \
usgs/nshmp-haz
```
Where:
* `CLASS_NAME` is the nshmp-haz class to run:
* [DisaggCalc](../../src/main/java/gov/usgs/earthquake/nshmp/DisaggCalc.java)
* [HazardCalc](../../src/main/java/gov/usgs/earthquake/nshmp/HazardCalc.java)
* [RateCalc](../../src/main/java/gov/usgs/earthquake/nshmp/RateCalc.java)
* Other arguments (local files mapped to files within the Docker container with `:/app/...`):
* (required) The absolute path to a [USGS model (NSHM)](./USGS-Models.md)
* Example: `$(pwd)/nshm-hawaii:/app/model`
* (required) The absolute path to a GeoJSON or CSV [site(s)](./Site-Specification.md) file
* CSV example: `$(pwd)/my-csv-sites.csv:/app/sites.csv`
* GeoJSON example: `$(pwd)/my-geojson-sites.geojson:/app/sites.geojson`
* (required) The absolute path to an output directory
* Example: `$(pwd)/my-hazard-output:/app/output`
* (optional) The absolute path to a [configuration](./Calculation-Configuration.md) file
* Example: `$(pwd)/my-custom-config.json:/app/config.json`
## Examples
### [`HazardCalc`](../../src/main/java/gov/usgs/earthquake/nshmp/HazardCalc.java) Example
The following example runs the `HazardCalc` program in nshmp-haz with the
[nshm-hawaii](https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git) model and the
assumption a GeoJSON [site](./Site-Specification.md) file exists named `sites.geojson`.
```bash
# Download Hawaii NSHM
git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git
# Pull image
docker pull usgs/nshmp-haz:latest
# Run nshmp-haz HazardCalc
docker run \
--env CLASS_NAME="HazardCalc" \
--volume "$(pwd)/nshm-hawaii:/app/model" \
--volume "$(pwd)/sites.geojson" \
--volume "$(pwd)/hawaii-hazard-output:/app/output" \
usgs/nshmp-haz
```
### [`DisaggCalc`](../../src/main/java/gov/usgs/earthquake/nshmp/DisaggCalc.java) Example
The following example runs the `DisaggCalc` program in nshmp-haz with the
[nshm-hawaii](https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git) model and the
assumption a GeoJSON [site](./Site-Specification.md) file exists named `sites.geojson`.
```bash
# Download Hawaii NSHM
git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git
# Pull image
docker pull usgs/nshmp-haz:latest
# Run nshmp-haz DisaggCalc
docker run \
--env CLASS_NAME="DisaggCalc" \
--env RETURN_PERIOD=475 \
--volume "$(pwd)/nshm-hawaii:/app/model" \
--volume "$(pwd)/sites.geojson" \
--volume "$(pwd)/hawaii-disagg-output:/app/output" \
usgs/nshmp-haz:latest
```
### [`RateCalc`](../../src/main/java/gov/usgs/earthquake/nshmp/RateCalc.java) Example
The following example runs the `RateCalc` program in nshmp-haz with the
[nshm-hawaii](https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git) model and the
assumption a GeoJSON [site](./Site-Specification.md) file exists named `sites.geojson`.
```bash
# Download Hawaii NSHM
git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git
# Pull image
docker pull usgs/nshmp-haz:latest
# Run nshmp-haz RateCalc
docker run \
--env CLASS_NAME="RateCalc" \
--volume "$(pwd)/nshm-hawaii:/app/model" \
--volume "$(pwd)/sites.geojson" \
--volume "$(pwd)/hawaii-rate-output:/app/output" \
usgs/nshmp-haz
```
## Run Customization
When running *nshmp-haz* with Docker the maximum JVM memory size can
be set with the environment flag (-e, -env):
```bash
docker run \
--env JAVA_MEMORY=<MEMORY> \
...
usgs/nshmp-haz
# Example
docker run \
--env JAVA_MEMORY="12g" \
...
usgs/nshmp-haz
```
Where:
* `JAVA_MEMORY` is the maximum memory for the JVM (default: 8g)
## Run *nshmp-haz* web services in Docker
### Build and Run Docker Locally
The Docker image may be built with the provided web service [Dockerfile](../../ws.Dockerfile).
```bash
cd /path/to/nshmp-haz
# Build docker image
docker build -f ws.Dockerfile -t nshmp-haz-ws .
# Run Docker image
docker run -p 8080:8080 -v "path/to/model:/model" nshmp-haz-ws
```
Web service runs on [http://localhost:8080/](http://localhost:8080/)
The hazard model is read in via Docker volumes.
#### Local Docker Example with NSHM
```bash
# Build docker image
cd /path/to/nshmp-haz
docker build -f ws.Dockerfile -t nshmp-haz-ws .
# Download NSHM CONUS
cd ..
git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-conus
# Run web services
docker run -p 8080:8080 -v "$(pwd):/model" nshmp-haz-ws
```
Open browser to [http://localhost:8080/](http://localhost:8080/).
### Run from Container Registry
A public Docker image is avaialable from [Docker hub](https://hub.docker.com/r/usgs/nshmp-haz-ws).
There are 4 main tags:
* `latest`: Refers to the latest updates from the main or production branch
* `development-latest`: Refers to forks of the repository.
* `staging-latest`: Refers to the
[main](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/main) branch and is the latest updates
* `production-latest`: Refers to the
[production](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/production) branch and is stable
```bash
# Pull image
docker pull usgs/nshmp-haz-ws:latest
# Run
docker run -p 8080:8080 -v "/path/to/model:/model" usgs/nshmp-haz-ws
```
Web service runs on [http://localhost:8080/](http://localhost:8080/)
The hazard model is read in via Docker volumes.
#### Container Registry Example with NSHM
```bash
# Pull image
docker pull usgs/nshmp-haz-ws:latest
# Download NSHM CONUS
cd ..
git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-conus
# Run web services
docker run -p 8080:8080 -v "$(pwd):/model" usgs/nshmp-haz-ws
```
Open browser to [http://localhost:8080/](http://localhost:8080/).
### Java Memory
When running **nshmp-haz** web services with Docker
the initial (Xms) and maximum (Xmx) JVM memory sizes can
be set with the environment flag (-e, -env):
```bash
docker run -p <PORT>:8080 -e JAVA_OPTS="-Xms<INITIAL> -Xmx<MAX>" -d usgs/nshmp-haz-ws
# Example
docker run -p 8080:8080 -e JAVA_OPTS="-Xms1g -Xmx8g" -d usgs/nshmp-haz-ws
```
Where `<INITIAL>` and `<MAX >`should be set to the desired initial and maximum memory sizes,
respectively.
---
## Related Pages
* [Building & Running](./Building-&-Running.md#building-&-running)
* [Developer Basics](./Developer-Basics.md#developer-basics)
* [Calculation Configuration](./Calculation-Configuration.md#calculation-configuration)
* [Site Specification](./Site-Specification.md#site-specification)
* [Using Docker](./Using-Docker.md#using-docker)
* See also the [examples](../../etc/examples) directory
* [__Documentation Index__](../README.md)
---
![USGS logo](./images/usgs-icon.png) &nbsp;[U.S. Geological Survey](https://www.usgs.gov)
National Seismic Hazard Mapping Project ([NSHMP](https://earthquake.usgs.gov/hazards/))
# Examples # Examples
These examples are designed to be executed locally while following the READMEs on GitLab. These examples are designed to be executed locally while following the READMEs on GitLab and
assumes the reader has successfully downloaded and built the code as described in the
[documentation](../../docs/README.md). Because each example builds on prior concepts, we recommend
stepping through all the examples in order.
All examples avoid a lengthy call to Java and the `HazardCalc` program by using the following All examples avoid a lengthy call to Java and the `HazardCalc` program by using the following
system alias: system alias:
...@@ -8,7 +12,7 @@ system alias: ...@@ -8,7 +12,7 @@ system alias:
alias hazard='java -cp /path/to/nshmp-haz/build/libs/nshmp-haz.jar gov.usgs.earthquake.nshmp.HazardCalc' alias hazard='java -cp /path/to/nshmp-haz/build/libs/nshmp-haz.jar gov.usgs.earthquake.nshmp.HazardCalc'
``` ```
Because each example builds on prior concepts, it is best step through all the examples, however quickly.
<!-- markdownlint-disable MD001 --> <!-- markdownlint-disable MD001 -->
#### Start: [Example 1 – A simple hazard calculation](1-hazard-curve/README.md) #### Start: [Example 1 – A simple hazard calculation](1-hazard-curve/README.md)
......
dependencies { dependencies {
// NSHMP // NSHMP
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment