Lately I’ve been growing a little disappointed with Nextcloud’s offering. I’ve been running it since its first release, and overall it has been a great piece of software. However, lately I’ve encountered issues like sometimes the desktop client won’t use secret service (and there’s been lots of yelling about this on GitHub with 0 developer response), Nextcloud’s pursuit for new shiny stuff like AI without fixing the core software, and lastly, utterly breaking core software in big ways and shipping it anyway. So, I’ve been looking to replace components of Nextcloud since there isn’t exactly a one-to-one replacement for it.

My first shot is at photos. This has actually been a pain point already. I was frustrated when Nextcloud seriously broke Photos 2.0 in Nextcloud 26. It was broken until a later release and I had to get over it. I switched to using Memories, which is actually incredibly awesome and should just replace what Nextcloud has, but the big problem is with albums.

Albums are great. Nextcloud doesn’t make it easy to sync any of that. Also, if my family is mainly phone users, as they are, I can’t tell them to pull out a laptop and go and add pictures to albums. They don’t do that. But, if they could from their phones, they could, and likely would, collaborate on family albums. After playing with Piwigo some, I settled on Immich. Piwigo is also very good, and it settled my strong desire to run my software on FreeBSD and not use Docker, but Immich is just too cool.

What’s Cool About Immich?

Here’s a nice bullet point list of what I like:

  • Don’t have to do community albums to allow single users to have their own photo syncing

  • Web UI is nicer

  • Administration is straightforward

  • A stupid amount of picture recognition stuff out of the box

  • Pretty maps for geotagged photos

  • Transcoding

  • Easy album sharing

  • Lots of search options, like searching for a mountain, my wife, a plane

  • Sync photos from my phone

  • OIDC support - this will be fun maybe

How I Am Attempting This

At first I started with the idea of cloning my ZFS dataset with my Nextcloud data, adding it to Immich, and deleting the other surrounding documents since a lot of the storage is taken up in photos and videos from our phones. However, I noticed that Immich copies the files into a library. So, that would mean importing and then deleting all the data in the dataset pretty much. Not super effective.

What I Want

I don’t like having big data tied up in a disk image. That’s also not useful for me with the way I do backups. So, how from a FreeBSD box do I take data from dataset A, and import it into dataset B from a Linux (Debian 12) virtual machine?

  1. Create the VM

  2. ZFS clone my Nextcloud dataset and set it up for an NFS mount

  3. Create a new ZFS dataset and NFS mount it: this is will be the end destination

  4. Create a docker user and spin up Immich

  5. Mount both NFS filesystems

  6. Use immich cli to upload my Nextcloud camera rolls

  7. When done, delete the old NFS mount and dataset

This process has the added bonus of letting me upload to both Nextcloud and Immich while I get things in order.

I’m Still in the Middle of This

I am still moving data as I speak. I am kicking the tires on only my user at this moment, but if I get it all working right, I’m sliding the family over.

My biggest concerns at this moment are how well will the iOS app sync? And, will the app pick up where I left off in my photos and not make me have to upload my whole entire library? That would be a huge pain.

First Attempt

My first attempt was messy. I did what I described in "What I Want" but it is a lot of work for many users, and I ran into some roadblocks with the features currently present in Immich.

First, I can’t tell the iOS app to start backing up my photos from NOW. It has to do everything. Secondly, I converted all my files to jpg with Nextcloud, Immich operates on the HEIC files. This means I have to sync everything because the file hashes will not match.

So, I used the immich cli to import my Nextcloud photos, then uploaded all my pictures on my phone with Immich. This left me with duplicates for HEIC and jpg files. To alleviate this, I thought to change the Storage Template to be the same thing, applied that template to my existing files, then uploaded the images on my phone. This meant the file names were identical, minus the HEIC and jpg. I looked for all the HEIC files I had and removed the equivalent files named jpg

for f in $(find /mnt/nfs/library/library -type f -name "*.HEIC"); do
   jpg_file="$(echo $f | sed 's/.HEIC/.jpg/g')"
   rm $jpg_file
done

Then I had to remove these files from the database. This required I exec into the postgresql container and run some commands on the database. I took the orphans.json file that Immich provides in the Repair page, having only the Offline Paths entries. I pulled out the entityIDs and stuck them into a file, which I then ran a for loop on to delete the entries that matched

for entry in $(cat /entityIds.txt); do
	psql -d immich -c "DELETE FROM ASSETS WHERE id='$entry';"
done

After that, I had a bunch of untracked files to clear out, since they’re all thumbnails and what not that were generated for those images. So I downloaded the untracked.txt again, this time putting it in the immich-server container. I didn’t have to do any grepping or awk, it was already in a nice format. SO I ran a somewhat similar command as before

for file in $(cat /untracked.txt); do
	rm $entry
done

I did a refresh on the repair page to make sure it was all cleared out.

Next Steps

I got my family on Immich for now. It will be a job to move their old stuff over, but I think my next attempt will be to match time info in the filenames between Nextcloud and Immich, and if the time info matches, it is probably the same file. If that file does not exist in immich, then upload it.

After that, at a much later date, I’ll clean out all the Nextcloud data.

This will probably be a "do this over months" project, especially since I have family on Nextcloud that isn’t in the area, so I have to migrate them when they get here.

Anyway, this is a big job. It could have been easily solved if I could backup the camera roll from NOW. But, so far I still find Immich worth it. I do have my first upgrade coming up. Lots of irons in the fire right now though…​I’m also super duper behind on my 100 days to offload :)

#100DaysToOffload #Post10