Install Mastodon in Docker Swarm

Mastodon is an open-source, federated (i.e., decentralized) social network, inspired by Twitter's "microblogging" format, and used by upwards of 4.4M early-adopters, to share links, pictures, video and text.


This is a companion discussion topic for the original entry at https://geek-cookbook.funkypenguin.co.nz/recipes/kubernetes/mastodon/

Huh. As a quick first note, I should probably mention that clicking the comment button under “Install Mastodon in Kubernetes” brought me here to “Install Mastodon in Docker Swarm”, just in case that should be a separate topic and something’s glitched somewhere.

Anyway, on to the substance:

I currently have a Mastodon instance running on a Raspberry Pi, having not had capacity on my k3s cluster at the time for one. Having now fixed that, I’d like to move it over to the cluster, and I’m wondering if anyone’s seen articles or got experience with doing that?

(Naively, it seems like it should just be a matter of cloning the config and moving the Postgresql database over, the media being on S3, but these things never seem to be as simple as they seem. It seems.)

Hey @cerebrate!

Honestly, I think it would be that simple. My kubernetes-based instance has the following PVCs:

~ ❯ k get pvc -n mastodon                                                                                                                           16:17:07
NAME                                   STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS       AGE
data-mastodon-elasticsearch-master-0   Bound    pvc-3088dbf9-3379-45fc-8cee-57305faa8b00   1Gi        RWO            do-block-storage   180d
data-mastodon-postgresql-0             Bound    pvc-344579d1-9f7c-4599-95ba-765fe45e8952   10Gi       RWO            do-block-storage   296d
redis-data-mastodon-redis-master-0     Bound    pvc-5263bd81-d106-4c02-8215-c073fe1f4028   1Gi        RWO            do-block-storage   296d
~ ❯

So there’s nothing other than the database and the object storage to think about really, in terms of migration. I do remember reading that the redis data is important, and you’ll either need to migrate it, or wait for it to be rebuilt by a scheduled task (I forget which one…)

Let me know how it goes!

David
(David Young :funkypenguin: (@[email protected]) - FNKY)

So, while this did work eventually for me (and to be fair, the migration part was pretty simple), it took a whole lot of hacking around to make it so. Turns out neither the Mastodon container image nor its Helm chart are IPv6-friendly…

(Long write up over at Moving Mastodon - by Alistair Young - Random Bytes (substack.com).)