commit 36ebbcb250ad626f5abdd4e6bd3511522171ed82 Author: Matt Johnson Date: Fri May 15 19:16:24 2026 +0000 scaffold: initial repository structure diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a61310f --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +.venv/ +__pycache__/ +*.pyc +.env +etc/ +var/ +*.creds +*.key +*.pem +db.env +.envrc +.idea/ +.vscode/ +*.swp +.DS_Store diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1996bcb --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Matt Johnson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..36bcb4c --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# Central + +Central is the data hub spine for the infrastructure. Adapters normalize upstream sources into a canonical event shape, publish CloudEvents to NATS/JetStream, and archive to TimescaleDB for historical query. Single-LXC deployment. + +## Status + +Phase 0 — scaffold. Not yet operational. + +## Architecture + +- Python 3.12 (uv-managed) +- NATS + JetStream for live event bus +- TimescaleDB + PostGIS for archive and geospatial query +- One supervisor process managing adapter lifecycle +- One archive consumer process persisting events to TimescaleDB +- Both processes systemd-managed + +## License + +MIT. See LICENSE. diff --git a/docs/.gitkeep b/docs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/etc-templates/central.toml b/etc-templates/central.toml new file mode 100644 index 0000000..fa892b3 --- /dev/null +++ b/etc-templates/central.toml @@ -0,0 +1,31 @@ +# Central Configuration Template +# ============================== +# This is a TEMPLATE. Copy to /etc/central/central.toml on the deployment host. +# Replace all CHANGE_ME values with real configuration. +# NEVER commit the real /etc/central/central.toml to version control. + +# === NWS adapter === +# Fetches weather alerts and observations from the National Weather Service API. +# contact_email is required by NWS User-Agent policy. +[adapters.nws] +enabled = true +cadence_s = 60 +states = ["ID", "OR", "WA", "MT", "WY", "UT", "NV"] +contact_email = "CHANGE_ME@example.invalid" + +# === CloudEvents wire format === +# All events published to NATS follow the CloudEvents 1.0 specification. +[cloudevents] +type_prefix = "central" +source = "central/adapters/nws" +schema_version = "1.0.0" + +# === NATS === +# Connection URL for the NATS server with JetStream enabled. +[nats] +url = "nats://localhost:4222" + +# === Postgres / TimescaleDB === +# DSN for the archive database. Must have TimescaleDB and PostGIS extensions. +[postgres] +dsn = "postgresql://central:CHANGE_ME@localhost/central" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f656bd5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,15 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "central" +version = "0.1.0" +requires-python = ">=3.12,<3.13" +description = "Data hub spine — adapters, bus, archive." +readme = "README.md" +license = {text = "MIT"} +authors = [{name = "Matt Johnson"}] + +[tool.hatch.build.targets.wheel] +packages = ["src/central"] diff --git a/scripts/.gitkeep b/scripts/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/sql/.gitkeep b/sql/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/central/__init__.py b/src/central/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/central/adapters/__init__.py b/src/central/adapters/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/systemd/.gitkeep b/systemd/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29