Skip to content

Commit

Permalink
Updates for ES8 and Python 3.8.10
Browse files Browse the repository at this point in the history
- Pin pygeoapi to 0.16.1.
- Update debian/control
- Update flake8.yml for Python 3.8, updated actions/checkout and actions/setup-python version. Run flake8 on current diurectory and all subdirectories
- Update README and deploy-nightly.sh
- Use custom ES provider instead of pygeoapi ES provider, subclassed from pygeoapi ElasticsearchProvider
- Update config.yml to use WOUDC_API_ES_INDEX_PREFIX env
- Improved deploy-nightly.sh script
- Permission changes to deploy
  • Loading branch information
Kevin Ngai committed Jul 25, 2024
1 parent 4b0f2f7 commit e54fdca
Show file tree
Hide file tree
Showing 19 changed files with 744 additions and 137 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.8]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
name: Set up Python ${{ matrix.python-version }}
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -20,6 +20,6 @@ jobs:
python3 -m pip install --upgrade pip
pip3 install flake8
- name: run flake8 ⚙️
run: |
flake8
run: |
flake8 .
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ are automatically installed during installation.

```bash
# setup virtualenv
python3 -m venv --system-site-packages woudc-api
cd woudc-api
python3 -m venv --system-site-packages woudc-api_env
cd woudc-api_env
source bin/activate

# setup local OGC schemas (i.e. WOUDC_API_OGC_SCHEMAS_LOCATION in default.env)
Expand All @@ -38,21 +38,32 @@ curl -O http://schemas.opengis.net/SCHEMAS_OPENGIS_NET.zip && unzip ./SCHEMAS_OP
# clone pygeoapi codebase and install
git clone https://github.com/geopython/pygeoapi.git
cd pygeoapi
python setup.py install
git checkout 0.16.1
pip3 install -r requirements.txt
python3 setup.py install
cd ..

# clone woudc-extcsv and install
git clone https://github.com/woudc/woudc-extcsv.git
cd woudc-extcsv
python3 setup.py install
cd ..

# clone woudc-api codebase and install
git clone https://github.com/woudc/woudc-api.git
cd woudc-api
python setup.py install
python3 setup.py install

# set system environment variables
cp default.env local.env
vi local.env # edit accordingly
. local.env

# generate openapi document
pygeoapi openapi generate -c $PYGEOAPI_CONFIG > $PYGEOAPI_OPENAPI
pygeoapi openapi generate ${PYGEOAPI_CONFIG} -f json --output-file ${PYGEOAPI_OPENAPI}

# optional: validate openapi document
pygeoapi openapi validate ${PYGEOAPI_OPENAPI}

# run the server
woudc-api serve # server runs on http://localhost:5000
Expand Down
6 changes: 3 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Priority: optional
Maintainer: Tom Kralidis <[email protected]>
Build-Depends: debhelper (>= 9), python3, python3-setuptools, curl, unzip
Standards-Version: 3.9.5
X-Python-Version: >= 3.6
X-Python-Version: >= 3.8
Vcs-Git: https://github.com/woudc/woudc-api.git

Package: woudc-api
Architecture: all
Depends: elasticsearch (>=7), elasticsearch (<8), libapache2-mod-wsgi-py3, python3, python3-flask, python3-pygeoapi, woudc-extcsv
Suggests: python3-elasticsearch (>=7), python3-elasticsearch (<8)
Depends: elasticsearch (>=8), elasticsearch (<9), libapache2-mod-wsgi-py3, python3, python3-flask, python3-pygeoapi, woudc-extcsv
Suggests: python3-elasticsearch (>=8), python3-elasticsearch (<9)
Homepage: https://woudc.org
Description: WMO WOUDC REST API
2 changes: 1 addition & 1 deletion debian/postinst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

set -e
set -e

USERNAME="woudcuser"
GROUP="www-data"
Expand Down
5 changes: 4 additions & 1 deletion default.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
export WOUDC_API_BIND_HOST=0.0.0.0
export WOUDC_API_BIND_PORT=5000
export WOUDC_API_URL=http://localhost:5000/oapi
export WOUDC_API_ES_URL=http://localhost:9200
export WOUDC_API_ES_USERNAME=elasticsearch
export WOUDC_API_ES_PASSWORD=<secret>
export WOUDC_API_ES_URL=http://${WOUDC_API_ES_USERNAME}:${WOUDC_API_ES_PASSWORD}@localhost:9200
export WOUDC_API_ES_INDEX_PREFIX=woudc_data_registry
export WOUDC_API_OGC_SCHEMAS_LOCATION=/opt/woudc-api/schemas.opengis.net
export PYGEOAPI_CONFIG=/path/to/woudc-api-config.yml
export PYGEOAPI_OPENAPI=/path/to/woudc-api-openapi.yml
Loading

0 comments on commit e54fdca

Please sign in to comment.