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

Performance of the upgrade script moving medias #175

Closed HugoPoi closed 4 years ago

HugoPoi commented 5 years ago

Is the rsync -a necessary in place of a mv because it's currently very slow to do a full copy of all medias and delete the source 3 lines after ?

https://github.com/YunoHost-Apps/mastodon_ynh/blob/b9086682d2d7762d2882fff2cda4f5dceb73e32b/scripts/upgrade#L172-L178

For example I upgrade my instance, I'm alone on it. It took action [2585.1] executed in 2490.312s

yalh76 commented 5 years ago

idk, it was like that when I started to work on that package. Maybe not the best way to manage the upgrade...

yalh76 commented 4 years ago

Well I reread the core.

  1. We first move the whole previous mastodon files
  2. we download last version
  3. from the previous mastodon version we retrieve all the public/system files
  4. we also retrieve the .env.production
  5. at the end we remove previous version

If you think that there is better way to manage that, feel free to do a PR ;)

HugoPoi commented 4 years ago

Due to this behavior, the upgrade is broken. Now the script using the /tmp directory. So the script assume you have enough space to copy the entire medias attachments to /tmp. Me > working on it.

My instance with one user

admin@home:/var/www/mastodon/live$ du -sh public/system/
24G public/system/
yalh76 commented 4 years ago

lol too much media...

HugoPoi commented 4 years ago

I will launch a sudo -u mastodon RAILS_ENV=production bin/tootctl media remove but I'm pretty sure I have done this sometimes ago

du -sh public/system/
10G     public/system/
# Still 10GB my uploaded content + last 7 days of my subsciptions