Updating/installing Dendrite

526 words, estimated reading time: 3 minute(s)
Originally published on August 24, 2023
Last modified on September 16, 2023

I decided to share the method I just devised for updating (and perhaps installing) Dendrite on my VPS.

Motivation

I discovered that yesterday (as of writing), Dendrite was updated to 0.13.2, and I was running 0.13.1. Because old thing bad and new thing good, I decided to update right away!

The method I tried using for this was essentially the same as I used for the initial install:

  1. Stop dendrite service
  2. Download new tarball
  3. Unpack new tarball into existing dendrite directory
  4. Run go build -o ./bin ./cmd/...

This is where the issues start: it errored out on some nats something and I assumed it just didn’t like being unpacked into an existing dendrite directory, so I made a new one. It failed again and then I read the actual error that occurred, and as it turned out the version of Go packaged in Debian is too old to compile the nats thing. Isn’t that a classic?

I looked around to see if maybe Go has its own Debian repository, but I was out of luck. It seemed that the 2 options were either install Go from source or just stick with Dendrite 0.13.1, but in the end I decided on a 3rd solution:

Compiling it locally

My personal machine runs Artix, so there should be no problem with outdated Go (or anything really) whatsoever. I figured that I could compile Dendrite on my personal machine and then rsync the binaries onto my VPS, just like I did with my Piped-Material frontend. Here are the steps:

  1. Clone Dendrite git repository
  2. Checkout v0.13.2 (replace with latest version)
  3. Run go build -o ./bin ./cmd/... and wait for it to compile
  4. On VPS, move /opt/dendrite to /opt/dendrite-old and create new /opt/dendrite
  5. (optional) Strip the binaries so they take up less space: strip --strip-unneeded bin/*
  6. rsync the bin directory: rsync -aAXvhzP bin root@vps:/opt/dendrite/
    Most likely all these options aren’t needed, it is what I use for VPS backups so I decided to not touch it just to be safe.
  7. Back on the VPS, copy over matrix_key.pem, media_store, (if it exists) searchindex and dendrite.yaml from dendrite-old into dendrite.
    I have noticed that Dendrite also creates a jetstream directory, I’m not sure what it is for but my homeserver seems to work fine without copying it over.
  8. Update configuration file. To do this, I went back to the Git repository on my local machine and ran git log -p dendrite-sample.yaml. This time the only change was that MSC2946 (Space Summaries) was de-MSCified, so I removed that from the config file.
  9. Make sure the user and group dendrite own every file in /opt/dendrite. Run: chown -R dendrite:dendrite /opt/dendrite

After doing this, I started Dendrite again using systemctl and to my surprise the homeserver was up and running first try. I also took this time to enable server-side search and DNS caching, which is something I overlooked during the initial setup of my homeserver. I have also verified that space previews still work despite MSC2946 being removed from the configuration file.

This way I was also able to save a bit of disk space, which is important since space is often rather limited on VPSes.