Friendica on my own server
Bought a cheap VPS for 9 dollars a year. I spent the last few days figuring out its configuration — I'm a developer after all, not a devops or sysadmin, so I have to spend a lot of time on manuals and fixing basic errors that I made myself :)
But I moved my Friendica server whitelion.me from Moscow to Atlanta. Even fewer ties to the RF, and honestly I felt uneasy keeping a copy of my social-media posts there...
Although I had to fiddle with Friendica updates too, now I've got the process sorted out.
Deploy from GitHub
Now I can easily and quickly modify whatever I need in the code on GitHub and push it straight to the server.
Maybe later I'll propose some of my fixes to the main repository. I don't have experience contributing to open-source projects yet.
Updating the instance
Updated my Friendica instance — as always, not without problems. At first the update got stuck, because it was failing trying to update the contact with ID 0, and updating contacts with a zero ID is forbidden in the code. I removed the check for 0 in the code. In the past the system contact was created with ID 0, but maybe some update's migration removed it — only that migration probably failed on my instance. Then images stopped loading, because the plugin that works with AWS storage started requiring that a region be set. And I had the default region set — after the update that became an empty string. Fun with open source — it levels up your skills. That's exactly why I chose to host an instance of a decentralized social network in a programming language I know.
Bots and autoposting
After the Friendica update it also turned out that automatic posting to the instance had stopped working. The logs only had error code 403 — I had to change the logging code so that there'd be text besides the code. It turned out the bots were banned, because after updating the plugin that blocks bots, it started blocking HTTP libraries that send requests. And I honestly do use a library like that and don't fake the user-agent. In the plugin settings I disabled library blocking — that helped. This would have been faster if the logs had shown the error text from the start.
Moving storage to Cloudflare R2
Moved Friendica storage from Amazon S3 to Cloudflare R2 — and that didn't go smoothly either. The Akeeba library that works with S3-compatible storage uses version 2 signatures for everything except Amazon, and Cloudflare only supports version 4. I had to fix 2 to 4 in the code for the non-Amazon case — it worked. Strange that the library authors write in the comments that their version 4 signature implementation is compatible only with Amazon, even though I just verified in practice that it works with Cloudflare. Create an Issue in the library's GitHub?
The Cloudflare R2 storage got created in Eastern Europe, while the Friendica instance lives on a VPS in the eastern US — I need to try once more to move Friendica to shared hosting in Germany.
Categories and language detection
Dug into why, after last year's Friendica update, the category stopped being added to posts, when before the category parameter was enough. I didn't find the cause, but I found in the code that for a category to be added it has to be specified in angle brackets in the file parameter. Not obvious, and I never paid attention to that in the documentation.
Along the way I came across the code that detects the post's language. Turns out, if the post is short, the profile description gets appended to it and then the post's language is detected. That's why all my short posts have English as their language in the properties — my bio in Friendica is written in English. An original method of detecting the language of short posts)