Skip to content

actinia-org/actinia-ogc-api-processes-plugin

Repository files navigation

actinia-ogc-api-processes-plugin

This is a plugin for actinia-core which adds OGC API Processes support and runs as standalone app.

Installation & Setup

Use docker-compose for installation:

# -- plugin with actinia (& valkey)
docker compose -f docker/docker-compose.yml build
docker compose -f docker/docker-compose.yml up

# -- only current plugin (Note: need to start actinia + valkey separately)
docker compose -f docker/docker-compose.yml run --rm --service-ports --entrypoint sh actinia-ogc-api-processes
# within docker
gunicorn -b 0.0.0.0:4044 -w 8 --access-logfile=- -k gthread actinia_ogc_api_processes_plugin.main:flask_app

DEV setup

# Uncomment the volume mount of the ogc-api-processes-plugin and additional marked sections of actinia-ogc-api-processes service within docker/docker-compose.yml,
# Note: might also need to set:
# - within config/mount/sample.ini: processing_base_url = http://127.0.0.1:8088/api/v3
# - within src/actinia_ogc_api_processes_plugin/main.py set port: flask_app.run(..., port=4044)
# then:
docker compose -f docker/docker-compose.yml down
docker compose -f docker/docker-compose.yml up --build

# In another terminal: enter container, with stopping debugger:
docker attach $(docker ps | grep docker-actinia-ogc-api-processes | cut -d " " -f1)

# In another terminal: example call of processes-endpoint:
curl -u actinia-gdi:actinia-gdi -X GET http://localhost:4044/processes

Installation hints

  • If you get an error like: ERROR: for docker_kvdb_1 Cannot start service valkey: network xxx not found you can try the following:
docker compose -f docker/docker-compose.yml down
# remove all custom networks not used by a container
docker network prune
docker compose -f docker/docker-compose.yml up -d

Hints

  • If you have no .git folder in the plugin folder, you need to set the SETUPTOOLS_SCM_PRETEND_VERSION before installing the plugin:
export SETUPTOOLS_SCM_PRETEND_VERSION=0.0

Otherwise you will get an error like this LookupError: setuptools-scm was unable to detect version for '/src/actinia-ogc-api-processes-plugin'..

  • If you make changes in code and nothing changes you can try to uninstall the plugin:
pip3 uninstall actinia-ogc-api-processes-plugin.wsgi -y
rm -rf /usr/lib/python3.8/site-packages/actinia_ogc_api_processes_plugin.wsgi-*.egg

Running tests

You can run the tests with following setup:

# First: Uncomment the volume mount of the ogc-api-processes-plugin of actinia-ogc-api-processes service within docker/docker-compose.yml
# Then start containers for testing
docker compose -f "docker/docker-compose.yml" up -d --build

# enter docker
docker exec -it docker-actinia-ogc-api-processes-1 sh

# run all tests
make test

# run only unittests
make unittest

# run only integrationtests
make integrationtest

# run only tests which are marked for development with the decorator '@pytest.mark.dev'
make devtest

# or for debugging
pytest -m devtest --pdb

# Stop containers after finishing testing
docker compose -f "docker/docker-compose.yml" down

Running validator

The OGC teamengine is included in the dev setup with vscode. Open teamengine locally (ogctest:ogctest), view sessions and "Create a new session" with Specification: "OGC API - Processes - 1.0 [ 1.3 ]" and then enter http://actinia-gdi:actinia-gdi@actinia-ogc-api-processes:4044 as "Location of the landing page".

This will successfully test everything which does not include following urls because the authentication is not passed. To overcome this, a proxy can be used:

docker run -d \
  --name ogc-proxy \
  -p 9000:80 \
  --network actinia-docker_actinia-dev \
  nginx:alpine \
  sh -c 'printf "
events {}
http {
  server {
    listen 80;
    location / {
      proxy_pass http://actinia-ogc-api-processes:4044;
      proxy_set_header Authorization \"Basic YWN0aW5pYS1nZGk6YWN0aW5pYS1nZGk=\";
      proxy_set_header Host \$host;
      proxy_set_header X-Real-IP \$remote_addr;
    }
  }
}
" > /etc/nginx/nginx.conf && nginx -g "daemon off;"'

Then use http://ogc-proxy:80 as "Location of the landing page", for which no authentication is required.

Hint for the development of actinia plugins

skip permission check

The parameter skip_permission_check (see example in actinia-statistic plugin) should only be set to True if you are sure that you really don't want to check the permissions.

The skip of the permission check leads to a skipping of:

Not skipped are:

  • the limit of the cells
  • the mapset/project limitations of the user

About

OGC API - Processes standard for actinia

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages