Skip to content

Commit

Permalink
Merge pull request #22 from ksonda/cloud-devops
Browse files Browse the repository at this point in the history
Organize Deployment configurations
  • Loading branch information
Kyle Onda authored Oct 9, 2021
2 parents 4634bcb + 5429ad9 commit b7e1839
Show file tree
Hide file tree
Showing 3,165 changed files with 191 additions and 572,587 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
39 changes: 0 additions & 39 deletions .github/workflows/pygeoapi-ci.yml

This file was deleted.

25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,27 @@
# global-river-runner
Let's make a global river runner

# Use

The basic operation is to issue a GET request of the form:

```
https://your-river-runner-domain.com/processes/river-runner/execution?lat=<y>&lng=<x>
```

Performance is best if your request header includes `Accept-Encoding: gzip` and `Accept: application/json`.

# Back-end Deployment
Deployment requires an instance of [pygeoapi](https://pygeoapi.io) and postgres with PostGIS installed.

The pygeoapi instance must include the [river-runner](https://github.com/webb-ben/pygeoapi/blob/river-runner/pygeoapi/process/river_runner.py) process as well as [several other modifications](https://github.com/geopython/pygeoapi/compare/master...webb-ben:river-runner).

We have prepared [docker images](https://hub.docker.com/r/webbben/pygeoapi-river-runner/tags) for both the latest and current stable versions of pygeoapi with the necessary modifications.

A copy of the hydrography database used is documented and available for download [here](https://www.sciencebase.gov/catalog/item/614a8864d34e0df5fb97572d).

## Cloud
See the [deploy/cloud](deploy/cloud) directory for Dockerfiles and pygeoapi configurations necessary to deploy an appropriately configured pygeoapi container to the cloud service of your choice. Note the need to use environmental variables `URL` (your desired service URL for the pygeoapi base path), and `DBHOST`, `DBUSER`,`DBNAME`, `DBPASSWORD` (to connect to your database). The pygeoapi river-runner is designed to be a stateless application, so your database must be deployed separately.

## Local
See the [deploy/local](deploy/local) directory for a docker-compose and pygeoapi configuration for a pygeoapi and postgis stack.
5 changes: 5 additions & 0 deletions deploy/cloud/latest/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM webbben/pygeoapi-river-runner:latest
#last update 2021-10-8T16:00:00-5

#add requirements and mods
COPY ./pygeoapi.config.yml /pygeoapi/local.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ server:
bind:
host: localhost #change to your hostname if running your own instance
port: 5050
url: https://merit.internetofwater.app #change to host URL if running your own instance
url: ${URL} #change to host URL if running your own instance
mimetype: application/json; charset=UTF-8
encoding: utf-8
languages: en-US
Expand All @@ -21,7 +21,7 @@ server:
# name: TinyDB
# connection: /tmp/pygeoapi-process-manager.db
# output_dir: /tmp/
ogc_schemas_location: /opt/schemas.opengis.net
ogc_schemas_location: /schemas.opengis.net
# templates:
# path: /skin-dashboard/templates
# static: /skin-dashboard/static
Expand Down Expand Up @@ -98,7 +98,7 @@ resources:
- type: feature
name: PostgreSQL
data:
host: /cloudsql/global-river-runner:us-central1:global-river-runner-db
host: ${DBHOST}
dbname: ${DBNAME}
user: ${DBUSER}
password: ${DBPASSWORD}
Expand Down
5 changes: 5 additions & 0 deletions deploy/cloud/stable/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM webbben/pygeoapi-river-runner:stable
#last update 2021-10-9T13:30:00-5

#add requirements and mods
COPY ./pygeoapi.config.yml /pygeoapi/local.config.yml
142 changes: 142 additions & 0 deletions deploy/cloud/stable/pygeoapi.config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#
# LAST UPDATE: 2021-10-8 12:00:00-5
#=================================================================
#

server:
bind:
host: localhost #change to your hostname if running your own instance
port: 5050
url: ${URL} #change to host URL if running your own instance
mimetype: application/json; charset=UTF-8
encoding: utf-8
languages: en-US
cors: true
pretty_print: true
limit: 100
map:
url: https://tile.openstreetmap.org/{z}/{x}/{y}.png
attribution: '<a href="https://www.openstreetmap.org/copyright">© OpenStreetMap contributors</a>'
# manager:
# name: TinyDB
# connection: /tmp/pygeoapi-process-manager.db
# output_dir: /tmp/
ogc_schemas_location: /schemas.opengis.net
# templates:
# path: /skin-dashboard/templates
# static: /skin-dashboard/static

logging:
level: ERROR
logfile: /tmp/pygeoapi.log

metadata:
identification:
title:
en: MERIT-based vector features
description:
en: Provides flowpath/ mainstem features based on MERIT
keywords:
en:
- geospatial
- data
- api
- rivers
- mainstems
keywords_type: theme
terms_of_service: https://creativecommons.org/licenses/by/4.0/
url: https://github.com/ksonda/global-river-runner
license:
name: CC-BY 4.0 license
url: https://creativecommons.org/licenses/by/4.0/
provider:
name: Kyle Onda
url: https://github.com/ksonda
contact:
address: 2111 Campus Dr
city: Durham
stateorprovince: North Carolina
postalcode: 27708
country: USA
email: [email protected]
url: https://internetofwater.org
role: pointOfContact

resources:
merit:
type: collection
title:
en: merit
description:
en: merit features
keywords:
en:
- rivers
- mainstems
context:
- schema: https://schema.org/
nameid: schema:name
links:
- type: application/html
rel: canonical
title: source
href: https://www.sciencebase.gov/catalog/item/614a8864d34e0df5fb97572d
hreflang: en-US
- type: application/html
rel: canonical
title: information
href: https://www.usgs.gov/core-science-systems/ngp/national-hydrography/value-added-attributes-vaas
hreflang: en-US
extents:
spatial:
bbox: [-180,-90,180,90]
crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84
temporal:
begin: null
end: null
providers:
- type: feature
name: PostgreSQL
data:
host: ${DBHOST}
dbname: ${DBNAME}
user: ${DBUSER}
password: ${DBPASSWORD}
search_path: [public]
geom_field: wkb_geometry
id_field: ogc_fid
table: merit_plus

river-runner:
type: process
processor:
name: RiverRunner
title:
en: River Runner
description:
en: A process that takes a set of coordinates in the world, and returns the largest flowpath from it to its terminal flowpoint.
keywords:
en:
- rivers
- river-runner
links:
- type: application/html
rel: canonical
title: source
href: https://www.sciencebase.gov/catalog/item/614a8864d34e0df5fb97572d
hreflang: en-US
- type: application/html
rel: cannonical
title: github
href: https://github.com/ksonda/global-river-runner
hreflang: en-US
- type: application/html
rel: cannonical
title: application
href: https://river-runner-global.vercel.app/
hreflang: en-US
- type: application/html
rel: canonical
title: information
href: https://www.usgs.gov/core-science-systems/ngp/national-hydrography/value-added-attributes-vaas
hreflang: en-US
10 changes: 10 additions & 0 deletions deploy/local/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Deploy locally

```
git clone https://github.com/ksonda/global-river-runner.git
cd deploy/local
wget https://prod-is-usgs-sb-prod-publish.s3.amazonaws.com/614a8864d34e0df5fb97572d/merit_plus.sql.gz
docker-compose up -d
```

pygeoapi should be accessible at localhost:5050. The database may take up to an hour to load depending on your hardware.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ server:
bind:
host: localhost #change to your hostname if running your own instance
port: 5050
url: https://merit.internetofwater.dev #change to host URL if running your own instance
url: http://localhost:5050 #change to host URL if running your own instance
mimetype: application/json; charset=UTF-8
encoding: utf-8
languages: en-US
Expand Down
Binary file removed pygeoapi/.DS_Store
Binary file not shown.
2 changes: 0 additions & 2 deletions pygeoapi/.gitattributes

This file was deleted.

7 changes: 0 additions & 7 deletions pygeoapi/Dockerfile

This file was deleted.

23 changes: 0 additions & 23 deletions pygeoapi/Dockerfile_db

This file was deleted.

24 changes: 0 additions & 24 deletions pygeoapi/LICENSE

This file was deleted.

2 changes: 0 additions & 2 deletions pygeoapi/README.md

This file was deleted.

63 changes: 0 additions & 63 deletions pygeoapi/build.sh

This file was deleted.

Binary file removed pygeoapi/pygeoapi-skin-dashboard/.DS_Store
Binary file not shown.
Loading

0 comments on commit b7e1839

Please sign in to comment.