Skip to content

Commit

Permalink
Heavily refactor and add more features to map syncer
Browse files Browse the repository at this point in the history
- Add unit tests
- Add support for MQTT trigger
- Support gracefull shutdown triggered by sinals
- Introduce linting tools: isort, ruff, black
- Add support for monitoring with healthheck.io compatible
  endpoint
- Add basic README.md
- Make code compatible with Python 3.8 to support Ubuntu 20.04
  • Loading branch information
p2004a committed Jul 9, 2023
1 parent 3524d05 commit 29faac2
Show file tree
Hide file tree
Showing 9 changed files with 888 additions and 145 deletions.
3 changes: 3 additions & 0 deletions tools/map_syncer/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if [ -f .pyenv/bin/activate ]; then
source .pyenv/bin/activate
fi
4 changes: 4 additions & 0 deletions tools/map_syncer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.pyenv/
__pycache__/
.mypy_cache/
.pytest_cache/
46 changes: 46 additions & 0 deletions tools/map_syncer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Map Syncer
==========

A daemon for keeping a directory with maps in sync with the maps-metadata repo.

It supports:

- Delayed deletion of maps that are no longer listed as live
- Periodic time based sync
- Sync on demand triggered by MQTT message
- Monitoring via reporting to https://healthchecks.io/ compatible endpoint

Production
----------

Copy `map_syncer.py` to target and run `./map_syncer.py --help` to see
available options.

The only runtime dependency on top of Python >= 3.8 is `paho-mqtt`. On Debian
based systems it's `python3-paho-mqtt` package.

Development
-----------

### Setup

```sh
python3 -m venv .pyenv
source .pyenv/bin/activate
pip install -r requirements.txt
```

### Lint

```sh
black .
isort .
ruff .
mypy
```

### Test

```sh
pytest
```
Loading

0 comments on commit 29faac2

Please sign in to comment.