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
b2672b6f
Commit
b2672b6f
authored
5 years ago
by
Clayton, Brandon Scott
Browse files
Options
Downloads
Patches
Plain Diff
Update deploy to use Micronaut
parent
7999167b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!481
Deagg Epsilon
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Dockerfile
+11
-23
11 additions, 23 deletions
Dockerfile
docker-entrypoint.sh
+9
-31
9 additions, 31 deletions
docker-entrypoint.sh
scripts/nshmp-haz.yml
+1
-1
1 addition, 1 deletion
scripts/nshmp-haz.yml
with
21 additions
and
55 deletions
Dockerfile
+
11
−
23
View file @
b2672b6f
...
...
@@ -22,6 +22,8 @@
ARG
project=nshmp-haz-v2
ARG
builder_workdir=/app/${project}
ARG
libs_dir=${builder_workdir}/build/libs
ARG
jar_file=${libs_dir}/${project}.jar
ARG
ws_file=${libs_dir}/${project}-ws.jar
####
# Builder image: Build jar and war file.
...
...
@@ -31,6 +33,8 @@ FROM usgs/centos:8 as builder
ENV
LANG="en_US.UTF-8"
ARG
builder_workdir
ARG
libs_dir
ARG
jar_file
WORKDIR
${builder_workdir}
...
...
@@ -39,7 +43,8 @@ COPY . .
RUN
yum
install
-y
java-11-openjdk-devel which git
RUN
mv
nshmp-lib ../.
\
&&
./gradlew
--no-daemon
assemble
&&
./gradlew
--no-daemon
assemble
\
&&
mv
${
libs_dir
}
/
*
-all
.jar
${
ws_file
}
####
# Application image: Run jar or war file.
...
...
@@ -51,13 +56,13 @@ LABEL maintainer="Peter Powers <pmpowers@usgs.gov>, Brandon Clayton <bclayton@us
ENV
LANG="en_US.UTF-8"
ARG
libs_dir
ARG
ws_file
ARG
builder_workdir
ARG
project
ARG
TOMCAT_MAJOR=8
ARG
TOMCAT_VERSION=${TOMCAT_MAJOR}.5.40
ENV
PROJECT ${project}
ENV
JAVA_XMX 8g
ENV
CONTEXT_PATH "/"
ENV
MODEL_PATH /app/models
# Whether to run hazard jar file or web services war file
ENV
RUN_HAZARD true
...
...
@@ -72,30 +77,13 @@ ENV IML ""
ENV
CONFIG_FILE "config.json"
VOLUME
[ "/app/output" ]
# Tomcat
ENV
CONTEXT_PATH ""
ENV
CATALINA_HOME /usr/local/tomcat
ENV
TOMCAT_WEBAPPS ${CATALINA_HOME}/webapps
ENV
PATH ${CATALINA_HOME}/bin:${PATH}
ENV
TOMCAT_SOURCE http://archive.apache.org/dist/tomcat
ENV
TOMCAT_URL ${TOMCAT_SOURCE}/tomcat-${TOMCAT_MAJOR}/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz
ENV
JAVA_OPTS -Xmx${JAVA_XMX}
ENV
WS_HOME ${CATALINA_HOME}
ENV
HAZ_HOME /app
WORKDIR
${HAZ_HOME}
WORKDIR
/app
COPY
--from=builder ${libs_dir}/* ./
COPY
docker-entrypoint.sh .
WORKDIR
${WS_HOME}
RUN
yum update
-y
\
&&
yum
install
-y
file jq zip java-11-openjdk-headless
\
&&
curl
-L
${
TOMCAT_URL
}
|
tar
-xz
--strip-components
=
1
WORKDIR
${HAZ_HOME}
&&
yum
install
-y
file jq zip java-11-openjdk-headless
EXPOSE
8080
ENTRYPOINT
[ "bash", "docker-entrypoint.sh" ]
This diff is collapsed.
Click to expand it.
docker-entrypoint.sh
+
9
−
31
View file @
b2672b6f
...
...
@@ -107,7 +107,7 @@ run_hazard() {
# Run nshmp-haz
java
-Xms
${
JAVA_XMS
}
-Xmx
${
JAVA_XMX
}
\
-cp
${
HAZ_HOME
}
/
${
PROJECT
}
.jar
\
-cp
/app
/
${
PROJECT
}
.jar
\
gov.usgs.earthquake.nshmp.
${
nshmp_program
}
\
"
${
nshmp_model_path
}
"
\
"
${
site_file
}
"
\
...
...
@@ -130,9 +130,15 @@ run_hazard() {
# None
####
run_ws
()
{
unpack_war
;
get_ws_models
;
catalina.sh run 2>&1
;
if
[
-z
${
CONTEXT_PATH
}
]
;
then
CONTEXT_PATH
=
"/nshmp/
${
MODEL
}
"
;
fi
java
-jar
${
PROJECT
}
-ws
.jar
\
"-Dmicronaut.server.context-path=
${
CONTEXT_PATH
}
"
\
-model
=
/app/models
}
####
...
...
@@ -510,34 +516,6 @@ move_to_output_volume() {
cp
-r
${
hazout
}
/
*
output/. 2>
${
LOG_FILE
}
;
}
####
# Unpack war file into webapps/<CONTEXT_PATH>.
# Globals:
# (string) CONTEXT_PATH - The context path for the web services
# (string) LOG_FILE - The log file
# (string) MODEL - The model to use
# (string) PROJECT - The project name
# (string) TOMCAT_WEBAPPS - The Tomcat webapps dir
# Arguments:
# None
# Returns:
# None
####
unpack_war
()
{
cd
${
TOMCAT_WEBAPPS
}
2>
${
LOG_FILE
}
;
if
[
-z
${
CONTEXT_PATH
}
]
;
then
CONTEXT_PATH
=
"nshmp/
${
MODEL
}
"
;
fi
CONTEXT_PATH
=
$(
echo
${
CONTEXT_PATH
//\//#
}
|
awk
{
'print tolower($0)'
}
)
2>
${
LOG_FILE
}
;
mkdir
${
CONTEXT_PATH
}
2>
${
LOG_FILE
}
;
cd
${
CONTEXT_PATH
}
2>
${
LOG_FILE
}
;
cp
${
HAZ_HOME
}
/
${
PROJECT
}
.war
.
2>
${
LOG_FILE
}
;
unzip
${
PROJECT
}
.war 2>
${
LOG_FILE
}
&> /dev/null
;
rm
${
PROJECT
}
.war 2>
${
LOG_FILE
}
;
}
####
# Run main
####
...
...
This diff is collapsed.
Click to expand it.
scripts/nshmp-haz.yml
+
1
−
1
View file @
b2672b6f
...
...
@@ -23,7 +23,7 @@ services:
environment
:
RUN_HAZARD
:
'
false'
MODEL
:
CONUS-2018
CONTEXT_PATH
:
nshmp/conus-2018
CONTEXT_PATH
:
/
nshmp/conus-2018
# # Deploy nshmp-haz with CONUS-2014
# nshmp-haz-conus-2014:
...
...
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