Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper backups - fix several issues #111

Open
tio-trom opened this issue Sep 11, 2023 · 0 comments
Open

Proper backups - fix several issues #111

tio-trom opened this issue Sep 11, 2023 · 0 comments

Comments

@tio-trom
Copy link
Collaborator

The Problems:

Big database equals issues.

If the Friendica instance is very active/big then one cannot backup the database since by the time the database is created it will be modified. So it will fail like here https://paste.yunohost.org/raw/icukubaxiz

2023-09-11 00:23:05,769: WARNING - mysqldump: Error 1412: Table definition has changed, please retry transaction when dumping table `post-delivery` at row: 0`.

Currently we tried to put the instance into Maintenance before backing up the databse, see https://github.com/YunoHost-Apps/friendica_ynh/blob/master/scripts/backup (cd $install_dir && ynh_exec_as "$app" php$phpversion bin/console maintenance 1) - but for one it does not work, it won't trigger the maintenance. And second, it is not a good practice to put an instance into maintenance every day, for possibly hours.

We need to backup files too!

Friendica allows admins to store the media files in a folder rather than the database, and this is crucial for big instances. The setting is changed from here:

2023-09-11_14-58

And it is written in the database as

MariaDB [friendica]> select * from config where cat like '%storage%';
+------+---------+-----------------+-------------------------------+
| id   | cat     | k               | v                             |
+------+---------+-----------------+-------------------------------+
| 6778 | storage | filesystem_path | s:21:"/path/to/storage";      |
| 6796 | storage | name            | s:10:"Filesystem";            |
+------+---------+-----------------+-------------------------------+

Solution:

We need to backup the database properly plus the files.

First, we should use mariadb backups that are incremental so no need to put Friendica in maintenance.

$ mariabackup --backup \
   --target-dir=/var/mariadb/backup/ \
   --user=mariabackup --password=mypassword

More info here https://mariadb.com/kb/en/full-backup-and-restore-with-mariabackup/

Second, we need to define somewhere the file storage path to then include in the backup script.

Any help with this please? I will do my best to test stuff and help, but my knowledge is limited. We desperately need a proper backup solution for friendica!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant