If you’re here, you already know why we’re doing this – they capped the “unlimited for free” offer, they can suspend your account for any reason at any time, and probably worst of all, your photos are their product. Luckily, great open source/free software applications exist today that can almost bring that sleek and very useful Google Photos experience to our home servers.
PhotoPrism is a truly polished photo library/organization project, with advanced features such as AI-powered facial and object recognition, but it does not come with its own iOS or Android app – so you have to bring something else to your “stack” in order to sync your photo library with your home server. *An additional limiting factor for iOS users is that there are a lot fewer apps for local photo backups/file sharing than for Android.
It’s important to note that at this time, there are no perfect alternatives to the major cloud providers – in fact, due to the subjective nature of selfhosting, “perfect” will likely never exist. What works for me may not work for you, etc. If you are not impressed with PhotoPrism for any reason, you might want to look at Photoview, another promising project with a different set of goals, pros and cons.
For photo syncing, I chose to go with Resilio Sync because it has a pretty decent app for that (note: Resilio is not open-source). It can actually work with your iOS photos without jumping through hoops – something that Syncthing sadly can’t; and Nextcloud seems to experience functionality-breaking bugs every time I even think about it. I’ve been meaning to write down some thoughts on the current setup while I have it – not really a step-by-step guide, just some notes that might help others.
Getting and organizing your photos
You can obtain a full backup of your Google Photos data through Takeout, but you might find that it is disjointed, with images and EXIF data separated – there is a script to help with that (PhotoPrism is supposedly able to work with these separated files, but I fixed mine just in case). You might also want to combine your cloud data with large uncategorized folders of images on your local computer, and there are scripts that can help with that too.
Installing both PhotoPrism (guide) and Resilio Sync (guide) is really simple – I used Docker Compose to bring both services up, and then proxied them with NGINX. On the iPhone end, I downloaded the Resilio Sync app, and set up a “Camera Backup” folder. You then have to send a share link to your other Sync instance.
For PhotoPrism to work as expected in the browser, you have to enable WebSockets in your NGINX configuration (guide), and you should also define your domain name (see the answer to this issue) if you would like to be able to share links to your images or videos to other people. If you are using uBlock Origin or another adblocker/privacy extension for your browser, you might still be getting that “You are offline” warning, so consider disabling some browser extensions for a test.
Something else that I remember about the initial process of importing my photos to PhotoPrism is that the generated thumbnails were just too large in size, so I advise on lowering the JPEG quality setting to something like 80. This can slightly impact the “AI” functionality of the application (which can be completely disabled if you’re not into that).
One notable downside of Resilio Sync is that it is not a WebDAV server, so it won’t inform PhotoPrism of file changes. You can do this with a cron job, as advised here, and you can optimize it further, as you don’t need to waste CPU on the indexer if there haven’t been any recently changed files:
if [ ! -f /mnt/raid1/lockfile ]; then #add a lockfile check, as indexing can be slow
if [ "$(find /mnt/raid1/iphone -cmin -10)" ]; then #set this to whatever your cronjob's frequency is
/usr/bin/docker-compose -f /home/$user/photoprism/docker-compose.yml exec -T photoprism photoprism copy
Another downside of Resilio Sync – more specifically, of its iOS app – is that it does not back up your photos automatically, so you have to remember to open the app any time you want to send your pictures to your server (which is usually when you already want them on your PhotoPrism site). There is a paid subscription that adds this option as well as some other functionality, but you could also work around this by setting up an Automation in the Apple Shortcuts app – you can then automatically open the Sync app every time you connect to your home network, or every time you close the Camera app, or every night at 3AM. I personally use the “when connected to power” condition and it works just fine.
A third downside of Resilio Sync, and the one I haven’t worked out yet, is that it preserves the files on your home server even after you’ve deleted them from your phone (which is a whole task on its own). In effect, your Sync directory keeps getting bigger and bigger, and the PhotoPrism indexer checks if each file is already added to your database, wasting both real and CPU minutes in the process. Deleting files from the filesystem without informing the Resilio Sync service results in a “corrupted” share, so the only way around this seems to be to manually delete and re-create your share across every device. That’s a bit of a hassle, but it doesn’t have to happen that often, so I can live with it for now. The ability to work around this may be another one of Resilio Sync’s paid features, I’m not really sure.
Last but not least, Resilio Sync does not seem to be actively developed any more – in time, this will become more of an issue, especially for the mobile app.
I was been using this setup for a while, and I’m pretty happy with it. I also keep my Google Photos app and account, mostly as a backup. However, I had to move away from PhotoPrism after finding out that it doesn’t support multiple users. You can read more about my updated setup at Part 2 of this write-up.