]> git.dujemihanovic.xyz Git - dujemihanovic.xyz.git/blob - content/posts/updating-dendrite/index.md
Add summaries to all posts
[dujemihanovic.xyz.git] / content / posts / updating-dendrite / index.md
1 ---
2 title: "Updating/installing Dendrite"
3 date: 2023-08-24T16:41:53+02:00
4 summary: How to update/install Dendrite when you don't have a recent enough Golang on your server.
5 ---
6 I decided to share the method I just devised for updating (and perhaps
7 installing) Dendrite on my VPS.
8
9 ## Motivation
10 I discovered that yesterday (as of writing), Dendrite was updated to
11 [0.13.2](https://github.com/matrix-org/dendrite/releases/tag/v0.13.2), and I was
12 running 0.13.1. Because old thing bad and new thing good, I decided to update
13 right away!
14
15 The method I tried using for this was essentially the same as I used for the
16 initial install:
17
18 1. Stop dendrite service
19 1. Download new tarball
20 1. Unpack new tarball into existing dendrite directory
21 1. Run `go build -o ./bin ./cmd/...`
22
23 This is where the issues start: it errored out on some nats something and I
24 assumed it just didn't like being unpacked into an existing dendrite directory,
25 so I made a new one. It failed again and then I read the actual error that
26 occurred, and as it turned out the version of Go packaged in Debian is too old
27 to compile the nats thing. Isn't that a classic?
28
29 I looked around to see if maybe Go has its own Debian repository, but I was out
30 of luck. It seemed that the 2 options were either install Go from source or just
31 stick with Dendrite 0.13.1, but in the end I decided on a 3rd solution:
32
33 ## Compiling it locally
34 My personal machine runs Artix, so there should be no problem with outdated Go
35 (or anything really) whatsoever. I figured that I could compile Dendrite on my
36 personal machine and then `rsync` the binaries onto my VPS, just like I did with
37 my Piped-Material frontend. Here are the steps:
38
39 1. Clone [Dendrite git repository](https://github.com/matrix-org/dendrite)
40 1. Checkout `v0.13.2` *(replace with latest version)*
41 1. Run `go build -o ./bin ./cmd/...` and wait for it to compile
42 1. On VPS, move `/opt/dendrite` to `/opt/dendrite-old` and create new
43 `/opt/dendrite`
44 1. *(optional)* Strip the binaries so they take up less space: `strip
45 --strip-unneeded bin/*`
46 1. `rsync` the `bin` directory: `rsync -aAXvhzP bin root@vps:/opt/dendrite/`\
47 *Most likely all these options aren't needed, it is what I use for VPS
48 backups so I decided to not touch it just to be safe.*
49 1. Back on the VPS, copy over `matrix_key.pem`, `media_store`, *(if it exists)*
50 `searchindex` and `dendrite.yaml` from `dendrite-old` into `dendrite`.\
51 I have noticed that Dendrite also creates a `jetstream` directory, I'm not
52 sure what it is for but my homeserver seems to work fine without copying it
53 over.
54 1. Update configuration file. To do this, I went back to the Git repository on
55 my local machine and ran `git log -p dendrite-sample.yaml`. This time the
56 only change was that MSC2946 (Space Summaries) was de-MSCified, so I removed
57 that from the config file.
58 1. Make sure the user and group `dendrite` own every file in `/opt/dendrite`.
59 Run: `chown -R dendrite:dendrite /opt/dendrite`
60
61 After doing this, I started Dendrite again using `systemctl` and to my surprise
62 the homeserver was up and running first try. I also took this time to enable
63 server-side search and DNS caching, which is something I overlooked during the
64 initial setup of my homeserver. I have also verified that space previews still
65 work despite MSC2946 being removed from the configuration file.
66
67 This way I was also able to save a bit of disk space, which is important since
68 space is often rather limited on VPSes.