Metadata-Version: 2.1
Name: syncservers
Version: 1.0.0
Summary: instantly sync data among home servers
Author-email: Zhuo Wang <zhuowang10@gmail.com>
Project-URL: Homepage, https://github.com/zhuowang10/syncservers
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: <4,>=3.7
Description-Content-Type: text/markdown
License-File: LICENSE.MD
Requires-Dist: asyncinotify>=4.0.9
Requires-Dist: asynclcron>=1.0.0

# Sync Servers
This is a lightweight server sync app designed for home servers. It instantly syncs changed files from one server to other servers, or perodically cron syncs.

A use case is to sync files to multiple servers without setting up cloud costly. This project is a component of my homeservers project, which leverage this to sync up my cam uploaded files to other servers.

Inotify is leveraged to monitor files changes, asynclcron is to run cron tasks, and rsync is to sync files.

A recursive_watch class, based on asyncinotify example and improved, is included to recursively monitor a folder tree.

## setup dev env
```bash
# in vscode terminal:
python3 -m venv venv
```

```bash
## reopen vscode terminal, venv should show
pip install asyncinotify
pip install asynclcron
```

## unit test
```bash
## run test
python3 -m unittest

## only run a package/file
python3 -m unittest tests.syncservers.test_recursive_watcher
```

## rsyncd
```
sudo cp tests/rsyncd/rsyncd.conf /etc/
sudo rsync --daemon --no-detach
```

## test rsync command
```bash
rsync -avh --no-p --mkpath --timeout=6 --contimeout=3 /storage/source/live rsync://127.0.0.1/live
```

## packaging and publish
```
rm -rf dist
python3 -m build
python3 -m twine upload dist/*
```

## run syncservers
```bash
# in root folder
python -m syncservers.app
```
