• Home
  • Blog
  • Contact
  • Projects
  • Content Mirror
  • Matrix Guide

  • July Status Update

    July 26, 2022

    It's been a while since I've written a post, so I figured it was about time. A lot has been happening around here, that's for sure. I think the most notable is that my transition to Matrix has gone well. Element is growing on my girlfriend, and my whole family is at least tolerating it for now. I've even told a few of my friends about Matrix, and they seemed interested—or maybe that was just them being nice.

    Either way, I've gone all in on Matrix. This isn't the first time I've been a part of the Matrix community, but the last time I was, Matrix wasn't nearly as stable, and I looked at my use of Matrix as more of an experiment than anything else. But now, I'm ready to be using Matrix for real, and so I have been. My Matrix homeserver has been listed on Join Matrix, so I've spent a lot of time tuning rate limits on my server, writing a privacy policy and some terms and conditions, and setting up reCAPTCHA. My Matrix server is running on an OpenBSD VM hosted by Proxmox on my network. My Proxmox has its own physical LAN that keeps things isolated from the rest of the network.

    At the moment, I'm running my homeserver on Proxmox instead of with OpenBSD's hypervisor, because the reference implementation of Matrix, Synapse, is rather resource-heavy. It requires a lot of CPU, memory, and disk I/O, which my main server doesn't really have. Additionally, it requires a full-featured database for good performance, which has its own system requirements. Because of this, I thought it best to put all of the Matrix servers into a single, high-powered VM. It doesn't scale very well, but I'm not really planning on turning my Matrix homeserver into a business, so it doesn't have to scale to enterprise levels. It just needs to be able to handle my messages, and the messages of a few people I know.

    I'm also not planning on running Synapse forever. It is way too bloated and heavy in my opinion. I want a Matrix homeserver that's written in C and doesn't use a database. To me, C programs that just write to a data directory are the most efficient and portable programs there are. There are a few homeserver implementations in Rust and Go, but they still require hefty databases, and if I were to build them from source, I'd have to install a compiler toolchain. If there was a homeserver written in C, I could develop and deploy it entirely on a base install of OpenBSD. If I could do that, I wouldn't need to run a VM, I could run it right on my gateway server, like I run email.

    Alas, no such homeserver exists today, but I'm going to change that. I'm working on a project called Telodendria 1, which will fulfill my desires for a Matrix homeserver perfectly. Telodendria will be written entirely in ANSI C, and depend only on a POSIX C library. It will have no third-party libraries pulled in, and it will use only things that are available in the OpenBSD base. This way, I can develop and run it entirely on a base OpenBSD install, without having to install anything. Now, I've glanced at the Matrix spec a few times, and I've found that it is massive—almost prohibitively massive, so I'm not imagining that I'll just whip out a Matrix homeserver. It's going to take time—years, probably. But that's okay. I'll just keep going along, building up as much as I can, and maybe even recruiting people to help me. I've already got my girlfriend helping me with the website and the logo.

    I'm pretty excited about Telodendria, because it's one of the very few programming projects that I think will actually be useful to me. It's also incorporating all my programming knowledge as well. A few of my old projects were really more of exercises than anything useful to me. I've always wanted to write something that would be useful, but I never was able to do that because I didn't know what would be useful to me. So I just kinda wrote random things that seemed helpful, but then they'd just sit and rot on my server, never getting touched again. But Telodendria is different. It's something that, when its completed, I'll actually want to use.

    One of the neat things about Telodendria is that I'm able to pull a lot of code out of my old projects into it. If you remember from spring break of this year, I wrote a little configuration parser library. I never touched that library since then, but I know it's well-written, because I spent way too much time debugging it. So I thought it would be perfect to pull in to Telodendria. I refactored it a little bit to be in the style of Telodendria's code, but other than that, I basically just merged it right in, and re-branded it to be more generic—"Config" instead of "conifer2." I was originally just going to write a JSON library—since I'll need one to implement the Matrix spec anyway—and use that for the configuration file as well, but JSON configuration files are really no fun to work with by hand. But I think Conifer2's syntax was rather elegant, while also remaining strict, plus it was code that was entirely my own, so that made it perfect to pull in.

    Back when I was still learning C, a few years ago, I had an "HTML compiler" that I had written. I actually used it to generate my website for a while, but it was very buggy, because I didn't actually implement a proper HTML parser, I had some weird staged parser thing that pretty much depended on getting correct input, and wouldn't fail on incorrect input. So overall, a pretty garbage project. But I did have a base64 encoder in there, which I pulled in to Telodendria as well, because I'll have to do a bit of base64 to implement the Matrix spec as well. It was a little buggy, but I fixed it up and even added support for "unpadded base64," which the Matrix spec requires.

    So that's what I've been spending most of my time on. Right now, I'm just building up the foundations. I'm building all the tools my Matrix homeserver will need, so that I can just focus on building the Matrix-specific part when the time comes. I'm implementing basic data structures, such as hash maps and arrays, as well as the configuration parser, a JSON parser, and a base64 encoder/decoder. I'm also planning on implementing my own basic HTTP server and client for federation.

    The only thing I'm not thrilled about implementing is a TLS library. I might pull in OpenBSD's TLS library for that, but I'm going to make sure I use it very conservatively—the server itself won't use TLS, instead I'll depend on it being behind relayd(8). I'll only use TLS for the federation with other servers, and that is easily a few years away, so I'm not worried about it right now. Maybe by the time I get there, I'll have the skills and will to implement my own, but for now, the plan is to eventually pull in LibreSSL.

    If you want to checkout where things are at with Telodendria so far, please pay the official project website a visit! This is the very first project I'm working on that I actually went out and bought a domain for, so I'm very serious about it:


    I like to build my own things from scratch, because I'm always preparing for the collapse of the internet. Or even just being independent of the internet. There's a lot of nasty stuff going on, such as surveillance and censorship. These are perhaps the most dangerous to our society, which is why I take them very seriously. I mirror all content that I want for the future, and I make sure I have a full software suite available to me totally offline. Everything I want to do with a computer, I make sure I'm able to do without having to download packages from the internet. I'm always thinking about the things I absolutely need, and how I can pack them on my hard drives in a way that I can recover from digital disaster. I have a proper backup plan in place, which involves four complete copies of my data—two live copies that run in a RAID 1, and two separate offline copies that are synced once a week.

    One of the things that's so nice about OpenBSD is that I can comfortably fit all of the source code and all of the binary packages on my server quite easily. So anything that can run on OpenBSD, I have downloaded for offline use. If I'm ever without internet for prolonged periods of time, I can still re-install OpenBSD if I wanted, and I could re-install all my packages. OpenBSD has enough software built into the base that it could also easily be used to rig up a rudimentary internet. In this way, OpenBSD actually is a perfect operating system for dealing with the collapse of the internet. It is very much unlike Windows in the fact that it is just an operating system. It has what you need to run your computer, and nothing more. It doesn't go out and try to reach the internet if you don't want it to. It's easy to learn and easy to maintain. It has all the tools needed to rebuild the kernel and all the packages if necessary. OpenBSD also still fits on a CD!

    You see, it's not only important to have a local copy of all the data you want to save, but it's also crucial to have a copy of all the code you need to run it. A PDF document is no good if you don't have a PDF reader to display it, and an office suite to generate new PDFs. I think people miss this when they think about storing their data. They tend to store just the data they made, not the programs they used to make it, even though those are just as important.

    I've been thinking more about my website lately. As you know well, my website is very bland. Personally, I like the minimalism. I find it elegant. But I admit that it is very ugly. I've never been one to try and make things pretty, but I've put a substantial amount of time into Telodendria's website's style sheet, and I am very pleased with the outcome. So I'm thinking about potentially modernizing my website just a little bit. It'll still be just a collection of flat HTML files that work without JavaScript, and can be maintained on a base OpenBSD install, I'll just make sure all the meta tags are set properly to make the pages real HTML5 documents, and apply Telodendria's style sheet. I'm also thinking about taking all the pages on my website and combining them into a single page, to make things easier to maintain. I don't have a ton of information on all the pages, so it wouldn't make a massive page. I made Telodendria's website a single page, with all the documentation on it, and even though it's big, it has a nice table of contents that I feel makes it pleasant enough to use.

    My blog is definitely going to remain a plain-text blog. For a while, I was contemplating installing HTMLy, a flat-file blogging platform written in PHP that uses Markdown for posts, but I ultimately decided against it because it feels like a step in the wrong direction for me. I want to head toward being able to run a single OpenBSD server on low system resources, and PHP is not something that helps me down that path. That's why I'm writing my own Matrix homeserver, so I can run it directly on my main OpenBSD server, because right now, Synapse is definitely a step in the wrong direction. It is a lot of complex software, and I'm not a fan of that.

    At work I've come into close contact with Windows PowerShell. As a shell, it is absolutely horrible. All the commands are way too verbose to get things done quickly. But as a scripting language, it is actually not half bad. Of course I'd never go installing PowerShell on Linux, or switching to Windows 2, or anything like that, but I am enjoying learning it. PowerShell is object-based, instead of stream-based, which makes it more on par with Python or Perl than a POSIX shell. This makes it easy to do all kinds of complex tasks like make REST API requests and parse responses. PowerShell also has a massive standard library that ships with it, which means you can do just about anything you'd need a script to do without having to invoke any outside binaries. It is a fairly complete system. I still prefer the Unix shell to the Windows shell, of course, but I have to say that I am actually impressed with PowerShell. It is pleasant to write, which I guess is good, because that's what I have to do for my job.

    In my Bible study, I'm studying 2nd Corinthians now, and that's been pretty straightforward. I've also been studying human consciousness, which has been fascinating. I picked up a copy of Wilder Penfield's Mystery of the Mind, which I'm hoping to start reading soon. Over the last few months I've been convinced that science and Christianity are not at odds at all, despite our surrounding culture telling us otherwise. In one of my earlier status update posts, you'll recall that I was doing a lot of research on scientific evidence, because there was a lot of questionable content being taught in my science classes this summer. Ever since then, I've been hard at work trying to reconcile my faith with modern science, and with Penfield's book, I'll be bringing my research to a close for a while, as school will be starting up again soon. But I'm happy to report that, by the grace and wisdom of God, my research has not caused me to stray from the faith.

    I understand now the mysteries of the universe a bit better, and I see now that the scientific evidence does not actually point to a godless universe at all; in fact I see God everywhere I look. Now, I know that I do not have all the answers. I cannot give a certain answer to the question of how old the earth is, or how we got here. But I have full confidence that the Bible is true because it is blatantly obvious to me that the God of the Bible is real and alive. Whether the account of Genesis is to be taken literally or not, I think is irrelevant to being a Christian, because regardless of how you take it, it speaks truth. Whether it is historically accurate or allegorical, it is most certainly not a scientific textbook, but it speaks the truth that we were meticulously crafted by the hand of God, and placed in an environment perfectly suitable for our flourishing. These are both things that science has made very obvious to me, and for that I am grateful, not that I needed science to back up my belief in the Bible. I'm just glad that it happens to, quite well in fact.

    So that's what's going on this month. As I predicted when I started this blog, my posts are slowing down. But I still thoroughly enjoy writing, so I'm going to try to stay on top of it. These days, I've just been writing more code than anything else.

    1. I chose the name Telodendria for a few reasons. The first is that it was not taken by any open source project that I could find. In fact I couldn't find anything tech related about it. The second is that it fits perfectly with the reference implementation names. Synapse and Dendrite are both parts of the neuron, so I thought it fitting to pick another part of the neuron as my homeserver name. The third reason I picked Telodendria is that the .io domain was available, and it sounded reasonably cool. 

    2. I am actually writing this post on Windows though... sort of. What I mean is that I'm using my work computer, which runs Windows, to SSH into my OpenBSD server, where I can use vi(1) to write. 

    © 2019-2023 Jordan Bancino.