about summary refs log tree commit diff
path: root/maintenance
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance')
-rw-r--r--maintenance29
1 files changed, 29 insertions, 0 deletions
diff --git a/maintenance b/maintenance
new file mode 100644
index 0000000..f214eff
--- /dev/null
+++ b/maintenance
@@ -0,0 +1,29 @@
+########
+# clean up docker images
+/usr/bin/docker system prune -f 2>&1 >/dev/null
+
+# clear out old remote statuses that have never been touched (favorited, followed, etc)
+# the "Content cache retention period" setting is significantly more aggressive since it removes *all* old remote posts
+sudo docker-compose exec mastodon-web tootctl statuses remove --days 90
+
+########
+# these are useful maintenance tasks but already covered by other settings
+# just turn autovacuum on
+sudo docker-compose exec -u 70 db psql -c 'VACUUM ANALYZE;'
+
+# covered by the new "Media cache retention period" setting
+sudo docker-compose exec mastodon-web tootctl media remove --days 30
+sudo docker-compose exec mastodon-web tootctl preview_cards remove --days 30
+
+#########
+# run these only with careful consideration, they're slow and may require taking the instance down for maintenance
+# clear out nonextant remote accounts (this will nuke monsterpit and pv... :c )
+sudo docker-compose exec mastodon-web tootctl accounts cull
+
+# remove loose media files, quite slow but should save una a little bit of costs
+sudo docker-compose exec mastodon-web tootctl media remove-orphans
+
+# postgres vacuum full, requires instance down
+# first line requies pgstattuple module
+SELECT * FROM pgstattuple('table'); -- see if free_percent is high
+VACUUM FULL table;