Web service provided by the U.S. Geological Survey for computing seismic design parameters compatible with various building code reference documents.
Before developing locally, you will need to execute the following steps to setup your local environment:
- Run
npm install
to install application development dependencies-
The application will prompt you for configuration information, and create a file named
src/conf/config.json
in the project.The application expects that the configured postgres database already exists. If you set "database name" to anything other than "postgres" you will need to manually create the database after installing the postgres instance
-
- Setup a postgis enabled Postgres database
- Use the mdillon/postgis
image to install a docker container running Postgres:
docker run --name postgres-postgis \ -p {DB_PORT}:5432 \ -e POSTGRES_PASSWORD={DB_PASSWORD} \ -d mdillon/postgis
- Use the mdillon/postgis
image to install a docker container running Postgres:
- Run data loading process for component data end points:
node src/lib/db/load_data.js
- Run
npm run dev
from the install directory
- From root of project, run:
docker build -t usgs/earthquake-design-ws:latest .
When initially creating a container from the base image, you must provide several configuration parameters based on your working environment.
-
Required configuration
MOUNT_PATH
: The base URL path on which to listen for requests. This can be any path, or an empty path to listen on slash "/".PORT
: The port number on which to listen for connections. This can be any available port on the host system.
-
Start the container using the image tag.
In the command below, replace values in brackets
{VALUE}
with the corresponding configuration value determined above.docker run -d --name earthquake-design-ws \ -p {PORT}:8000 \ -e MOUNT_PATH={MOUNT_PATH} \ -e LEGACY_URL={LEGACY_URL} \ usgs/earthquake-design-ws:latest
Alternatively you may use
docker-compose
to start the container. Prior to starting the container you should update the relevant configuration information in the docker-compose.yml file and then run the command:docker-compose up -d
-
Connect to the running container in browser.
In the URL below, replace values in brackets
{VALUE}
with the corresponding configuration value determined above.http://localhost:{PORT}{MOUNT_PATH}
-
Stopping and starting the container. Once you have successfully created and configured a container from a base image (above), you can subsequently start and stop the container with the following commands.
docker stop earthquake-design-ws docker start earthquake-design-ws docker restart earthquake-design-ws
If you created the container using the
docker-compose
method, you can start and stop the container with the following commands instead:docker-compose stop docker-compose start docker-compose restart