From 5a435682d958b1ae74607d34c720b7f7292460e8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Duje=20Mihanovi=C4=87?= Date: Thu, 24 Aug 2023 22:46:59 +0200 Subject: [PATCH] New post: Updating/installing Dendrite --- content/posts/updating-dendrite/index.md | 67 ++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 content/posts/updating-dendrite/index.md diff --git a/content/posts/updating-dendrite/index.md b/content/posts/updating-dendrite/index.md new file mode 100644 index 0000000..6e21f56 --- /dev/null +++ b/content/posts/updating-dendrite/index.md @@ -0,0 +1,67 @@ +--- +title: "Updating/installing Dendrite" +date: 2023-08-24T16:41:53+02:00 +--- +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](https://github.com/matrix-org/dendrite/releases/tag/v0.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 +1. Download new tarball +1. Unpack new tarball into existing dendrite directory +1. 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](https://github.com/matrix-org/dendrite) +1. Checkout `v0.13.2` *(replace with latest version)* +1. Run `go build -o ./bin ./cmd/...` and wait for it to compile +1. On VPS, move `/opt/dendrite` to `/opt/dendrite-old` and create new + `/opt/dendrite` +1. *(optional)* Strip the binaries so they take up less space: `strip + --strip-unneeded bin/*` +1. `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.* +1. 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. +1. 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. +1. 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. -- 2.39.5