As mentioned in my previous post, I am not really accustomed to posting on social networks. However, the other day I encountered a term I haven't heard in a long time: micro-blogging. Yes, quite a few social networks, Twitter for instance, is before anything a micro-blogging service. This definition of Twitter makes it immensely more appealing to me: it's a bite-sized blog for random thoughts, funny incidents, and many other pieces of my life that might not fit well with a regular blog post. However, I still find posting on Twitter has the 'broadcasting to the entire Internet' feeling stamped into it. Guess I'll just host my own then.

Mastodon turned out to be one such solution. Mastodon's federated and decentralized nature makes it ideal for someone like me who struggles between building my online identity while minimizing the number of different companies I expose my information to. If people are willing to give away their personal information for fancy profile pictures, then hosting a Mastodon wouldn't seem like such a bad deal.

Installation on Arch Linux

It was kinda surprising that there doesn't exist a Arch Linux specific installation guide for Mastodon. Not that the installation process would be more difficult on Arch Linux than Ubuntu, but installation can be made a lot due simpler to the abundance of packages. Since the official production guide is already fairly comprehensive, I'll just document some Arch Linux specific steps here.

Dependencies

Here's a table detailing all the dependencies and their corresponding packages in Arch Linux. There really is no need to git clone anything. npm was also required in the installation process, but was not listed in the official guide.

DependencyPackage
node.js 6.xnodejs-lts-boron
yarnyarn
imagemagickimagemagick
ffmpegffmpeg
libprotobuf and protobuf-compilerprotobuf
nginxnginx
redisredis
postgresqlpostgresql
nodejsnodejs
rbenvrbenv
ruby-buildruby-build
npmnpm

For rbenv, I needed to add 'eval "$(rbenv init -)" to .bashrc or .zshrc after installation as prompted by the post installation script.

Mastodon

Create user mastodon and to sudoers using visudo.

useradd -m -G wheel -s /bin/bash mastodon

Then I can clone the repository and start installing node.js and ruby dependencies. This is where npm is required. Besides, I encountered a ENONT error when running yarn saying ./.config/yarn/global/.yarnclean is missing, which is resolved by creating the file.

PostgreSQL

In addition to installing the postgresql package, I followed Arch Wiki to initialize the data cluster:

$ sudo su postgres
[postgres]$ initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data'

After starting and enabling postgresql with systemctl, I can then start the psql shell as the postgres user and create user for Mastodon (use psql command \du to check the user is actually there):

$ sudo su postgres
[postgres]$ psql
[psql]# CREATE USER mastodon CREATEDB;
[psql]# \q

Port selection is customizable in postgresql.service and the port number will be used in .env.porduction customization.

Redis

Pretty much the same drill as postgresql, I installed redis and start/enabled redis.service. The port selection and address that have access can all be configured from /etc/redis.conf.

Nginx & Let's Encrypt

The official production guide covers this part pretty well already.

.env.production

The config file is fairly self-explanatory. The only thing I got wrong the first time is the variable DB_HOST for postgresql. I then obtained the correct path, /run/postgresql, by checking status of postgresql.service.

Scheduling Services & Cleanups

Again, just follow the official production guide. I installed cronie to schedule cron jobs.

My Experience

The web interface is fairly good, I like how I can write toots while browsing timelines instead of been forced to stay at the top of the page. I tried out quite a few Mastodon clients on my phone and I settled on Pawoo, which is built by Pixiv. So far Mastodon feels like a more comfy twitter to me and a platform where I am actually willing to write on. I'm pushing myself to write something on Mastodon every few days. So far it's been mostly running logs, but I'll come up more stuff to post in the future.

One thing I would really like to see though is multilingual post support in Mastodon. A workaround I currently use is appending different tags for Chinese vs. English posts, which not only bloats my toots, but also fragmented my timeline so that it's only 50% comprehensible for most people. Regrettably, it seems that out of the various micro-blogging/social networking services, only Facebook has something similar to this at the moment.

In the footer section, I've replaced Twitter with my Mastodon profile. Feel free to take a peek inside. :P