about summary refs log tree commit diff
path: root/maintenance
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2023-01-17 13:59:40 -0600
committerStarfall <us@starfall.systems>2023-01-17 14:26:55 -0600
commit7515716e7f3950a3a6de04aac1b88215aa40795e (patch)
tree9a67642bfde79cfef092de8b87a3c80bd2ccad43 /maintenance
parent0d0c26b589a0fedb4cf336683da4c0272a4391d1 (diff)
update almost everything except the setup script
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;