Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nshmp-haz
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ghsc
National Seismic Hazard Model Project
nshmp-haz
Commits
d2b642bd
Commit
d2b642bd
authored
2 years ago
by
Clayton, Brandon Scott
Browse files
Options
Downloads
Patches
Plain Diff
Add web service docs
parent
61076c7f
No related branches found
No related tags found
2 merge requests
!611
Production Release | nshmp-haz
,
!610
Resolves - Update docker deployments
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
docs/README.md
+1
-0
1 addition, 0 deletions
docs/README.md
docs/pages/Building-&-Running.md
+1
-0
1 addition, 0 deletions
docs/pages/Building-&-Running.md
docs/pages/Web-Services.md
+165
-0
165 additions, 0 deletions
docs/pages/Web-Services.md
with
167 additions
and
0 deletions
docs/README.md
+
1
−
0
View file @
d2b642bd
...
...
@@ -19,6 +19,7 @@ use *nshmp-haz* as well as underlying model implementation details.
*
[
Calculation Configuration
](
./pages/Calculation-Configuration.md
)
*
[
Site Specification
](
./pages/Site-Specification.md
)
*
[
Examples
](
../../etc/examples
)
*
[
Web Services
](
./pages/Web-Services.md
)
*
[
Hazard Model
](
./pages/Hazard-Model.md
)
*
[
Model Structure
](
./pages/Model-Structure.md
)
*
[
Model Files
](
./pages/Model-Files.md
)
...
...
This diff is collapsed.
Click to expand it.
docs/pages/Building-&-Running.md
+
1
−
0
View file @
d2b642bd
...
...
@@ -8,6 +8,7 @@
*
[
Site Specification
](
./Site-Specification.md#site-specification
)
*
[
Examples
](
../../etc/examples
)
(
or
[
on GitLab
](
https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/main/etc/examples
)
)
*
[
Web Services
](
./Web-Services.md
)
## Build & Run Options
...
...
This diff is collapsed.
Click to expand it.
docs/pages/Web-Services.md
0 → 100644
+
165
−
0
View file @
d2b642bd
# Web Services
## Related Pages
*
[
Building & Running
](
./Building-&-Running.md#building-&-running
)
*
[
Developer Basics
](
./Developer-Basics.md#developer-basics
)
## Build & Run Options
*
[
Build and run locally
](
#build-and-run-locally
)
*
[
Run with Docker
](
#run-with-docker
)
## Build and Run Locally
Building and running
*nshmp-haz*
web services requires prior
installation of Git and Java. Please see the
[
developer basics
](
./Developer-Basics.md
)
page for system configuration guidance.
### Building
Navigate to a location on your system where you want
*nshmp-haz*
code to reside, clone the
repository, and compile:
```
bash
cd
/path/to/project/directory
git clone https://code.usgs.gov/ghsc/nshmp/nshmp-haz.git
cd
nshmp-haz
./gradlew assemble
```
This creates a single file,
`build/libs/nshmp-haz.jar`
that may be used to run the web services.
`./gradlew`
executes the Gradle Wrapper script (there is a
`gradlew.bat`
equivalent for Windows
users using the native command prompt). This executes any tasks (e.g.
`assemble`
) after
downloading all required dependencies, including Gradle itself.
## Running Web Services
```
bash
java
-jar
path/to/nshmp-haz.jar
--model
=
path/to/model
```
Web service runs on
[
http://localhost:8080/
](
http://localhost:8080/
)
The
`--model`
argument should contain the path to a single
hazard source
[
model
](
./Hazard-Model.md
)
.
The
[
National Seisimic Hazard Models (NSHMs)
](
https://code.usgs.gov/ghsc/nshmp/nshms
)
are available to download.
### Example with NSHM
```
bash
# Build nshmp-haz
cd
/path/to/nshmp-haz
./gradle assemble
# Download NSHM CONUS
cd
..
git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-conus
# Run web services
cd
/path/to/nshmp-haz
java
-jar
build/libs/nshmp-haz.jar
--model
=
../nshm-conus
```
Open browser to
[
http://localhost:8080/
](
http://localhost:8080/
)
.
## Run with Docker
### Docker Requirments
*
[
Docker
](
https://docs.docker.com/install/
)
#### Docker Memory on Mac
By default, Docker Desktop for Mac is set to use 2 GB runtime memory. To run nshmp-haz-ws, the
memory available to Docker must be
[
increased
](
https://docs.docker.com/docker-for-mac/#advanced
)
to a minimum of 4 GB.
### Docker Build Options
*
[
Build and run docker locally
](
#build-and-run-docker-locally
)
*
[
Run from Docker Hub
](
#run-from-docker-hub
)
### 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 Docker Hub
A public Docker image is avaialable on
[
Docker Hub
](
https://hub.docker.com/r/usgs/nshmp-haz-ws
)
There are 2 main tags:
*
staging-latest (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 nshmp-haz-ws:latest
# Run
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.
#### Docker Hub Example with NSHM
```
bash
# Pull image
docker pull 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"
nshmp-haz-ws
```
Open browser to
[
http://localhost:8080/
](
http://localhost:8080/
)
.
---
*
[
**Documentation Index**
](
../README.md
)
---

[
U.S. Geological Survey
](
https://www.usgs.gov
)
National Seismic Hazard Mapping Project (
[
NSHMP
](
https://earthquake.usgs.gov/hazards/
)
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment