Development¶
The exporter is one file, duplicacy_exporter.py, with prometheus_client as its only runtime dependency.
Tests live in tests/ and run with pytest.
Run from source¶
git clone https://github.com/GeiserX/duplicacy-exporter.git && cd duplicacy-exporter
python3 -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt -r requirements-test.txt
MODE=webhook STATE_FILE=/tmp/duplicacy-exporter-state.json python duplicacy_exporter.py
STATE_FILE defaults to /data/..., which does not exist outside the container; point it somewhere writable
or set PERSIST_ENABLED=false.
Tests¶
tests/test_exporter.py covers the log parser (every regex, the section headers, DUPLICACY_META), the
webhook handler and the storage poller's output parsing; tests/test_persistence.py covers the state file.
Add a test beside the code you change; a new log line shape gets a regex test with the exact line.
Docs¶
pip install -r docs/requirements-docs.txt
mkdocs serve # http://127.0.0.1:8000
mkdocs build --strict # what CI runs; a broken link fails it
Pages are Markdown under docs/, the nav is in mkdocs.yml, and every pull request runs the strict build.
Screenshots are PNGs under docs/images/screenshots/, taken from a demo run with fake machine names.
Release¶
- Set the new version in
duplicacy_exporter.py(VERSION),pyproject.toml(version), and the image tag inREADME.mdanddocs/getting-started.md. The rootdocker-compose.ymlbuilds from source; its# image: drumsergio/duplicacy-exporter:X.Y.Zline is a comment, so update it or leave it. - Commit, tag
vX.Y.Z, push the tag. pypi-publish.ymlbuilds and uploads the package;docker-publish.ymlbuilds amd64 and arm64 images and pushesdrumsergio/duplicacy-exporter:X.Y.Z;dockerhub-description.ymlsyncs the README to Docker Hub.- Write the GitHub release notes on the tag.
The dashboard is dashboard.json at the repo root. Edit it in Grafana, export with "Export for sharing
externally" so the datasource stays ${DS_PROMETHEUS}, and update the listing on Grafana.com.