mirror of
1
Fork 0

[docs] Update backup docs (#2153)

This commit is contained in:
Daenney 2023-08-23 20:06:46 +02:00 committed by GitHub
parent 083e8f35b3
commit 5416ad9888
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -108,7 +108,7 @@ Disadvantages:
Regardless of whether you're using PostgreSQL or SQLite as your GoToSocial database, it's possible to simply back up the database files directly by using something like [rclone](https://rclone.org/), or following best practices for [backing up Postgres data](https://www.postgresql.org/docs/15/backup.html) or [SQLite data](https://sqlite.org/backup.html). Regardless of whether you're using PostgreSQL or SQLite as your GoToSocial database, it's possible to simply back up the database files directly by using something like [rclone](https://rclone.org/), or following best practices for [backing up Postgres data](https://www.postgresql.org/docs/15/backup.html) or [SQLite data](https://sqlite.org/backup.html).
Use the [GoToSocial CLI](cli.md#gotosocial-admin-media-list-local) to get a list of media files you need to safeguard. Use the GoToSocial CLI's media [`list-attachments`](cli.md#gotosocial-admin-media-list-attachments) and [`list-emojis`](cli.md#gotosocial-admin-media-list-emojis) commands to get a list of media files you need to safeguard.
Advantages: Advantages:
@ -178,7 +178,7 @@ hooks:
For PostgreSQL, you'll want to use `postgresql_databases` instead. For PostgreSQL, you'll want to use `postgresql_databases` instead.
The file mentioned in `patterns_from` can be created by transforming the output from the [GoToSocial CLI](cli.md#gotosocial-admin-media-list-local). In order to generate the right patterns you can use the [`media-to-borg-patterns.py`](https://github.com/superseriousbusiness/gotosocial/tree/main/example/borgmatic/media-to-borg-patterns.py) script. How Borg patterns work is explained in [their documentation](https://man.archlinux.org/man/borg-patterns.1). The file mentioned in `patterns_from` can be created by transforming the output from the GoToSocial CLI media [`list-attachments`](cli.md#gotosocial-admin-media-list-attachments) and [`list-emojis`](cli.md#gotosocial-admin-media-list-emojis) commands. In order to generate the right patterns you can use the [`media-to-borg-patterns.py`](https://github.com/superseriousbusiness/gotosocial/tree/main/example/borgmatic/media-to-borg-patterns.py) script. How Borg patterns work is explained in [their documentation](https://man.archlinux.org/man/borg-patterns.1).
You'll need to put that file on your GoToSocial instance and make sure the file is executable. It requires Python 3 which you will already have if you have Borg and Borgmatic installed. It only depends on the Python standard library. You'll need to put that file on your GoToSocial instance and make sure the file is executable. It requires Python 3 which you will already have if you have Borg and Borgmatic installed. It only depends on the Python standard library.
@ -186,7 +186,7 @@ You'll need to put that file on your GoToSocial instance and make sure the file
For this to work reliably, you should ensure that the [storage-local-base-path](../configuration/storage.md) in your GoToSocial configuration uses an absolute path. Otherwise you'll have to tweak the paths yourself. For this to work reliably, you should ensure that the [storage-local-base-path](../configuration/storage.md) in your GoToSocial configuration uses an absolute path. Otherwise you'll have to tweak the paths yourself.
```sh ```sh
$ gotosocial admin media list-local | \ $ gotosocial admin media list-attachments --local-only | \
/path/to/media-to-borg-patterns.py \ /path/to/media-to-borg-patterns.py \
<storage-local-base-path> <storage-local-base-path>
``` ```
@ -210,7 +210,7 @@ If you're running Borgmatic as a systemd service, you can [create a drop-in](htt
```ini ```ini
[Service] [Service]
ExecStartPre=/path/to/gotosocial admin media list-local | /path/to/media-to-borg-patterns.py <storage-local-base-path> /etc/borgmatic/gotosocial_patterns ExecStartPre=/path/to/gotosocial admin media list-attachments --local-only | /path/to/media-to-borg-patterns.py <storage-local-base-path> /etc/borgmatic/gotosocial_patterns
``` ```
Documentation that's good to review: Documentation that's good to review:

View File

@ -7,12 +7,16 @@ import sys
def main(): def main():
cli = argparse.ArgumentParser( cli = argparse.ArgumentParser(
prog="media-to-borg-patterns", prog="media-to-borg-patterns",
description="""Generate Borg patterns to backup media files belonging to description="""Generate Borg patterns to backup media and emoji files belonging to
this instance. You can pass the output to Borg or Borgmatic as a patterns file. this instance. You can pass the output to Borg or Borgmatic as a patterns file.
For example: gotosocial admin media list-local | media-to-borg-patterns
For example: gotosocial admin media list-attachments --local-only | media-to-borg-patterns
<storage-local-base-path>. You can pass a second argument, the destination file, to <storage-local-base-path>. You can pass a second argument, the destination file, to
write the patterns in. If it's ommitted the patterns will be emitted on stdout write the patterns in. If it's ommitted the patterns will be emitted on stdout
instead and you can redirect the output to a file yourself. instead and you can redirect the output to a file yourself.
For emojis, use gotosocial admin media list-emojis --local-only | media-to-borg-patterns
instead.
""", """,
epilog="Be gay, do backups. Trans rights!" epilog="Be gay, do backups. Trans rights!"
) )