/ogc-resource-server

OGC compliant IUDX based resource server serving Geospatial data

Primary LanguagePythonApache License 2.0Apache-2.0

Jenkins Build Jenkins Tests Jenkins Coverage Integration Tests Security Tests

OGC Resource Server

Features

  • Supports OGC Features and STAC APIs
  • Allows authorized data access based on access policies
  • Enables metered data access
  • Updated with latest software and client libraries
  • Enhanced Software Testing

Prerequisites

Flyway Database setup

Flyway is used to manage the database schema and handle migrations. The migration files are located at src/main/resources/db/migrations. The following pre-requisites are needed before running flyway:

  1. An admin user - a database user who has create schema/table privileges for the database. It can be the super user.
  2. A normal user - this is the database user that will be configured to make queries from the server (e.g. CREATE USER ogc WITH PASSWORD 'randompassword';)

flyway.conf must be updated with the required data.

  • flyway.url - the database connection URL
  • flyway.user - the username of the admin user
  • flyway.password - the password of the admin user
  • flyway.schemas - the name of the schema under which the tables are created
  • flyway.placeholders.ogcUser - the username of the server user

Please refer here for more information about Flyway config parameters.

After this, the info command can be run to test the config. Then, the migrate command can be run to set up the database. At the /ogc-resource-server directory, run

mvn flyway:info -Dflyway.configFiles=flyway.conf
mvn flyway:migrate -Dflyway.configFiles=flyway.conf

The database details should then be added to the server config.

AWS S3 setup

AWS S3 is used to serve map tiles as well as STAC asset files. An S3 bucket can be set up by following the S3 documentation, after which the S3 bucket name, region name, access key and secret key can be added to the config.

Maven based execution

  1. Install Java 11 and maven
  2. Set Environment variables
export LOG_LEVEL=INFO
  1. Use the maven exec plugin based starter to start the server mvn clean compile exec:java@ogc-resource-server
  2. The server will be up on port 8080. To change the port, add httpPort:<desired_port_number> to the config in the ApiServerVerticle module. See configs/config-example.json for an example.

JAR based execution

  1. Install Java 11 and maven
  2. Set Environment variables
export LOG_LEVEL=INFO
  1. Use maven to package the application as a JAR mvn clean package -Dmaven.test.skip=true
  2. 2 JAR files would be generated in the target/ directory
    • ogc-resource-server-dev-0.0.1-SNAPSHOT-fat.jar - non-clustered vert.x and does not contain micrometer metrics

Client SDK

A client SDK generated using OpenAPI Generator is located at client-sdk. To generate a version of the SDK derived from the latest version of the OpenAPI spec at https://geoserver.dx.ugix.org.in, download the OpenAPI Generator JAR file and run:

java -jar openapi-generator-cli.jar generate -i <URL> -g python --additional-properties removeOperationIdPrefix=true,removeOperationIdPrefixDelimiter=-,removeOperationIdPrefixCount=6 -o client-sdk --global-property models,modelTests=false,apis,apiTests=false,supportingFiles=README.md:requirements.txt:setup.py:setup.cfg:openapi_client:api_client.py:api_response.py:exceptions.py:__init__.py:configuration.py:py.types:rest.py

where <URL> can be:

  • https://geoserver.dx.ugix.org.in/api for OGC APIs
  • https://geoserver.dx.ugix.org.in/stac/api for STAC APIs
  • https://geoserver.dx.ugix.org.in/metering/api for metering/auditing APIs

License

View License