File tree Expand file tree Collapse file tree 8 files changed +142
-35
lines changed
Expand file tree Collapse file tree 8 files changed +142
-35
lines changed Original file line number Diff line number Diff line change 5353 run : |
5454 make docker-compose-build
5555 make docker-compose-start
56- sleep 30
56+ make docker-compose-wait SERVICE=postgres
5757
5858 - name : Run tests
5959 run : make test ARGS="--disable-warnings"
Original file line number Diff line number Diff line change 11# * Variables
22SHELL: =/usr/bin/env bash
33ARGS: =
4+ CONSOLE: =bash
45
56# * Docker variables
67DOCKER =docker-compose --file docker/compose.yaml --env-file docker/.env
78DOCKER_IMAGE: =epigraphhub_py
89DOCKER_VERSION: =latest
910DOCKER_SERVICES: =
11+ DOCKER_SERVICE: =
12+ TIMEOUT: =90
13+
1014
1115# * Formatters
1216.PHONY : linter
@@ -56,6 +60,11 @@ docker-compose-build:
5660docker-compose-start :
5761 $(DOCKER ) up -d ${DOCKER_SERVICES}
5862
63+ .PHONY : docker-compose-run-console
64+ docker-compose-run-console :
65+ $(DOCKER ) run ${DOCKER_SERVICE} ${CONSOLE}
66+
67+
5968.PHONY : docker-compose-start-no-detatched
6069docker-compose-start-no-detatched : # useful for debugging
6170 $(DOCKER ) up ${DOCKER_SERVICES}
@@ -75,6 +84,10 @@ docker-compose-logs:
7584.PHONY : docker-compose-restart
7685docker-compose-restart : docker-compose-stop docker-compose-stop
7786
87+ .PHONY : docker-compose-wait
88+ docker-compose-wait :
89+ timeout ${TIMEOUT} ./docker/healthcheck.sh ${SERVICE}
90+
7891
7992# * Config
8093.PHONY :
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # shellcheck disable=all
3+
4+ PROJECT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && cd ../ && pwd ) "
5+
6+ if [ -f ${PROJECT_DIR} /.env ]; then
7+ # Load Environment Variables
8+ export $( cat ${PROJECT_DIR} /.env | grep -v ' #' | sed ' s/\r$//' | awk ' /=/ {print $1}' )
9+ fi
10+
11+ export CONTAINER_NAME=${1:- " superset" }
12+ export CONTAINER_NAME=" docker_${CONTAINER_NAME} _1"
13+
14+ echo " [II] Checking ${CONTAINER_NAME} ..."
15+
16+ while [ " ` docker inspect -f {{.State.Health.Status}} ${CONTAINER_NAME} ` " != " healthy" ];
17+ do
18+ echo " [II] Waiting for ${CONTAINER_NAME} ..."
19+ sleep 5;
20+ done
21+
22+ echo " [II] ${CONTAINER_NAME} is healthy."
Original file line number Diff line number Diff line change 1- FROM postgis/postgis:14-3.2
1+ # from https://github.com/postgis/docker-postgis/blob/969ef8a9e4a22e1556ca99cab4178f6e60c1483d/14-3.2/Dockerfile
2+ FROM postgres:14-bullseye
3+
4+ LABEL maintainer="PostGIS Project - https://postgis.net"
5+
6+ ENV POSTGIS_MAJOR 3
7+
8+ RUN apt-get update \
9+ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \
10+ && apt-get install -y --no-install-recommends \
11+ postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \
12+ postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \
13+ && rm -rf /var/lib/apt/lists/*
14+
15+ RUN mkdir -p /docker-entrypoint-initdb.d
16+ COPY ./docker/postgresql/initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh
17+ COPY ./docker/postgresql/update-postgis.sh /usr/local/bin
18+
219
320ENV DEBIAN_FRONTEND=noninteractive
421RUN apt-get -qq update --yes \
522 && apt-get -qq install --yes --no-install-recommends \
623 build-essential ca-certificates \
7- postgresql-14-plr \
8- postgresql-14-postgis-3-scripts \
9- postgresql-plpython3-14 \
24+ postgresql-$PG_MAJOR-plr \
25+ postgresql-plpython3-$PG_MAJOR \
1026 postgresql-contrib \
1127 && rm -rf /var/lib/apt/lists/*
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # shellcheck disable=all
3+
4+ # ref: https://github.com/postgis/docker-postgis/blob/a6a9f021e243c0b6f908cf8ad8d0ae5460dcb1b1/14-3.2/initdb-postgis.sh
5+
6+ set -e
7+
8+ # Perform all actions as $POSTGRES_USER
9+ export PGUSER=" $POSTGRES_USER "
10+
11+ # Create the 'template_postgis' template db
12+ " ${psql[@]} " << - 'EOSQL '
13+ CREATE DATABASE template_postgis IS_TEMPLATE true;
14+ EOSQL
15+
16+ # Load PostGIS into both template_database and $POSTGRES_DB
17+ for DB in template_postgis " $POSTGRES_DB " ; do
18+ echo " Loading PostGIS extensions into $DB "
19+ " ${psql[@]} " --dbname=" $DB " << -'EOSQL '
20+ CREATE EXTENSION IF NOT EXISTS postgis;
21+ CREATE EXTENSION IF NOT EXISTS postgis_topology;
22+ -- Reconnect to update pg_setting.resetval
23+ -- See https://github.com/postgis/docker-postgis/issues/288
24+ \c
25+ CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
26+ CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
27+ EOSQL
28+ done
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ # shellcheck disable=all
3+
4+ # ref: https://github.com/postgis/docker-postgis/blob/a6a9f021e243c0b6f908cf8ad8d0ae5460dcb1b1/14-3.2/update-postgis.sh
5+
6+ set -e
7+
8+ # Perform all actions as $POSTGRES_USER
9+ export PGUSER=" $POSTGRES_USER "
10+
11+ POSTGIS_VERSION=" ${POSTGIS_VERSION%% +* } "
12+
13+ # Load PostGIS into both template_database and $POSTGRES_DB
14+ for DB in template_postgis " $POSTGRES_DB " " ${@ } " ; do
15+ echo " Updating PostGIS extensions '$DB ' to $POSTGIS_VERSION "
16+ psql --dbname=" $DB " -c "
17+ -- Upgrade PostGIS (includes raster)
18+ CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION ';
19+ ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION ';
20+
21+ -- Upgrade Topology
22+ CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION ';
23+ ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION ';
24+
25+ -- Install Tiger dependencies in case not already installed
26+ CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
27+ -- Upgrade US Tiger Geocoder
28+ CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION ';
29+ ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION ';
30+ "
31+ done
Original file line number Diff line number Diff line change @@ -55,14 +55,14 @@ jupyter = "^1.0.0"
5555joblib = " ^1.1.0"
5656tensorflow = " ^2.5.0"
5757scikit-learn = " ^1.0.2"
58- ngboost = {git = " https://github.com/stanfordmlgroup/ngboost" , rev = " v0.3.12" }
5958rioxarray = " ^0.10.2"
6059wget = " ^3.2"
6160requests = " ^2.27.1"
6261tabulate = " ^0.8.9"
6362click = " ^8.1.0"
6463wbgapi = " 1.0.7"
6564PyYAML = " ^6.0"
65+ ngboost-release = " 0.3.12-2"
6666
6767[tool .poetry .dev-dependencies ]
6868bandit = " ^1.7.2"
You can’t perform that action at this time.
0 commit comments