Skip to content
Snippets Groups Projects
Commit f9695d05 authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

Merge branch 'main' into 'production'

Production Release | nshmp-haz

See merge request !619
parents 0d9214d6 2fa6000a
No related branches found
No related tags found
1 merge request!619Production Release | nshmp-haz
Pipeline #141076 passed
...@@ -104,16 +104,31 @@ default: ...@@ -104,16 +104,31 @@ default:
docker build \ docker build \
${BUILD_ARGS} \ ${BUILD_ARGS} \
--pull \ --pull \
--tag "${latest_image_name}" \ --tag "${env_image_name}" \
--file "${CI_PROJECT_DIR}/${DOCKERFILE}" \ --file "${CI_PROJECT_DIR}/${DOCKERFILE}" \
"${CI_PROJECT_DIR}/."; "${CI_PROJECT_DIR}/.";
- docker push "${latest_image_name}"; - docker push "${env_image_name}";
- | - |
docker tag "${latest_image_name}" "${env_image_name}"; docker tag "${env_image_name}" "${sha_image_name}";
docker push "${env_image_name}";
- |
docker tag "${latest_image_name}" "${sha_image_name}";
docker push "${sha_image_name}"; docker push "${sha_image_name}";
- |
docker_latest_image="usgs/${CI_PROJECT_NAME}:latest";
docker_env_image="usgs/${CI_PROJECT_NAME}:${ENVIRONMENT}-latest";
if [[ "${ENVIRONMENT}" != "development" ]]; then
docker tag "${env_image_name}" "${latest_image_name}";
docker push "${latest_image_name}";
fi
if [[ "${PUSH_DOCKER}" == true ]]; then
docker tag "${env_image_name}" "${docker_env_image}";
docker push "${docker_env_image}";
if [[ "${ENVIRONMENT}" != "development" ]]; then
docker tag "${env_image_name}" "${docker_latest_image}";
docker push "${docker_latest_image}";
fi
fi
- | - |
printf " printf "
-------- --------
...@@ -129,6 +144,7 @@ default: ...@@ -129,6 +144,7 @@ default:
BUILD_IMAGE=${DEVOPS_REGISTRY}usgs/amazoncorretto:11 BUILD_IMAGE=${DEVOPS_REGISTRY}usgs/amazoncorretto:11
FROM_IMAGE=${DEVOPS_REGISTRY}usgs/amazoncorretto:11 FROM_IMAGE=${DEVOPS_REGISTRY}usgs/amazoncorretto:11
IMAGE_TAG: ${ENVIRONMENT}-${CI_COMMIT_SHORT_SHA} IMAGE_TAG: ${ENVIRONMENT}-${CI_COMMIT_SHORT_SHA}
PUSH_DOCKER: 'false'
REGISTRY_IMAGE: ${CI_REGISTRY_IMAGE} REGISTRY_IMAGE: ${CI_REGISTRY_IMAGE}
TAG: build TAG: build
...@@ -169,6 +185,7 @@ CHS Registry: ...@@ -169,6 +185,7 @@ CHS Registry:
CI_COMMIT_BRANCH=${CI_COMMIT_BRANCH} CI_COMMIT_BRANCH=${CI_COMMIT_BRANCH}
CI_JOB_TOKEN=${CI_JOB_TOKEN} CI_JOB_TOKEN=${CI_JOB_TOKEN}
CI_PROJECT_URL=${CI_PROJECT_URL} CI_PROJECT_URL=${CI_PROJECT_URL}
PUSH_DOCKER: 'true'
UPSTREAM_PATH: ghsc/nshmp/nshmp-haz UPSTREAM_PATH: ghsc/nshmp/nshmp-haz
Container Registry: Container Registry:
......
...@@ -33,7 +33,7 @@ plugins { ...@@ -33,7 +33,7 @@ plugins {
id "com.github.johnrengelman.shadow" version "${shadowVersion}" id "com.github.johnrengelman.shadow" version "${shadowVersion}"
id "com.github.node-gradle.node" version "${nodePluginVersion}" id "com.github.node-gradle.node" version "${nodePluginVersion}"
id "com.github.spotbugs" version "${spotbugsVersion}" id "com.github.spotbugs" version "${spotbugsVersion}"
id "com.palantir.git-version" version "${gitVersionVersion}" id "com.palantir.git-version" version "${gitVersionVersion}" apply false
id "com.star-zero.gradle.githook" version "${githooksVersion}" id "com.star-zero.gradle.githook" version "${githooksVersion}"
id "eclipse-wtp" id "eclipse-wtp"
id "io.micronaut.application" version "${micronautPluginVersion}" id "io.micronaut.application" version "${micronautPluginVersion}"
......
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
* [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 * [Examples](../../etc/examples)
[on GitLab](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/main/etc/examples))
* [Web Services](./Web-Services.md) * [Web Services](./Web-Services.md)
## Build & Run Options ## Build & Run Options
...@@ -74,11 +73,11 @@ files. Disaggregations also have some independent ...@@ -74,11 +73,11 @@ files. Disaggregations also have some independent
## Run with [Docker](https://docs.docker.com/install/) ## Run with [Docker](https://docs.docker.com/install/)
nshmp-haz is available as a public image from the nshmp-haz is available as a public image from [Docker hub](https://hub.docker.com/r/usgs/nshmp-haz)
[container registry](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/container_registry)
with tags: with tags:
* `latest`: Refers to the latest updates from the main or production branch * `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 * `staging-latest`: Latest updates associated with the
[main](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/main) branch [main](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/main) branch
* `production-latest`: Latest stable release associated with the * `production-latest`: Latest stable release associated with the
...@@ -109,13 +108,12 @@ to a minimum of 4 GB. ...@@ -109,13 +108,12 @@ to a minimum of 4 GB.
The *nshmp-haz* application may be run as a Docker container which mitigates the need to install 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 Git, Java, or other dependencies besides Docker. A public image is available
from this repository's from [Docker hub](https://hub.docker.com/r/usgs/nshmp-haz)
[container registry](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/container_registry).
which can be run with: which can be run with:
```bash ```bash
# Pull docker image # Pull docker image
docker pull code.usgs.gov:5001/ghsc/nshmp/nshmp-haz/nshmp-haz:latest docker pull usgs/nshmp-haz:latest
# Run docker image # Run docker image
docker run \ docker run \
...@@ -125,7 +123,7 @@ docker run \ ...@@ -125,7 +123,7 @@ docker run \
--volume /absolute/path/to/sites/file:/app/sites.<geojson | csv> \ --volume /absolute/path/to/sites/file:/app/sites.<geojson | csv> \
--volume /absolute/path/to/config/file:/app/config.json \ --volume /absolute/path/to/config/file:/app/config.json \
--volume /absolute/path/to/output:/app/output \ --volume /absolute/path/to/output:/app/output \
code.usgs.gov:5001/ghsc/nshmp/nshmp-haz/nshmp-haz-ws usgs/nshmp-haz
``` ```
Where: Where:
...@@ -158,7 +156,7 @@ assumption a GeoJSON [site](./Site-Specification.md) file exists named `sites.ge ...@@ -158,7 +156,7 @@ assumption a GeoJSON [site](./Site-Specification.md) file exists named `sites.ge
git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git
# Pull image # Pull image
docker pull code.usgs.gov:5001/ghsc/nshmp/nshmp-haz/nshmp-haz:latest docker pull usgs/nshmp-haz:latest
# Run nshmp-haz HazardCalc # Run nshmp-haz HazardCalc
docker run \ docker run \
...@@ -166,7 +164,7 @@ docker run \ ...@@ -166,7 +164,7 @@ docker run \
--volume "$(pwd)/nshm-hawaii:/app/model" \ --volume "$(pwd)/nshm-hawaii:/app/model" \
--volume "$(pwd)/sites.geojson" \ --volume "$(pwd)/sites.geojson" \
--volume "$(pwd)/hawaii-hazard-output:/app/output" \ --volume "$(pwd)/hawaii-hazard-output:/app/output" \
code.usgs.gov:5001/ghsc/nshmp/nshmp-haz/nshmp-haz usgs/nshmp-haz
``` ```
#### [`DisaggCalc`](../../src/main/java/gov/usgs/earthquake/nshmp/DisaggCalc.java) Example #### [`DisaggCalc`](../../src/main/java/gov/usgs/earthquake/nshmp/DisaggCalc.java) Example
...@@ -180,7 +178,7 @@ assumption a GeoJSON [site](./Site-Specification.md) file exists named `sites.ge ...@@ -180,7 +178,7 @@ assumption a GeoJSON [site](./Site-Specification.md) file exists named `sites.ge
git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git
# Pull image # Pull image
docker pull code.usgs.gov:5001/ghsc/nshmp/nshmp-haz/nshmp-haz:latest docker pull usgs/nshmp-haz:latest
# Run nshmp-haz DisaggCalc # Run nshmp-haz DisaggCalc
docker run \ docker run \
...@@ -189,7 +187,7 @@ docker run \ ...@@ -189,7 +187,7 @@ docker run \
--volume "$(pwd)/nshm-hawaii:/app/model" \ --volume "$(pwd)/nshm-hawaii:/app/model" \
--volume "$(pwd)/sites.geojson" \ --volume "$(pwd)/sites.geojson" \
--volume "$(pwd)/hawaii-disagg-output:/app/output" \ --volume "$(pwd)/hawaii-disagg-output:/app/output" \
code.usgs.gov:5001/ghsc/nshmp/nshmp-haz/nshmp-haz:latest usgs/nshmp-haz:latest
``` ```
#### [`RateCalc`](../../src/main/java/gov/usgs/earthquake/nshmp/RateCalc.java) Example #### [`RateCalc`](../../src/main/java/gov/usgs/earthquake/nshmp/RateCalc.java) Example
...@@ -203,7 +201,7 @@ assumption a GeoJSON [site](./Site-Specification.md) file exists named `sites.ge ...@@ -203,7 +201,7 @@ assumption a GeoJSON [site](./Site-Specification.md) file exists named `sites.ge
git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-hawaii.git
# Pull image # Pull image
docker pull code.usgs.gov:5001/ghsc/nshmp/nshmp-haz/nshmp-haz:latest docker pull usgs/nshmp-haz:latest
# Run nshmp-haz RateCalc # Run nshmp-haz RateCalc
docker run \ docker run \
...@@ -211,7 +209,7 @@ docker run \ ...@@ -211,7 +209,7 @@ docker run \
--volume "$(pwd)/nshm-hawaii:/app/model" \ --volume "$(pwd)/nshm-hawaii:/app/model" \
--volume "$(pwd)/sites.geojson" \ --volume "$(pwd)/sites.geojson" \
--volume "$(pwd)/hawaii-rate-output:/app/output" \ --volume "$(pwd)/hawaii-rate-output:/app/output" \
code.usgs.gov:5001/ghsc/nshmp/nshmp-haz/nshmp-haz usgs/nshmp-haz
``` ```
### Run Customization ### Run Customization
...@@ -223,13 +221,13 @@ be set with the environment flag (-e, -env): ...@@ -223,13 +221,13 @@ be set with the environment flag (-e, -env):
docker run \ docker run \
--env JAVA_MEMORY=<MEMORY> \ --env JAVA_MEMORY=<MEMORY> \
... ...
code.usgs.gov:5001/ghsc/nshmp/nshmp-haz/nshmp-haz usgs/nshmp-haz
# Example # Example
docker run \ docker run \
--env JAVA_MEMORY="12g" \ --env JAVA_MEMORY="12g" \
... ...
code.usgs.gov:5001/ghsc/nshmp/nshmp-haz/nshmp-haz usgs/nshmp-haz
``` ```
Where: Where:
......
...@@ -80,7 +80,7 @@ or its children will be processed; any standalone sources will be ignored. For e ...@@ -80,7 +80,7 @@ or its children will be processed; any standalone sources will be ignored. For e
**source-group.json:** A specialized form of logic tree that describes model branches that are **source-group.json:** A specialized form of logic tree that describes model branches that are
additive and therefore does not include weights. Examples from the NSHM for the conterminous U.S. additive and therefore does not include weights. Examples from the NSHM for the conterminous U.S.
NSHM include the Cascadia segmented partial-rupture models and the New Madrid 1500-yr cluster NSHM include the Cascadia segmented and partial-rupture models, and the New Madrid 1500-yr cluster
branches. The branch objects in a source group _may_ include an optional `scale` member that can branches. The branch objects in a source group _may_ include an optional `scale` member that can
be used to impose a probability of occurrence or other scaling requred by a NSHM. If absent, the be used to impose a probability of occurrence or other scaling requred by a NSHM. If absent, the
`scale` value is one. `scale` value is one.
......
...@@ -71,6 +71,9 @@ rupture representations. ...@@ -71,6 +71,9 @@ rupture representations.
```json ```json
{ {
"grid-spacing": 0.1, "grid-spacing": 0.1,
"smoothing-density": 10,
"smoothing-limit": 40.0,
"opt-distance-bin": 1.0,
"point-source-type": "FINITE", "point-source-type": "FINITE",
"rupture-scaling": "NSHM_POINT_WC94_LENGTH", "rupture-scaling": "NSHM_POINT_WC94_LENGTH",
"max-depth": 22.0, "max-depth": 22.0,
...@@ -151,6 +154,9 @@ __zone-config.json:__ Zone source model configuration is identical to a grid sou ...@@ -151,6 +154,9 @@ __zone-config.json:__ Zone source model configuration is identical to a grid sou
```json ```json
{ {
"grid-spacing": 0.1, "grid-spacing": 0.1,
"smoothing-density": 10,
"smoothing-limit": 40.0,
"opt-distance-bin": null,
"point-source-type": "FIXED_STRIKE", "point-source-type": "FIXED_STRIKE",
"rupture-scaling": "NSHM_POINT_WC94_LENGTH", "rupture-scaling": "NSHM_POINT_WC94_LENGTH",
"max-depth": 22.0, "max-depth": 22.0,
......
...@@ -119,12 +119,12 @@ Open browser to [http://localhost:8080/](http://localhost:8080/). ...@@ -119,12 +119,12 @@ Open browser to [http://localhost:8080/](http://localhost:8080/).
### Run from Container Registry ### Run from Container Registry
A public Docker image is avaialable from this repository's A public Docker image is avaialable from [Docker hub](https://hub.docker.com/r/usgs/nshmp-haz-ws).
[container registry](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/container_registry).
There are 3 main tags: There are 4 main tags:
* `latest`: Refers to the latest updates from the main or production branch * `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 * `staging-latest`: Refers to the
[main](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/main) branch and is the latest updates [main](https://code.usgs.gov/ghsc/nshmp/nshmp-haz/-/tree/main) branch and is the latest updates
* `production-latest`: Refers to the * `production-latest`: Refers to the
...@@ -132,10 +132,10 @@ There are 3 main tags: ...@@ -132,10 +132,10 @@ There are 3 main tags:
```bash ```bash
# Pull image # Pull image
docker pull code.usgs.gov:5001/ghsc/nshmp/nshmp-haz/nshmp-haz-ws:latest docker pull usgs/nshmp-haz-ws:latest
# Run # Run
docker run -p 8080:8080 -v "/path/to/model:/model" code.usgs.gov:5001/ghsc/nshmp/nshmp-haz/nshmp-haz-ws docker run -p 8080:8080 -v "/path/to/model:/model" usgs/nshmp-haz-ws
``` ```
Web service runs on [http://localhost:8080/](http://localhost:8080/) Web service runs on [http://localhost:8080/](http://localhost:8080/)
...@@ -146,14 +146,14 @@ The hazard model is read in via Docker volumes. ...@@ -146,14 +146,14 @@ The hazard model is read in via Docker volumes.
```bash ```bash
# Pull image # Pull image
docker pull code.usgs.gov:5001/ghsc/nshmp/nshmp-haz/nshmp-haz-ws:latest docker pull usgs/nshmp-haz-ws:latest
# Download NSHM CONUS # Download NSHM CONUS
cd .. cd ..
git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-conus git clone https://code.usgs.gov/ghsc/nshmp/nshms/nshm-conus
# Run web services # Run web services
docker run -p 8080:8080 -v "$(pwd):/model" code.usgs.gov:5001/ghsc/nshmp/nshmp-haz/nshmp-haz-ws docker run -p 8080:8080 -v "$(pwd):/model" usgs/nshmp-haz-ws
``` ```
Open browser to [http://localhost:8080/](http://localhost:8080/). Open browser to [http://localhost:8080/](http://localhost:8080/).
......
...@@ -11,7 +11,7 @@ micronautRxVersion = 2.1.1 ...@@ -11,7 +11,7 @@ micronautRxVersion = 2.1.1
micronautPluginVersion = 3.1.1 micronautPluginVersion = 3.1.1
nodePluginVersion = 3.0.1 nodePluginVersion = 3.0.1
nodeVersion = 16.3.0 nodeVersion = 16.3.0
nshmpLibVersion = 1.0.6 nshmpLibVersion = 1.1.0
nshmpWsUtilsVersion = 0.3.7 nshmpWsUtilsVersion = 0.3.7
shadowVersion = 7.1.2 shadowVersion = 7.1.2
spotbugsVersion = 4.7.0 spotbugsVersion = 4.7.0
......
apply plugin: "com.palantir.git-version"
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
doFirst { doFirst {
def versionFile = new File("${projectDir}/src/main/resources/version/nshmp-haz-version.json") try {
new File(versionFile.getParent()).mkdirs() apply plugin: "com.palantir.git-version"
def details = versionDetails()
def ciProjectUrl = System.getenv("CI_PROJECT_URL") def versionFile = new File("${projectDir}/src/main/resources/version/nshmp-haz-version.json")
def branch = System.getenv("CI_COMMIT_BRANCH") new File(versionFile.getParent()).mkdirs()
def versionInfo = [ def details = versionDetails()
branchName: branch ? branch : details.branchName, def ciProjectUrl = System.getenv("CI_PROJECT_URL")
commitDistance: details.commitDistance, def branch = System.getenv("CI_COMMIT_BRANCH")
gitHash: details.gitHash, def versionInfo = [
gitHashFull: details.gitHashFull, branchName: branch ? branch : details.branchName,
isCleanTag: details.isCleanTag, commitDistance: details.commitDistance,
lastTag: details.lastTag, gitHash: details.gitHash,
projectName: project.name, gitHashFull: details.gitHashFull,
url: ciProjectUrl ? ciProjectUrl : 'git config --get remote.origin.url'.execute().text.replace('\n', ''), isCleanTag: details.isCleanTag,
version: details.version, lastTag: details.lastTag,
] projectName: project.name,
def json = groovy.json.JsonOutput.toJson(versionInfo) url: ciProjectUrl ? ciProjectUrl : "git config --get remote.origin.url".execute().text.replace("\n", ""),
versionFile.write(groovy.json.JsonOutput.prettyPrint(json)) version: details.version,
]
def json = groovy.json.JsonOutput.toJson(versionInfo)
versionFile.write(groovy.json.JsonOutput.prettyPrint(json))
} catch (Exception e) {
println("Failed to create version file.")
}
} }
} }
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