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