diff --git a/README.md b/README.md index f50442a..4b7fb7c 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Mastodon is a free, open-source social network. A decentralized alternative to c ## Configuration -#### Adding "swapfile" If you have less than 2Go of RAM +### Adding "swapfile" If you have less than 2Go of RAM ``` sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024000 sudo chmod 600 /swapfile @@ -37,6 +37,24 @@ add this line on /etc/fstab /swapfile none swap sw 0 0 ``` +### Adding cron to free space + +Here's a quick tip to free a lot of space on your instance. +Indeed the media (images and videos, attachments) of other instances are cached on your server and are never deleted. +This consumes a lot of space and Mastodon being instantaneous, there is little chance that old media will serve. Thus, we can set up a daily cron that will remove cache external media, more than X days old. + +We edit the crontab : +``` +crontab -e -u mastodon +``` +We add: +``` +@daily cd /var/www/mastodon/live && RAILS_ENV=production NUM_DAYS=30 /var/www/mastodon/.rbenv/shims/bundle exec rails +mastodon:media:remove_remote +``` + +[Source](https://angristan.fr/installer-instance-mastodon-debian-8/#mise_en_place_du_cron) + ### Install #### Using __screen__ in case of disconnect ``` diff --git a/README_fr.md b/README_fr.md index 6ee9aba..e8581e3 100644 --- a/README_fr.md +++ b/README_fr.md @@ -23,7 +23,7 @@ Mastodon est un réseau social gratuit et open source. Une alternative décentra ## Configuration -#### Ajout d'un "swapfile" si vous avez moins de 2Go de RAM +### Ajout d'un "swapfile" si vous avez moins de 2Go de RAM ``` sudo dd if=/dev/zero of=/swapfile bs=1024 count=1024000 sudo chmod 600 /swapfile @@ -35,6 +35,24 @@ ajouter cette ligne dans /etc/fstab /swapfile none swap sw 0 0 ``` +### Ajout d'un cron pour libérer de l'espace + +Voici une petite astuce pour libérer énormément d’espace sur votre instance. +En effet les médias (images et vidéos, le pièces jointes)des autres instances sont mis en cache sur votre serveur et ne sont jamais effacés. +Cela consomme beaucoup d’espace et Mastodon étant tourné vers l’instantanéité, il y a peu de chance que de vieux médias servent. Ainsi, on peut mettre en place un cron journalier qui va supprimer les medias externes en cache, vieux de plus de X jours. + +On édite le crontab : +``` +crontab -e -u mastodon +``` +Et on y ajoute : +``` +@daily cd /var/www/mastodon/live && RAILS_ENV=production NUM_DAYS=30 /var/www/mastodon/.rbenv/shims/bundle exec rails +mastodon:media:remove_remote +``` + +[Source](https://angristan.fr/installer-instance-mastodon-debian-8/#mise_en_place_du_cron) + ### Installation #### Utilisation de __screen__ en cas de déconnection