TriliumNext

Kyle Prince - - 5 mins read

While I only use TriliumNext for documenting the process of setting up my homelab services and maintaining a list of books that I would like to read, I can say that for these two things, I truly adore this program. I personally like that I can use Markdown formatting within my notes, since, I am a little familiar with it (this site has been created using markdown formatting with Hugo Static Site Generator). With a clear layout, my notes allow me to easily recreate a project if I need to. Now that you know my use case for TriliumNext, it’s on to the install process.

The Docker Compose File

services:
  trilium:
    image: triliumnext/notes:stable
    restart: unless-stopped
    environment:
      - TRILIUM_DATA_DIR=/home/node/trilium-data
    ports:
      - '8088:8080'
    volumes:
      - ./trilium-data:/home/node/trilium-data

This simple docker compose file will run a TriliumNext server that is available on the host IP on port 8088. To start the container run

docker compose up -d

The Set Up

To access TriliumNext just navigate to http://<hostip>:8088 and you will see the set up page. From here to you can either sync with another Trilium application or server, or you can select that you are a new user. Once TriliumNext has finished its setup, you will be greeted with a set password screen. After you have entered your password twice, the install is done. But wait, you may ask yourself, why didn’t I have to create a user? That’s the only real downside to TriliumNext. It is a single user application and is not suitable for large scale deployment. If you have several users, you have 2 options. You can have separate and very public note “trees” for each user within TriliumNext or you can run a seperate instance of TriliumNext for each user. Assuming that you only have a handful of users and since TriliumNext is a relatively lightweight application, (only uses ~100MB ram) I would spin up a new container for each user. If you do go this route, you will have to remember to change the port in the docker compose file. The one to the left of the colon.

ports:
  - '<8089>:8080'

If you are using a reverse proxy, it might be helpful to set your domain to your user. For example user1.notes.yourdomain.xyz or user2.yourdomain.xyz. That’s just what I would do, but you do what works for you.

Using TriliumNext for Homelab Notes

Once you have TriliumNext running, you are ready to document your homelab progress. Sometimes, it is really hard to remember how you set up a server or service. If you are anything like me, you might think to yourself “If I break this, I can just set this up again. I did it once, I can do it again.” While this is mostly true, you might be surprised to learn that 3 years later you may not remember the proper syntax of your SMB file share config. What was the package name for that Samba server? Did I have to create new users on the server? Some of these questions may be a quick internet search away. Some may require a little more digging than others. But if you’ve kept good notes, you only have to go to one place. The next time you are setting up that fileserver, or webserver, or mediaserver, you can (and should), record every command entered in the terminal, every setting changed in the config files, and make the setup easily repeatable.

This is why TriliumNext markdown formatting is brilliant for recording your setup process. I will use the general body of notes to describe what a particular action is for and then show the action in a code block for easy copy and paste repeatability. Every section/paragraph in TriliumNext is it’s own block that can be formatted and moved. In order to start a code block just simply type ``` on a new line and TriliumNext will reformat the input to a code block. If you cant remember this, then you can simply click on the menu to left of the current block and select code block within the pop up menu. Although you can change this after your code has been typed out, your spacing will likely cause a formatting issue if you didn’t type it out in a code block from the get go. For this reason, it is useful to remember those 3 little backticks. To escape the code block and get back to a plain text input, just hit your enter key three times. If you are interested in learning some markdown tricks this is a great place to start. But you don’t need to know any markdown at all. As far as I can tell, all formatting options are available right through the application menu’s.

Final Thoughts

If you are not taking notes while setting up your homelab services, then you are doing yourself a disservice. Being able to quickly duplicate your current setup is a superpower in the event of catastrophe. While notes are not a data backup, they can effectively be used as a config backup. This is especially useful if diving outside the world of docker and containers. TriliumNext is a great solution that is easy to set up, easy to use and is accessible from any device that has a browser. If you haven’t tried TriliumNext, you really are missing out.