Sign inSign up

chancellor1101/wxalerts-emwin-uploader

By chancellor1101

•Updated about 1 year ago

Publish EMWIN GOES data to wxalerts.org

Image
Integration & delivery
0

2.1K

chancellor1101/wxalerts-emwin-uploader repository overview

⁠WXAlerts Shipper

A Dockerized, event-driven Python script for ingesting NWS alerts from a local directory and uploading them to the WXAlerts API.


⁠🚀 Key Features

  • Real-time Ingestion: Uses watchdog⁠ to monitor a directory for new files instantly (no polling).
  • Concurrency: Multi-threaded worker pool processes and uploads multiple files simultaneously.
  • Resilient: Built-in retry logic with exponential backoff for failed API uploads.
  • Debounced: Waits until files are fully written before processing, preventing corruption.
  • Configurable: Easily adjusted via environment variables.
  • Portable: Packaged as a Docker container for deployment and upgrades anywhere.
  • File Management: Deletes or archives processed files to prevent clutter.

⁠⚙️ How to Use

⁠1. Requirements

⁠2. Project Setup

Clone the repository or create the following files in a single directory:

  • Dockerfile
  • ingest.py
  • requirements.txt
  • LICENSE.txt (optional, but recommended)

⁠3. Build the Docker Image

From the project directory, run:

docker build -t wxalerts-shipper .

⁠4. Run the Container

The container requires a volume mount to access the directory where NWS alerts are saved (e.g., SatDump’s output).

Recommended command:

docker run -d --restart=unless-stopped   -v /path/to/your/EMWIN/data:/srv/goes/output/EMWIN   -e AUTH_HEADER="X-API-Key: your_secret_api_key"   -e DELETE_SENT="true"   --name wxalerts-ingestor   wxalerts-shipper
⁠Command Breakdown
  • -v /path/to/your/EMWIN/data:/srv/goes/output/EMWIN
    Maps your local EMWIN data directory into the container.
    ⚠️ Replace /path/to/your/EMWIN/data with the absolute path to your SatDump output directory.

  • -e AUTH_HEADER="X-API-Key: your_secret_api_key"
    Pass your API key for authentication.
    (Custom headers may be required depending on API requirements.)

  • -e DELETE_SENT="true"
    Deletes files after they are successfully uploaded.
    Set to false to move them to a ./sent subdirectory instead.

  • --restart=unless-stopped
    Ensures the container automatically restarts if it crashes or after reboot.

  • -d
    Runs the container in the background.


⁠🛠️ Configuration (Environment Variables)

VariableDefault ValueDescription
API_URLhttps://api.wxalerts.org/v1/ingestThe API endpoint for ingesting alerts.
WATCH_ROOT/srv/goes/output/EMWINDirectory to watch inside the container (should match your volume mount).
WATCH_GLOB*.txtGlob pattern to match files for processing.
QUIET_MS2000Wait time (ms) to ensure a file is fully written before processing.
CONCURRENCY4Number of concurrent threads for file processing.
DELETE_SENTfalseIf true, deletes files after upload. Otherwise moves them to ARCHIVE_DIR.
AUTH_HEADER""Optional auth header (e.g., Authorization: Bearer my_token).
RETRY_MAX5Maximum number of retries for failed API requests.
RETRY_BASE_MS750Base time (ms) for exponential backoff during retries.

⁠📜 License

This project is licensed under the Apache 2.0 License⁠.

Tag summary

Content type

Image

Digest

sha256:e45721a30…

Size

65.6 MB

Last updated

about 1 year ago

docker pull chancellor1101/wxalerts-emwin-uploader