Skip to main content

Mini webserver for accepting CSIP-Aus subscription notifications via dynamic webhook URIs.

Project description

cactus-client-notifications

This is a mini web server for listening for 2030.5 subscription notifications on behalf of cactus-client. It's designed to be hosted at a publicly available IP and will provide a running test instance with unique callback URIs that can be utilised for the duration of a test.

PKI

This app is expected to be run downstream of TLS termination (eg behind an nginx reverse proxy).

Any mutual TLS / other considerations are expected to be managed at the point of TLS termination.

Development

pip install cactus_client_notifications will install all dependencies for running the server

pip install cactus_client_notifications[dev,test] will install ALL dependencies for development / tests

Configuration

All configuration is managed via a series of environment variables. It's likely SERVER_URL and MOUNT_POINT are the only values you'll need to set for deployment.

Environment Variable Default Value Description
APP_PORT 8080 What port the application will be listening on (reverse proxy target port)
SERVER_URL http://localhost:8080 The public URI that all webhooks will be hosted under (This will need to be resolvable by BOTH the cactus CLI tool AND the utility server for submitting notifications)
MOUNT_POINT / If this service is hosted a path prefix (eg /api/v12/) set that value here.
MAX_IDLE_DURATION_SECONDS 3600 Any notification endpoint that hasn't been interacted with for this many seconds will be deleted
MAX_DURATION_SECONDS 262800 (73 hours) Any notification endpoint that is at least this old will be deleted
MAX_ACTIVE_ENDPOINTS 1024 The maximum number of endpoints that can be in existance at one time.
MAX_ENDPOINT_NOTIFICATIONS 100 The maximum number of (uncollected) notifications that an endpoint can hold
CLEANUP_FREQUENCY_SECONDS 120 How frequently the server checks for expired endpoints

Building

To build a Docker containerised version of the app - use the included Dockerfile:

docker build --build-arg CACTUS_CLIENT_NOTIFICATIONS_VERSION=v0.0.6 .

If you want to run the built image (and host it at my.server/api):

docker run -e SERVER_URL=https://my.server:8080 -e MOUNT_POINT=/api -p 8080:8080 cactus-client-notifications

API

Method/Endpoint Description JSON Models
GET /manage Plaintext app status (eg: describing active endpoints and uncollected notifications) Request: None Response: None - plaintext
POST /manage/endpoint Attempts to create a notification endpoint. response will contain the unique notification endpoint ID and fully qualified URL Request: None Response: cactus_client_notifications.schema.CreateEndpointResponse
GET /manage/endpoint/{endpoint_id} Collects all Notifications for the nominated endpoint_id. Once a notification has been collected it will be cleared. Request: None Response: cactus_client_notifications.schema.CollectEndpointResponse
PUT /manage/endpoint/{endpoint_id} Updates the configuration for endpoint_id (eg enabling / disabling it). Request: cactus_client_notifications.schema.ConfigureEndpointRequest Response: None
DELETE /manage/endpoint/{endpoint_id} Requests the deletion of the endpoint with endpoint_id Request: None Response: None
* /webhook/{endpoint_id} The actual notification webhook that the utility server will be sending requests to. Request: Any Response: None

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cactus_client_notifications-0.1.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cactus_client_notifications-0.1.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file cactus_client_notifications-0.1.0.tar.gz.

File metadata

File hashes

Hashes for cactus_client_notifications-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3cede82e997be0fd0e3eeb991c15f2c8e7496971a0c07d3e033366e26c148426
MD5 6f4b309e3d1a20e46e08203729835aa1
BLAKE2b-256 69aa94bda402ede8802e79732c8f100a7e82a0e5840972b82f0730c740123071

See more details on using hashes here.

File details

Details for the file cactus_client_notifications-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cactus_client_notifications-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 591f56b66cf44ca1b9917062a0298b63a464be41ccfa0bd880fa2d057f18e8e5
MD5 a9a6a2c74d3bc827e96bd1838466a6d3
BLAKE2b-256 472130f225af45c2614d34908a82ef3206a8fe6c1640b5fe9053b6d2c56895b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page