GithubHelp home page GithubHelp logo

ozym / haz Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 11.05 MB

License: Apache License 2.0

Shell 1.13% Go 72.74% Protocol Buffer 0.71% CSS 0.91% JavaScript 8.36% HTML 8.22% XSLT 7.92%

haz's Introduction

haz

Projects related to haz messaging and the haz DB.

Working with Forks

To work with a fork of this repo you will need to clone the fork in such a way to preserve the import paths. Fork and clone to preserve the organization name e.g.,

 git clone [email protected]:YOUR_FORK/haz.git ${GOPATH}/src/github.com/GeoNet/haz

This could possibly include reseting GOPATH if you need to keep origin and a fork

Sub Projects

Messaging Applications

Producers

  • haz-sc3-producer - produces haz messges from SeisComPML. Need file system access in the container. See Container Testing below.

Consumers

Subprojects *-consumer consume msg.Haz or msg.Impact messages from SQS and process them.

Web Applications

  • geonet-rest - the server for api.geonet.org.nz
  • sc3ml-to-quakeml - web services to return QuakeML from SeisComPML.

Support Applications

  • haz-aws-messaging - creates AWS resources for the haz messaging. impact-intensity-consumer has a CFN template for it's resources.
  • haz-db-loader - used to load SeisComPML into the db. See below.

Protobufs

Compile protobufs

Database

Uses postgis. Pull and run the image (which already has the hazard db initialised and ready to use):

docker run --name hazdb -p 5432:5432 -d 862640294325.dkr.ecr.ap-southeast-2.amazonaws.com/haz-db:9.5

A Postgres 9.4 with Postgis 2.2 image can be built and pushed using:

docker build --rm=true -t 862640294325.dkr.ecr.ap-southeast-2.amazonaws.com/haz-db:9.5 -f database/Dockerfile database
docker push 862640294325.dkr.ecr.ap-southeast-2.amazonaws.com/haz-db:9.5

There is also a script to (re)initialise the DB ./database/scripts/initdb-93.sh

Loading Quake Data

Quake data can be back loaded from SeisComPML. Download SeisComPML from the S3 bucket and then load it to the DB using haz-db-loader:

aws s3 sync s3://seiscompml07 /work/seismcompml07 --exclude "*"  --include "2015p*"
cd haz-db-loader
go run haz-db-loader.go

Loading Quake Data - Origin Web Servers

Init the database with the qrt schema from the geonet project.

Quake data can be back loaded from SeisComPML. Download SeisComPML from the S3 bucket and then load it to the DB using haz-db-loader:

aws s3 sync s3://seiscompml07 /work/seismcompml07 --exclude "*"  --include "2015p*"
cd haz-db-origin-loader
go run haz-db-origin-loader.go

Tests

With the DB up run all tests

./all.sh

Docker Builds

./build.sh proj-name [proj-name]...

./build-push proj-name [proj-name]...

Also refer to .travis.yml.

Container Testing

docker-compose can be used to run a number of the containers together to test messaging.

Edit sc3-producer.env, db-consumer.env, and geonet-rest.env adding the outputs from running haz-aws-messaging.

mkdir /work/spool
sudo chown nobody /work/spool

Run the containers with docker-compose up.

Visit http://localhost:8080/soh/esb and check that heartbeat messages are arriving.

Send a quake and check it arrived (you should get GeoJSON for the quake):

rsync /work/seismcompml07/2015p494191.xml /work/spool/
curl http://localhost:8080/quake/2015p494191

Deployment

AWS Elastic Beanstalk

geonet-rest, quakesearch, sc3ml-to-quakeml, wfs.

There are files for EB - both to deploy the application and also set up logging from the container (application) to CloudWatch Logs. Create a zip file and then upload the zip to EB.

cd deploy
zip wfs.zip Dockerrun.aws.json .ebextensions/*

haz's People

Contributors

bpeng avatar crleblanc avatar junghao avatar ozym avatar sorennh avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

crleblanc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.