Mastodon Daily Maintenance

Remember to run these commands daily for those installing Mastodon instances to keep your server running smoothly.

Runing in a non-docker installation

$ tootctl search deploy
$ tootctl media remove --days=30
$ tootctl preview_cards remove --days=30

Running in a docker-compose installation

docker-compose -f /opt/mastodon-docker/docker-compose.yml run --rm shell tootctl search deploy

docker-compose -f /opt/mastodon-docker/docker-compose.yml run --rm shell tootctl media remove --days=30

docker-compose -f /opt/mastodon-docker/docker-compose.yml run --rm shell tootctl preview_cards remove --days=30

In our example, the mastodon docker config resides on the directory /opt/mastodon-docker.

Understanding each task

The first command (search deploy) will read the data inside your elastic search, create indexes for toots, tags, and links, and populate the explore page.

The last two commands will remove content from external instances cached in your disk. They will remove images, audio, video, avatars, user image headers (media remove) and preview cards thumbnails (preview_cards remove).

Creating cronjobs

# Daily 2 AM

00 2 * * * /opt/mastodon-scripts/clear_attachments.sh

# Daily 2:30 AM

30 2 * * * /opt/mastodon-scripts/clear_preview_cards.sh

# Daily 3:00 AM

00 3 * * * /opt/mastodon-scripts/generate_search_index.sh

In our example, the scripts reside in the directory /opt/mastodon-scripts.

Refs


Did you like our content?

We have a lot to share; visit our site!

Our fediverse services ;)

Chat and video? We have it!

Translation tools

Video Platform Frontends

Text Editors

You can also visit our hacking space!

Follow our founder!

Follow the status of our tools

Do you want to support us? You can!

See you!

[s]