Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge postgres, loader, other updates #14

Merged
merged 5 commits into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions pygeoapi/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
FROM geopython/pygeoapi:latest

#Add data directory
RUN mkdir /data

#last updated 2021-09-14 00:09:28 UTC-5
ADD https://www.hydroshare.org/resource/4a22e88e689949afa1cf71ae009eaf1b/data/contents/merit_plus_simplify.gpkg /data/

#last updated 2021-09-14 00:019:50 UTC-5
ADD https://www.hydroshare.org/resource/4a22e88e689949afa1cf71ae009eaf1b/data/contents/e_merit_cats.gpkg /data/

#last updated 2021-09-14 00:019:50 UTC-5
ADD https://www.hydroshare.org/resource/4a22e88e689949afa1cf71ae009eaf1b/data/contents/w_merit_cats.gpkg /data/
FROM webbben/pygeoapi-river-runner:latest

#add requirements and mods
COPY ./pygeoapi.config.yml /pygeoapi/local.config.yml
COPY ./schemas.opengis.net /opt/schemas.opengis.net
COPY ./pygeoapi-skin-dashboard /skin-dashboard

#Add river runner plugin
COPY ./plugin.py /pygeoapi/pygeoapi/plugin.py
COPY ./flask_app.py /pygeoapi/pygeoapi/flask_app.py
COPY ./river_runner.py /pygeoapi/pygeoapi/process/river_runner.py
COPY ./sqlite.py /pygeoapi/pygeoapi/provider/sqlite.py
COPY ./map.html /pygeoapi/pygeoapi/templates/processes/map.html
23 changes: 23 additions & 0 deletions pygeoapi/Dockerfile_db
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM ubuntu:20.04 AS ZIP

#last updated 2021-09-22 00:09:28 UTC-5
ADD https://prod-is-usgs-sb-prod-publish.s3.amazonaws.com/614a8864d34e0df5fb97572d/merit_plus_simplify.zip /

#last updated 2021-09-14 00:019:50 UTC-5
# ADD https://www.hydroshare.org/resource/4a22e88e689949afa1cf71ae009eaf1b/data/contents/e_merit_cats.gpkg /data/

#last updated 2021-09-14 00:019:50 UTC-5
# ADD https://www.hydroshare.org/resource/4a22e88e689949afa1cf71ae009eaf1b/data/contents/w_merit_cats.gpkg /data/

RUN apt-get update \
&& apt-get install unzip \
&& unzip '/*.zip'

FROM kartoza/postgis:latest

# Add data directory
RUN mkdir /data/

COPY --from=ZIP /merit_plus_simplify.gpkg /data/merit_plus_simplify.gpkg

COPY ./build.sh /docker-entrypoint-initdb.d/build.sh
21 changes: 1 addition & 20 deletions pygeoapi/Dockerfile_gcp
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
FROM geopython/pygeoapi:latest

#Add data directory
RUN mkdir /data

#last updated 2021-09-14 00:09:28 UTC-5
ADD https://www.hydroshare.org/resource/4a22e88e689949afa1cf71ae009eaf1b/data/contents/merit_plus_simplify.gpkg /data/

#last updated 2021-09-14 00:019:50 UTC-5
ADD https://www.hydroshare.org/resource/4a22e88e689949afa1cf71ae009eaf1b/data/contents/e_merit_cats.gpkg /data/

#last updated 2021-09-14 00:019:50 UTC-5
ADD https://www.hydroshare.org/resource/4a22e88e689949afa1cf71ae009eaf1b/data/contents/w_merit_cats.gpkg /data/
FROM webbben/pygeoapi-river-runner:latest

#add requirements and mods
COPY ./pygeoapi.config.gcp.yml /pygeoapi/local.config.yml
COPY ./schemas.opengis.net /opt/schemas.opengis.net
COPY ./pygeoapi-skin-dashboard /skin-dashboard

#Add river runner plugin
COPY ./plugin.py /pygeoapi/pygeoapi/plugin.py
COPY ./flask_app.py /pygeoapi/pygeoapi/flask_app.py
COPY ./river_runner.py /pygeoapi/pygeoapi/process/river_runner.py
COPY ./sqlite.py /pygeoapi/pygeoapi/provider/sqlite.py
COPY ./map.html /pygeoapi/pygeoapi/templates/processes/map.html
63 changes: 63 additions & 0 deletions pygeoapi/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
# =================================================================
#
# Authors: Just van den Broecke <[email protected]>
#
# Copyright (c) 2019 Just van den Broecke
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# =================================================================
echo "START /build.sh"

set +e
echo "Begining build"
# python3 /scripts/ogr2ogr.py \
# -f PGDump -lco LAUNDER=NO -lco DROP_TABLE=OFF | gzip > /data/merit_.sql.gz \
# /data/merit_plus_simplify.gpkg
while [ ! -f /data/merit_plus_simplify.gpkg ]; do echo 1; sleep 1; done
ogr2ogr \
-f PostgreSQL \
PG:"host='localhost' \
user='${POSTGRES_USER}' \
password='${POSTGRES_PASSWORD}' \
dbname='${POSTGRES_DB}'" \
/data/merit_plus_simplify.gpkg

echo "Done"
# ogr2ogr \
# -f PostgreSQL \
# PG:"host='localhost' \
# user='${POSTGRES_USER}' \
# password='${POSTGRES_PASSWORD}' \
# dbname='${POSTGRES_DB}'" \
# /data/e_merit_cats.gpkg

# ogr2ogr \
# -f PostgreSQL \
# PG:"host='localhost' \
# user='${POSTGRES_USER}' \
# password='${POSTGRES_PASSWORD}' \
# dbname='${POSTGRES_DB}'" \
# /data/w_merit_cats.gpkg

# rm -rf /data/
36 changes: 26 additions & 10 deletions pygeoapi/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,33 @@ version: "3"
services:

pygeoapi:
image: geopython/pygeoapi:latest
ports:
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- 5050:80
volumes:
- ./pygeoapi.config.yml:/pygeoapi/local.config.yml
- ./merit_plus_simplify.gpkg:/data/merit_plus_simplify.gpkg
- ./e_merit_cats.gpkg:/data/e_merit_cats.gpkg
- ./w_merit_cats.gpkg:/data/w_merit_cats.gpkg
- ./plugin.py:/pygeoapi/pygeoapi/plugin.py
- ./flask_app.py:/pygeoapi/pygeoapi/flask_app.py
- ./river_runner.py:/pygeoapi/pygeoapi/process/river_runner.py
- ./sqlite.py:/pygeoapi/pygeoapi/provider/sqlite.py
- ./map.html:/pygeoapi/pygeoapi/templates/processes/map.html
- ./schemas.opengis.net:/opt/schemas.opengis.net

db:
build:
context: .
dockerfile: Dockerfile_db
restart: always
ports:
- 5432:5432
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: password
POSTGRES_DB: merit
volumes:
- ./merit_plus_simplify.gpkg:/data/merit_plus_simplify.gpkg
- ./build.sh:/docker-entrypoint-initdb.d/build.sh

adminer:
image: adminer
restart: always
ports:
- 8080:8080
Loading