Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:
jobs:
on-success:
name: Build, Test and Push Docker Image to DockerHub
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
permissions:
packages: write
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
platforms: linux/arm64, linux/amd64

on-failure:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: Print Test Fail
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ on:

jobs:
main:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- python-version: '3.10'
- python-version: '3.12'
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v5
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ on:

jobs:
flake8_py3:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v5
name: setup Python
with:
python-version: '3.10'
python-version: '3.12'
- name: Checkout pygeoapi
uses: actions/checkout@master
- name: Install flake8
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ on:

jobs:
main:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
include:
- python-version: '3.10'
- python-version: '3.12'
env:
PYGEOAPI_CONFIG: "$(pwd)/pygeoapi-config.yml"

Expand Down Expand Up @@ -103,26 +103,30 @@ jobs:
packages: libsqlite3-mod-spatialite
version: 4.3.0a-6build1
- name: Use ubuntuGIS unstable ppa
run: sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable && sudo apt update
run: |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt update
sudo apt-get install gdal-bin libgdal-dev -y
shell: bash
- name: Install GDAL with Python bindings
uses: awalsh128/cache-apt-pkgs-action@v1.4.3
with:
packages: gdal-bin libgdal-dev
version: 3.8.4
# - name: Install GDAL with Python bindings
# uses: awalsh128/cache-apt-pkgs-action@v1.4.3
# with:
# packages: gdal-bin libgdal-dev
# version: 3.11.3
- name: Install and run Oracle
run: |
docker run -d --name oracledb -e ORACLE_PWD=oracle -v ${{ github.workspace }}/tests/data/oracle/init-db:/opt/oracle/scripts/startup -p 1521:1521 container-registry.oracle.com/database/express:21.3.0-xe
- name: Install requirements 📦
run: |
pip3 install setuptools
pip3 install -r requirements.txt
pip3 install -r requirements-admin.txt
pip3 install -r requirements-starlette.txt
pip3 install -r requirements-dev.txt
pip3 install -r requirements-provider.txt
pip3 install -r requirements-manager.txt
pip3 install -r requirements-django.txt
python3 setup.py install
pip3 install .
pip3 install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`
- name: setup test data ⚙️
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vulnerabilities.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
jobs:

vulnerabilities:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
defaults:
run:
working-directory: .
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ sphinx:
configuration: docs/source/conf.py

build:
os: ubuntu-22.04
os: ubuntu-24.04
tools:
python: "3.11"
python: "3.12"

python:
install:
Expand Down
37 changes: 17 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Francesco Bartoli <xbartolone@gmail.com>
# Angelos Tzotsos <gcpp.kalxas@gmail.com>
#
# Copyright (c) 2020 Tom Kralidis
# Copyright (c) 2025 Tom Kralidis
# Copyright (c) 2019 Just van den Broecke
# Copyright (c) 2025 Francesco Bartoli
# Copyright (c) 2025 Angelos Tzotsos
Expand Down Expand Up @@ -34,7 +34,7 @@
#
# =================================================================

FROM ubuntu:jammy-20250714
FROM ubuntu:noble-20250805

LABEL maintainer="Just van den Broecke <justb4@gmail.com>"

Expand Down Expand Up @@ -93,20 +93,20 @@ ENV TZ=${TZ} \
DEB_PACKAGES="\
locales \
tzdata \
gunicorn \
python3-dateutil \
python3-gevent \
python3-greenlet \
python3-pip \
python3-tz \
python3-venv \
python3-yaml \
${ADD_DEB_PACKAGES}"
${ADD_DEB_PACKAGES}" \
PROJ_LIB=/usr/share/proj

WORKDIR /pygeoapi

# Install operating system dependencies
RUN \
apt-get update -y \
RUN apt-get update -y \
&& apt-get install -y ${DEB_BUILD_DEPS} \
&& add-apt-repository ppa:ubuntugis/ubuntugis-unstable \
&& apt-get --no-install-recommends install -y ${DEB_PACKAGES} \
Expand All @@ -126,24 +126,21 @@ RUN \
&& apt autoremove -y \
&& rm -rf /var/lib/apt/lists/*

ADD requirements-docker.txt requirements-admin.txt /pygeoapi/
# Install remaining pygeoapi deps
RUN python3 -m pip install --no-cache-dir -r requirements-docker.txt \
&& python3 -m pip install --no-cache-dir -r requirements-admin.txt


ADD . /pygeoapi

# Install pygeoapi
RUN python3 -m pip install --no-cache-dir -e .
# Install remaining pygeoapi deps and pygeoapi itself
RUN python3 -m venv --system-site-packages /venv \
&& /venv/bin/python3 -m pip install --no-cache-dir -r requirements-docker.txt \
&& /venv/bin/python3 -m pip install --no-cache-dir -r requirements-admin.txt \
&& /venv/bin/python3 -m pip install --no-cache-dir gunicorn \
&& /venv/bin/python3 -m pip install --no-cache-dir -e .

RUN \
# Set default config and entrypoint for Docker Image
cp /pygeoapi/docker/default.config.yml /pygeoapi/local.config.yml \
# Set default config and entrypoint for Docker Image
# and compile language files
RUN cp /pygeoapi/docker/default.config.yml /pygeoapi/local.config.yml \
&& cp /pygeoapi/docker/entrypoint.sh /entrypoint.sh \
# compile language files
&& cd /pygeoapi \
&& for i in locale/*; do echo $i && pybabel compile -d locale -l `basename $i`; done

&& for i in locale/*; do if [ "$i" != "locale/README.md" ]; then echo $i && pybabel compile -d locale -l `basename $i`; fi; done \
&& chmod -R g=u /pygeoapi

ENTRYPOINT ["/entrypoint.sh"]
122 changes: 62 additions & 60 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
#
# Authors: Just van den Broecke <justb4@gmail.com>
# Benjamin Webb <benjamin.miller.webb@gmail.com>
# Tom Kralidis <tomkralidis@gmail.com>
#
# Copyright (c) 2019 Just van den Broecke
# Copyright (c) 2024 Benjamin Webb
# Copyright (c) 2025 Tom Kralidis
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
Expand Down Expand Up @@ -39,10 +41,10 @@ set +e
export PYGEOAPI_HOME=/pygeoapi

if [[ -z "$PYGEOAPI_CONFIG" ]]; then
export PYGEOAPI_CONFIG="${PYGEOAPI_HOME}/local.config.yml"
export PYGEOAPI_CONFIG="${PYGEOAPI_HOME}/local.config.yml"
fi
if [[ -z "$PYGEOAPI_OPENAPI" ]]; then
export PYGEOAPI_OPENAPI="${PYGEOAPI_HOME}/local.openapi.yml"
export PYGEOAPI_OPENAPI="${PYGEOAPI_HOME}/local.openapi.yml"
fi

# gunicorn env settings with defaults
Expand All @@ -60,8 +62,8 @@ entry_cmd=${1:-run}

# Shorthand
function error() {
echo "ERROR: $@"
exit -1
echo "ERROR: $@"
exit -1
}

# Workdir
Expand All @@ -70,71 +72,71 @@ cd ${PYGEOAPI_HOME}
echo "Default config in ${PYGEOAPI_CONFIG}"

echo "Trying to generate openapi.yml"
pygeoapi openapi generate ${PYGEOAPI_CONFIG} --output-file ${PYGEOAPI_OPENAPI}
/venv/bin/pygeoapi openapi generate ${PYGEOAPI_CONFIG} --output-file ${PYGEOAPI_OPENAPI}

[[ $? -ne 0 ]] && error "openapi.yml could not be generated ERROR"

echo "openapi.yml generated continue to pygeoapi"

start_gunicorn() {
# SCRIPT_NAME should not have value '/'
[[ "${SCRIPT_NAME}" = '/' ]] && export SCRIPT_NAME="" && echo "make SCRIPT_NAME empty from /"

echo "Starting gunicorn name=${CONTAINER_NAME} on ${CONTAINER_HOST}:${CONTAINER_PORT} with ${WSGI_WORKERS} workers and SCRIPT_NAME=${SCRIPT_NAME}"
exec gunicorn --workers ${WSGI_WORKERS} \
--worker-class=${WSGI_WORKER_CLASS} \
--timeout ${WSGI_WORKER_TIMEOUT} \
--name=${CONTAINER_NAME} \
--bind ${CONTAINER_HOST}:${CONTAINER_PORT} \
${@} \
${WSGI_APP}
# SCRIPT_NAME should not have value '/'
[[ "${SCRIPT_NAME}" = '/' ]] && export SCRIPT_NAME="" && echo "make SCRIPT_NAME empty from /"

echo "Starting gunicorn name=${CONTAINER_NAME} on ${CONTAINER_HOST}:${CONTAINER_PORT} with ${WSGI_WORKERS} workers and SCRIPT_NAME=${SCRIPT_NAME}"
exec /venv/bin/gunicorn --workers ${WSGI_WORKERS} \
--worker-class=${WSGI_WORKER_CLASS} \
--timeout ${WSGI_WORKER_TIMEOUT} \
--name=${CONTAINER_NAME} \
--bind ${CONTAINER_HOST}:${CONTAINER_PORT} \
${@} \
${WSGI_APP}
}

case ${entry_cmd} in
# Run Unit tests
test)
for test_py in $(ls tests/test_*.py)
do
# Skip tests requiring backend server or libs installed
case ${test_py} in
tests/test_elasticsearch__provider.py)
;&
tests/test_sensorthings_provider.py)
;&
tests/test_postgresql_provider.py)
;&
tests/test_mongo_provider.py)
echo "Skipping: ${test_py}"
;;
*)
python3 -m pytest ${test_py}
;;
esac
done
;;

# Run pygeoapi server
run)
# Start
start_gunicorn
;;

# Run pygeoapi server with hot reload
run-with-hot-reload)
# Lock all Python files (for gunicorn hot reload), if running with user root
if [[ $(id -u) -eq 0 ]]
then
echo "Running pygeoapi as root"
find . -type f -name "*.py" | xargs chmod 0444
fi

# Start with hot reload options
start_gunicorn --reload --reload-extra-file ${PYGEOAPI_CONFIG}
;;

*)
error "unknown command arg: must be run (default), run-with-hot-reload, or test"
;;
# Run Unit tests
test)
for test_py in $(ls tests/test_*.py)
do
# Skip tests requiring backend server or libs installed
case ${test_py} in
tests/test_elasticsearch__provider.py)
;&
tests/test_sensorthings_provider.py)
;&
tests/test_postgresql_provider.py)
;&
tests/test_mongo_provider.py)
echo "Skipping: ${test_py}"
;;
*)
/venv/bin/python3 -m pytest ${test_py}
;;
esac
done
;;

# Run pygeoapi server
run)
# Start
start_gunicorn
;;

# Run pygeoapi server with hot reload
run-with-hot-reload)
# Lock all Python files (for gunicorn hot reload), if running with user root
if [[ $(id -u) -eq 0 ]]
then
echo "Running pygeoapi as root"
find . -type f -name "*.py" | xargs chmod 0444
fi

# Start with hot reload options
start_gunicorn --reload --reload-extra-file ${PYGEOAPI_CONFIG}
;;

*)
error "unknown command arg: must be run (default), run-with-hot-reload, or test"
;;
esac

echo "END /entrypoint.sh"
2 changes: 1 addition & 1 deletion docs/source/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Install Python with the option to enable SQLite extensions:

.. code-block:: bash

LDFLAGS="-L/usr/local/opt/sqlite/lib -L/usr/local/opt/zlib/lib" CPPFLAGS="-I/usr/local/opt/sqlite/include -I/usr/local/opt/zlib/include" PYTHON_CONFIGURE_OPTS="--enable-loadable-sqlite-extensions" pyenv install 3.10.12
LDFLAGS="-L/usr/local/opt/sqlite/lib -L/usr/local/opt/zlib/lib" CPPFLAGS="-I/usr/local/opt/sqlite/include -I/usr/local/opt/zlib/include" PYTHON_CONFIGURE_OPTS="--enable-loadable-sqlite-extensions" pyenv install 3.12.3

Configure SQLite from Homebrew over that one shipped with the OS:

Expand Down
6 changes: 3 additions & 3 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ pygeoapi runs on Python 3.
.. note::

The exact Python version requirements are aligned with the version of Python on the pygeoapi supported Ubuntu
operating system version. For example, as of 2024-07, the supported version of Python is bound to Ubuntu 22.04
(Jammy) which supports Python 3.10. Ensure you have a Python version that is compatible with the current Ubuntu
operating system version. For example, as of 2024-07, the supported version of Python is bound to Ubuntu 24.04
(Noble) which supports Python 3.12. Ensure you have a Python version that is compatible with the current Ubuntu
version that is specified in pygeoapi's `Dockerfile`_.

Core dependencies are included as part of a given pygeoapi installation procedure. More specific requirements
Expand All @@ -34,7 +34,7 @@ For developers and the truly impatient
cd pygeoapi
pip3 install --upgrade pip
pip3 install -r requirements.txt
python3 setup.py install
pip3 install .
cp pygeoapi-config.yml example-config.yml
vi example-config.yml # edit as required
export PYGEOAPI_CONFIG=example-config.yml
Expand Down
Loading