From 36d356c97a8190c9433a1b644a6b8d7f1772f63a Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Wed, 31 Aug 2022 19:31:17 +0200 Subject: [PATCH] Update user guide --- docs/developer_guide.md | 4 ++-- docs/user_guide.md | 46 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/docs/developer_guide.md b/docs/developer_guide.md index 4930240..87de8db 100644 --- a/docs/developer_guide.md +++ b/docs/developer_guide.md @@ -10,7 +10,7 @@ Microblog.pub is a "modern" Python application with "old-school" server-rendered - [Poetry](https://python-poetry.org/) is used for dependency management. - Most of the code is asynchronous, using [asyncio](https://docs.python.org/3/library/asyncio.html). - - SQLite3 is the default database. + - SQLite3 for data storage The server has 3 components: @@ -30,7 +30,7 @@ inv -l ### Media storage -The uploads are stored in the `data/` directory, using a simple content-addressed storage (file contents hash is BLOB filename). +The uploads are stored in the `data/` directory, using a simple content-addressed storage system (file contents hash is BLOB filename). Files metadata are stored in the database. ## Installation diff --git a/docs/user_guide.md b/docs/user_guide.md index 944717c..a0b3028 100644 --- a/docs/user_guide.md +++ b/docs/user_guide.md @@ -234,3 +234,49 @@ All the data generated by the server is located in the `data/` directory: - Uploaded media Restoring is as easy as adding your backed up `data/` directory into a fresh deployment. + +## Tasks + +### Pruning old data + +You should prune old data from time to time to free disk space. + +The default retention for the inbox data is 15 days. + +It's configurable via the `inbox_retention_days` config item in `profile.toml`: + +```toml +inbox_retention_days = 30 +``` + +Data owned by the server will never be deleted (at least for now), along with: + + - bookmarked objects + - liked objects + - shared objects + - inbox objects mentioning the local actor + - objects related to local conversations (i.e. direct messages, replies) + +For now, it's recommended to make a backup before running the task in case it deletes unwanted data. + +You should shutdown the server before running the task. + +#### Python edition + +```bash +# shutdown supervisord +cp -r data/microblogpub.db data/microblogpub.db.bak +poetry run inv prune-old-data +# relaunch supervisord and ensure it works as expected +rm data/microblogpub.db.bak +``` + +#### Docker edition + +```bash +docker compose stop +cp -r data/microblogpub.db data/microblogpub.db.bak +make prune-old-data +docker compose up -d +rm data/microblogpub.db.bak +```