Sync to Nextcloud with encryption and without WebDav

I'm using Joplin 2.7.15 on Arch Linux, and Nextcloud 24.0.1 hosted on an Ubuntu 22.04 server.

My ultimate goal is to have my Joplin notes encrypted using the Joplin encryption feature, and to have them synced continuously to my Nextcloud. Typically, the recommend way to do this is to create an app password for Joplin from Nextcloud, then set Nextcloud as a WebDAV sync target from within Joplin.

In my case, the WebDAV approach is somewhat suboptimal, for the following two reasons:

  1. I already have the Nextcloud client installed on my computer, so if I set up sync through the WebDAV interface, then each sync event will upload the data to my Nextcloud (from Joplin), then initiate a sync event on my Nextcloud server, causing my Nextcloud client to download the updated files to my computer. In other words, I will end up using twice as much net traffic and local disk space as necessary.

    (I guess I could manually exclude the Joplin directory from local sync, but I would like to avoid this extra step if possible.)

  2. If I need to migrate my Nextcloud instance to a new server, then I will have to go through the WebDAV sync target setup again.

What I would like to do instead is simply save my Joplin notebooks as a file directly in my Nextcloud, and direct my Joplin app to read from this folder. That way, all the syncing is passed through the Nextcloud client. (I realize this means that I will not be able to use Joplin without the Nextcloud client installed, but I'm fine with this.) Obviously, the notebooks themselves would be saved as an opaque blob, since they are encrypted—this is fine, as long as the same blob is readable by Joplin when I switch computers.

This forum post mentions an "unofficial" way to change the Joplin storage folder via the --profile startup option. However,

  1. The post is several years old, and I'm not sure if this method still works or will be supported going forward.
  2. It's unclear if that method supports encryption.
  3. It's unclear if that method works across different devices.

What's the current status of customizing the Joplin save directory? Does it support encryption? Is there a way to achieve the Nextcloud sync setup described above in the current version of Joplin?

Thank you.

I use NextCloud and I indeed just exclude the Joplin dir from my local client so it doesn't download it locally.

If you want to just use a local folder and have Nextcloud handle the actual syncing rather than WebDAV then just use the file system sync in Joplin.

1 Like

Thank you. I'm currently syncing with OneDrive, so to implement this, will it suffice to just copy the files from the OneDrive to my Nextcloud, point file system sync to this directory, and reenter the encryption password? Or will the files be encoded differently since they were originally targeted at OneDrive WebDAV?

I don't use encryption so I'm really not the expert on this (somebody jump in if I'm wrong) but:

I reallly wouldn't do that. Joplin is trying to sync with what it can find in that location and if it is empty at any point then you might end up with your local data being deleted.

In fact, before you do anything I urge you to get the simple backup plugin and run it to make sure your local data is entirely safe.

Honestly I would just let Joplin handle it, set the sync to the file system and do a re-upload local data to sync target (which is in the advanced options inside the settings). Joplin will then sync to the new folder which (I assume) your NextCloud client will be looking at.
Once fully sync'd to your NextCloud and the local file system for any of your other machines you can, in Joplin on those machines, use the other button (Delete local data and redownload from sync target) to make sure your local data is properly synced with the new target.

Honestly I don't really get why you just wouldn't use the WebDAV with the exceptions on the local client. That way it means you don't have a random extra copy of your data hanging around for no reason (i.e. it only exists in your local profile and NextCloud. Using the file system means having an extra copy of your NextCloud data locally).

My remaining concern with the WebDAV approach would then be how to proceed if my NC server dies or I upgrade it. But it sounds like in this case I could just change my sync target to the new NC system then reupload local to sync target. Thanks, I will try this out and let you know how it goes.

Joplin is "client first" so no matter what happens to your sync target mechanism your local data will be safe (unless the target itself is wiped out but then you have bigger problems anyway).

So long as you have a complete copy of your local data you can always create a new sync target.

Alright, I set things up through the WebDAV as recommended and things work fairly smoothly.

As I expected, the hardest part is setting up the migration itself: Once I got my first device set up, I had to go around to my other devices, detach the OneDrive sync, and then reattach to the Nextcloud sync target. For anyone reading this in the future, be very careful with the sequence of steps when trying to update the sync target. I accidentally wiped out my Nextcloud Joplin folder using the following steps to set up a new client:

  1. In Options > Sync, change the Sync target to nothing
  2. Delete all of my notes from the local computer.
  3. In Options > Sync, change the Sync target to the Nextcloud.

If you do this, then press Apply, your empty set of notes will be pushed to Nextcloud, and everything will be erased. If you make this mistake, then you need to go back to your first device and choose Options > Sync > Advanced > Reupload local data to target (possibly with some clever use of airplane mode to prevent this device from syncing and wiping itself).

The correct way to set it up (and this is what Daeraxa described, but it deserves emphasis) is immediately after step 3, without going back to the main Nextcloud window (this is important, because doing so triggers a sync) you have to scroll down and choose Options > Sync > Advanced > Delete local data and redownload from sync.

(Actually, you probably don't need to bother with steps 1 and 2 above, but they are helpful in the sense that if you make the mistake I did, it will be obvious because you will wipe out your whole Nextcloud, rather than just pushing whatever marginal changes were made between using your other device and the new one.)

These steps only apply in the special case of moving your sync target from one place to another. They would also apply, I think, if you upgrade your Nextcloud server. If you currently have no sync target and are taking notes locally, then setting up a Nextcloud sync is pretty easy and doesn't require the steps above.