Handle clean read-only (re-)syncs of Seafile libraries to mirror them
Go to file
mxmehl e68ef71536
Python Linters / formatting (push) Successful in 46s Details
Python Linters / pylint (push) Successful in 54s Details
REUSE Compliance / reuse (push) Successful in 11s Details
Python Linters / mypy (push) Successful in 47s Details
Selftests / test-build-install (push) Successful in 45s Details
Selftests / test-sync (push) Successful in 57s Details
Merge pull request 'chore(deps): update dependency pylint to v3.1.0' (#16) from renovate/pylint-3.x-lockfile into main
Reviewed-on: #16
2024-03-01 13:42:41 +01:00
.gitea chore(deps): update fsfe/reuse-action action to v3 2024-02-27 23:02:11 +00:00
LICENSES make REUSE compliant 2023-05-26 11:09:19 +02:00
examples make REUSE compliant 2023-05-26 11:09:19 +02:00
seafile_mirror add version command 2024-01-16 16:47:19 +01:00
tests add CI tests and publishing workflows 2024-01-16 16:47:19 +01:00
.gitignore add CI tests and publishing workflows 2024-01-16 16:47:19 +01:00
README.md add pypi badges 2023-09-22 11:33:47 +02:00
poetry.lock chore(deps): update dependency pylint to v3.1.0 2024-02-25 23:03:15 +00:00
poetry.lock.license fix REUSE compliance 2023-09-22 09:52:21 +02:00
pyproject.toml chore(deps): update dependency black to v24 2024-01-26 23:02:51 +00:00
renovate.json5 enable renovate for repository 2024-01-15 16:57:37 +01:00
renovate.json5.license fix REUSE compliance 2024-01-15 17:22:26 +01:00

README.md

Seafile Mirror

REUSE status The latest version of reuse can be found on PyPI. Information on what versions of Python the tool supports can be found on PyPI.

A Python tool to handle clean read-only (re-)syncs of Seafile libraries with the intention to mirror them.

Overview

If you have Seafile libraries, you may want to back them up in a safe place automatically.

One option is to snapshot/backup the whole server on which the library is stored. However, in some situations, this may not be feasible or even not possible.

This is why this repository offers a different way: you can define one or multiple Seafile libraries that shall be downloaded to a local directory. These libraries can belong to the same or a different user, and even on different Seafile servers!

Features

  • Download/sync defined libraries in customisable intervals
  • De-sync libaries immediately after they have been downloaded to avoid sync errors
  • Allow to force-re-sync a library even if its re-sync interval hasn't reached yet
  • Extensive informative and error logging
  • Created with automation in mind so you can run it in cronjobs or systemd triggers
  • Deal with the numerous caveats of seaf-cli and Seafile in general

Install

The tool depends on the following applications:

You can install the latest release via pip3 install seafile-mirror.

The tool is executable by seafile-mirror. The --help flag informs you about the required and available commands.

There is also an Ansible role that takes care of installing the tool via pipx, setting up a systemd service, and running it daily.

To keep the Seafile daemon that is required for seafile-cli running in the background, check out this exemplary systemd service.

Configuration

Configuration is done in a YAML file called seafile_mirror.conf.yaml. You can find an example here.

If that configuration file resides in the same location your current working directory, you should provide --configdir ./.

Logging and caching

The tool creates seafile_mirror.log in addition to the log to the standard output in the configuration directory. With -v you can print DEBUG messages that will help you in case of problems.

It also caches the current status of synced libraries and their latest full download in the file .seafile_mirror.db.json. Do not delete this file unless you don't mind that the tool will re-sync all libraries in the next run.

Contribute and Development

Contributions are welcome! The development is easiest with poetry: poetry install and poetry run seafile-mirror will get you started.

License

Apache-2.0, Copyright Max Mehl