YunoHost-Apps / mastodon_ynh

Free, open-source social network for YunoHost
https://joinmastodon.org/
GNU Affero General Public License v3.0
84 stars 36 forks source link

Disable backuping media_attachments #217

Closed fflorent closed 4 years ago

fflorent commented 4 years ago

AFAIK, backuping mastodon can take very long and thus is not suitable for daily backups. That's mostly due to /var/www/mastodon/live/public/system/media_attachments which can be a very large folder.

I guess people can afford losing attachments as long as they can restore a daily backup.

Wouldn't it be interesting to allow disabling backuping the attachments thought the BACKUP_CORE_ONLY env variable just like nextcloud_ynh does?

If you think the idea is interesting, I'd be glad to take a look and propose a PR.

yalh76 commented 4 years ago

I don't know if the idea is interesting, I don't run a mastodon instance.

And most importantly, I don't know the skills level of most mastodon_ynh admins. Did they plan to have a full backup when they do a backup or will they understand that the backup don't include attachments

In addition, backup is used during upgrade, to be able to restore if the upgrade fails

Tagadda commented 4 years ago

Deleting or not restoring files in system folder can cause inconsistencies in the database. In order to reduce the backup size, we could ran several tootctl commands to clean cached media.

yalh76 commented 4 years ago

I've just figure out that the cron in charge of removing old media doesn't work since the beginning like november 2018.... https://github.com/YunoHost-Apps/mastodon_ynh/commit/9d07d121ad516bf0d3db1c5eb700cb6575630802

conf/cron L2: two _ between FINALand PATH cd __FINAL__PATH__/live && __FINAL__PATH__/.rbenv/shims/bundle exec rake __USER__:media:remove_remote

scripts/install L264: one _ between FINALand PATH ynh_replace_string "__FINAL_PATH__" "$final_path" ../conf/cron

fflorent commented 4 years ago

I ran RAILS_ENV=production bin/tootctl media remove manually and it reduced media size by 98% :heart:

Thanks for your great work !