Self-Hosting My Notes
In the last few months, I’ve installed more and more services on my Raspberry Pi 5.
It has “only” 8GB of RAM, but I’m very happy with it.
From top, I see that it always has half of its memory available, so for now, I’m not afraid of overloading it.
About a week ago, I installed a VaultWarden instance to replace KeePass, and I’m quite happy with it.
Yesterday, though, a new challenge arose (exclusively in my head): to find a good alternative to one of the best iOS apps — Bear.
For years, I’ve been using Obsidian to take notes, and I have a few vaults on my laptop: for work, folklore notes, and some other abandoned tests. Anyway, I’ve never been able to use a single note-taking app. Apple Notes, Bear, Obsidian… They are all installed on my phone and computer. Yesterday, I decided to make a little change. Or, at least, to try.
Syncing with syncthing
One of the main issues is synchronization between devices. That was the right time to try one of the products I’ve always read about but never found the time to try: syncthing.
As I expected, the initial setup was easy, but not flawless. The fault isn’t with the product, though, but with one of my devices that had to be synced: iOS.
On the Linux side, I just installed the package and set up the firewall. Done. On the Apple device, instead, I chose Synctrain and I found it very user-friendly, even though I had never used the Syncthing protocol before (is it OK to call it a protocol?).
Via LAN, the setup was very straightforward. Kudos to all the developers! The objective, though, was to use Syncthing at home but also via a VPN tunnel.
So I spent a good hour trying to figure it out, and eventually, I found that these are the necessary steps:
- On the Linux/server side, the Linux device must have two addresses: the LAN address and the VPN endpoint, with the syntax
tcp://x.x.x.x:22000(or whatever port you used). - On iOS, in Synctrain.app, under
Devices -> Devices -> (server) -> Connection -> Addresses:Use default addressmust be disabled.- Under
Additional addresses, there must be the two IPs from the step above, in the same syntax.
If you set up your firewall correctly, it should work. I think I didn’t miss any steps. So, when you open Synctrain wherever you are, at home or away (with the VPN tunnel activated), the directories will sync.
Then, I tried to figure out how to properly use this setup.
Tuning Obsidian
First, I assumed that I would never have this application open on multiple devices, so there should not be any conflicts—we’ll see about that. Then, I thought, “It would be awesome to have the vault hosted on the Raspberry and access it from my laptop, as with Visual Studio.” Of course, there’s a plugin for that.
So, my vault resides on the Raspberry Pi, and my laptop acts just as a client. As for the smartphone, unfortunately, the iOS version of Obsidian does not support the plugin, so I figured out a workaround.
I first created a vault in a local directory in my iOS app. Then, with Synctrain, I shared it with my Raspberry Pi. After it was synced, I connected from my laptop, using the Obsidian Remote SSH plugin to open the new vault. Done!
Now I can open the vault in both apps, and the vault is synchronized in a matter of seconds.
Caveats
Of course, there are limitations, mostly because of iOS (which I cannot really blame, because its behavior is annoying for reasons related to its security design).
First, Synctrain on mobile only works when it’s in the foreground. That means that you can’t just open Obsidian and expect the vault to be in sync. Synctrain must be opened too, either before or just after. That is where Apple Shortcuts becomes useful. The solution is to create a shortcut that opens both apps, and the user must be patient and wait a few seconds to allow Synctrain to connect to the server and sync the vault. Eh.
And, of course, after Obsidian on iOS is closed, Synctrain should be kept in the foreground for a few seconds to upload the changes.
Second, the dates of the notes are totally messed up. This is where I first thought of abandoning the project.
But I kept at it.
From what I observed, the problem is the Remote SSH plugin. When the app is reopened, or sometimes even when a note is created, its creation and modification dates are set to 1970-01-01.
A quite simple solution is to ensure that all the notes have frontmatter with created and modified dates, or similar properties. I installed two plugins to manage that:
- Linter to add or update the fields when the note is saved (it can also be done automatically after the user stops typing for a few seconds).
- Templater to automate the insertion of the frontmatter properties whenever a note is created. Honestly, I think that either of these two could do all the work, but I still have to find the most intuitive and fastest way that best fits my writing routine.
And that’s all about the limitations… for now. 👀 It surely isn’t perfect, but Bear wasn’t either: more than once, I had duplicated notes and had to manually merge conflicts. Here, the issues seem different, but we’ll see how it evolves after a few weeks. As for new implementations, I just found yet another way to sync Obsidian… but I’m OK for now!
A Little Extra
Finally, a little bonus: an awesome plugin that completely changes how you use Obsidian. It is called Notebook Navigator, and it has so many features that it could be a new independent app. I totally suggest you try it. It is very well thought out in the little details. The video in the README is long but very exhaustive.
🎧 The new album by Caspian is amazing
📖 A collection of ghost stories by Walter Scott
Reactions
How to interact with this page
Via Webmention
Write about this page on your own website and send a
Webmention
to https://blog.scaglio.id/posts/self-hosting-my-notes/.
Your post will appear below.
By email
You can also send an evegreen
In the last few months, I’ve installed more and more services on my Raspberry Pi 5.
It has “only” 8GB of RAM, but I’m very happy with it.
From top, I see that it always has half of its memory available, so for now, I’m not afraid of overloading it.
About a week ago, I installed a VaultWarden instance to replace KeePass, and I’m quite happy with it.
Yesterday, though, a new challenge arose (exclusively in my head): to find a good alternative to one of the best iOS apps — Bear.
For years, I’ve been using Obsidian to take notes, and I have a few vaults on my laptop: for work, folklore notes, and some other abandoned tests. Anyway, I’ve never been able to use a single note-taking app. Apple Notes, Bear, Obsidian… They are all installed on my phone and computer. Yesterday, I decided to make a little change. Or, at least, to try.
Syncing with syncthing
One of the main issues is synchronization between devices. That was the right time to try one of the products I’ve always read about but never found the time to try: syncthing.
As I expected, the initial setup was easy, but not flawless. The fault isn’t with the product, though, but with one of my devices that had to be synced: iOS.
On the Linux side, I just installed the package and set up the firewall. Done. On the Apple device, instead, I chose Synctrain and I found it very user-friendly, even though I had never used the Syncthing protocol before (is it OK to call it a protocol?).
Via LAN, the setup was very straightforward. Kudos to all the developers! The objective, though, was to use Syncthing at home but also via a VPN tunnel.
So I spent a good hour trying to figure it out, and eventually, I found that these are the necessary steps:
- On the Linux/server side, the Linux device must have two addresses: the LAN address and the VPN endpoint, with the syntax
tcp://x.x.x.x:22000(or whatever port you used). - On iOS, in Synctrain.app, under
Devices -> Devices -> (server) -> Connection -> Addresses:Use default addressmust be disabled.- Under
Additional addresses, there must be the two IPs from the step above, in the same syntax.
If you set up your firewall correctly, it should work. I think I didn’t miss any steps. So, when you open Synctrain wherever you are, at home or away (with the VPN tunnel activated), the directories will sync.
Then, I tried to figure out how to properly use this setup.
Tuning Obsidian
First, I assumed that I would never have this application open on multiple devices, so there should not be any conflicts—we’ll see about that. Then, I thought, “It would be awesome to have the vault hosted on the Raspberry and access it from my laptop, as with Visual Studio.” Of course, there’s a plugin for that.
So, my vault resides on the Raspberry Pi, and my laptop acts just as a client. As for the smartphone, unfortunately, the iOS version of Obsidian does not support the plugin, so I figured out a workaround.
I first created a vault in a local directory in my iOS app. Then, with Synctrain, I shared it with my Raspberry Pi. After it was synced, I connected from my laptop, using the Obsidian Remote SSH plugin to open the new vault. Done!
Now I can open the vault in both apps, and the vault is synchronized in a matter of seconds.
Caveats
Of course, there are limitations, mostly because of iOS (which I cannot really blame, because its behavior is annoying for reasons related to its security design).
First, Synctrain on mobile only works when it’s in the foreground. That means that you can’t just open Obsidian and expect the vault to be in sync. Synctrain must be opened too, either before or just after. That is where Apple Shortcuts becomes useful. The solution is to create a shortcut that opens both apps, and the user must be patient and wait a few seconds to allow Synctrain to connect to the server and sync the vault. Eh.
And, of course, after Obsidian on iOS is closed, Synctrain should be kept in the foreground for a few seconds to upload the changes.
Second, the dates of the notes are totally messed up. This is where I first thought of abandoning the project.
But I kept at it.
From what I observed, the problem is the Remote SSH plugin. When the app is reopened, or sometimes even when a note is created, its creation and modification dates are set to 1970-01-01.
A quite simple solution is to ensure that all the notes have frontmatter with created and modified dates, or similar properties. I installed two plugins to manage that:
- Linter to add or update the fields when the note is saved (it can also be done automatically after the user stops typing for a few seconds).
- Templater to automate the insertion of the frontmatter properties whenever a note is created. Honestly, I think that either of these two could do all the work, but I still have to find the most intuitive and fastest way that best fits my writing routine.
And that’s all about the limitations… for now. 👀 It surely isn’t perfect, but Bear wasn’t either: more than once, I had duplicated notes and had to manually merge conflicts. Here, the issues seem different, but we’ll see how it evolves after a few weeks. As for new implementations, I just found yet another way to sync Obsidian… but I’m OK for now!
A Little Extra
Finally, a little bonus: an awesome plugin that completely changes how you use Obsidian. It is called Notebook Navigator, and it has so many features that it could be a new independent app. I totally suggest you try it. It is very well thought out in the little details. The video in the README is long but very exhaustive.
🎧 The new album by Caspian is amazing
📖 A collection of ghost stories by Walter Scott