Unlike some commercial services that store your photos in the cloud and scan/index them to train their machine learning models and collect ad targeting data on you, LibrePhotos keeps all your photos and metadata on your local server. Your data is never sent to or stored on a 3rd party server. Get the same power as those commercial services without giving up your personal data and privacy. LibrePhotos can register a biometric facial pattern to identify or verify the identity of a subject through an image or video. In this step by step guide I will show you how to install LibrePhotos on your Synology NAS using Docker & Portainer.
STEP 1
Please Support My work by Making a Donation.
STEP 2
Install Portainer using my step by step guide. If you already have Portainer installed on your Synology NAS, skip this STEP. Attention: Make sure you have installed the latest Portainer version.
STEP 3
Make sure you have a synology.me Wildcard Certificate. Follow my guide to get a Wildcard Certificate. If you already have a synology.me Wildcard certificate, skip this STEP.
STEP 4
Go to Control Panel / Login Portal / Advanced Tab / click Reverse Proxy. Follow the instructions in the image below.
STEP 5
Now click the “Create” button. Follow the instructions in the image below.
STEP 6
After you click the Create button, the window below will open. Follow the instructions in the image below.
On the General area, set the Reverse Proxy Name description: type in LibrePhotos. After that, add the following instructions:
Source:
Protocol: HTTPS
Hostname: librephotos.yourname.synology.me
Port: 443
Check Enable HSTS
Destination:
Protocol: HTTPS
Hostname: localhost
Port: 7462
STEP 7
On the Reverse Proxy Rules click the Custom Header tab. Click Create and then, from the drop-down menu, click WebSocket. After you click on WebSocket, two Header Names and two Values will be automatically added. Click Save. Follow the instructions in the image below.
STEP 8
Go to Control Panel / Network / Connectivity tab/ Check Enable HTTP/2 then click Apply. Follow the instructions in the image below.
STEP 9
Go to Control Panel / Security / Advanced tab/ Check Enable HTTP Compression then click Apply. Follow the instructions in the image below.
STEP 10
Go to File Station and open the docker folder. Inside the docker folder, create one new folder and name it librephotos. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.
STEP 11
Now create six new folders inside the librephotos folder that you created at STEP 10 and name them cache, db, logs, protected_media, redis, scan. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.
STEP 12
Log into Portainer using your username and password. On the left sidebar in Portainer, click on Stacks then + Add stack. Follow the instructions in the image below.
STEP 13
In the Name field type in librephotos. Follow the instructions in the image below.
services: redis: image: redis container_name: LibrePhotos-REDIS hostname: redis mem_limit: 256m mem_reservation: 50m cpu_shares: 768 security_opt: - no-new-privileges:true read_only: true user: 1026:100 healthcheck: test: ["CMD-SHELL", "redis-cli ping || exit 1"] volumes: - /volume1/docker/librephotos/redis:/data:rw environment: TZ: Europe/Bucharest restart: on-failure:5 db: image: postgres:17 command: postgres -c fsync=off -c synchronous_commit=off -c full_page_writes=off -c random_page_cost=1.0 container_name: LibrePhotos-DB hostname: db security_opt: - no-new-privileges:true healthcheck: test: ["CMD", "pg_isready", "-q", "-d", "librephotos", "-U", "librephotosuser"] timeout: 45s interval: 10s retries: 10 volumes: - /volume1/docker/librephotos/db:/var/lib/postgresql/data:rw environment: POSTGRES_DB: librephotos POSTGRES_USER: librephotosuser POSTGRES_PASSWORD: librephotospass restart: on-failure:5 frontend: image: reallibrephotos/librephotos-frontend:latest container_name: LibrePhotos-FRONT hostname: frontend mem_limit: 256m mem_reservation: 50m cpu_shares: 768 security_opt: - no-new-privileges:true read_only: true user: 1026:100 restart: on-failure:5 backend: image: reallibrephotos/librephotos:latest container_name: LibrePhotos-BACK hostname: backend mem_limit: 6g cpu_shares: 768 security_opt: - no-new-privileges:true volumes: - /volume1/docker/librephotos/scan:/data:rw - /volume1/docker/librephotos/protected_media:/protected_media:rw - /volume1/docker/librephotos/logs:/logs:rw - /volume1/docker/librephotos/cache:/root/.cache:rw environment: SECRET_KEY: MariushostingMariushostingMari13 BACKEND_HOST: backend ADMIN_EMAIL: yourown@email.com ADMIN_USERNAME: marius ADMIN_PASSWORD: mariushosting DB_BACKEND: postgresql DB_NAME: librephotos DB_USER: librephotosuser DB_PASS: librephotospass DB_HOST: db DB_PORT: 5432 REDIS_HOST: redis REDIS_PORT: 6379 WEB_CONCURRENCY: 2 HEAVYWEIGHT_PROCESS: 1 ALLOW_UPLOAD: true # If you can't deploy the stack change true to 1 DEBUG: 0 FIXPERMISSIONS: true # If you can't deploy the stack change true to 1 restart: on-failure:5 depends_on: db: condition: service_healthy redis: condition: service_healthy proxy: image: reallibrephotos/librephotos-proxy:latest container_name: LibrePhotos-PROXY hostname: proxy mem_limit: 256m cpu_shares: 768 security_opt: - no-new-privileges:true healthcheck: test: curl -f http://localhost/ || exit 1 ports: - 7462:80 volumes: - /volume1/docker/librephotos/scan:/data:rw - /volume1/docker/librephotos/protected_media:/protected_media:rw restart: on-failure:5 depends_on: backend: condition: service_started frontend: condition: service_started
Note: Before you paste the code above in the Web editor area below, change the value numbers for user with your own UID and GID values. (Follow my step by step guide on how to do this.) 1026 is my personal UID value and 100 is my personal GID value. You have to type in your own values.
Note: Before you paste the code above in the Web editor area below, change the value for TZ. (Select your current Time Zone from this list.)
Note: Before you paste the code above in the Web editor area below, change the value for SECRET_KEY and add your own Secret Key. MariushostingMariushostingMari13 is an example for SECRET_KEY. You should invent your own Value. Add 32 random characters, both letters and numbers.
Note: Before you paste the code above in the Web editor area below, change the value for ADMIN_EMAIL. yourown@email.com is an example for an email address. You have to type in your own email address.
Note: Before you paste the code above in the Web editor area below, change the value for ADMIN_USERNAME and type in your own username. marius is an example for an username.
Note: Before you paste the code above in the Web editor area below, change the value for ADMIN_PASSWORD and type in your admin password. mariushosting is an example for an admin password.
⚠️Warning: If you get an error and you can’t deploy the stack, change the following values ALLOW_UPLOAD: true with ALLOW_UPLOAD: 1 and FIXPERMISSIONS: true with FIXPERMISSIONS: 1
STEP 14
Scroll down on the page until you see a button named Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.
STEP 15
If everything goes right, you will see the following message at the top right of your screen: “Success Stack successfully deployed“.
STEP 16
Go back to STEP 1 or you will deal with karma 🙂
STEP 17
Now open your browser and type in your HTTPS/SSL certificate like this https://librephotos.yourname.synology.me that you have previously created at STEP 6. In my case it’s https://librephotos.mariushosting.synology.me If everything goes right, you will see the LibrePhotos Login page. Type in your own ADMIN_USERNAME & ADMIN_PASSWORD that you have previously created at STEP 13, then click Login. Follow the instructions in the image below.
STEP 18
Go to File Station. You can now populate your scan folder that you have previously created at STEP 11 with your own photos.
STEP 19
Go back to your LibrePhotos https address. Click Edit User. Follow the instructions in the image below.
STEP 20
Choose the /data directory, then click Save. If you have previously populated your scan folder with your own photos as per the suggestion at STEP 18, after you click Save, the indexing of your photos will start automatically.
STEP 21
Depending on how many photos you have, it can take up to several hours or days to index all of your pictures. At the top right of the page you can also upload pictures from your own computer into the LibrePhotos software by clicking the little upload icon. Follow the instructions in the image below.
Enjoy LibrePhotos!
If you encounter issues by using this container, make sure to check out the Common Docker issues article.
Note: Can I run Docker on my Synology NAS? See the supported models.
Note: How to Back Up Docker Containers on your Synology NAS.
Note: Find out how to update the LibrePhotos container with the latest image.
Note: How to Free Disk Space on Your NAS if You Run Docker.
Note: How to Schedule Start & Stop For Docker Containers.
Note: How to Activate Email Notifications.
Note: How to Add Access Control Profile on Your NAS.
Note: How to Change Docker Containers Restart Policy.
Note: How to Use Docker Containers With VPN.
Note: Convert Docker Run Into Docker Compose.
Note: How to Clean Docker.
Note: How to Clean Docker Automatically.
Note: Best Practices When Using Docker and DDNS.
Note: Some Docker Containers Need WebSocket.
Note: Find out the Best NAS Models For Docker.
Note: Activate Gmail SMTP For Docker Containers.
This post was updated on Friday / October 11th, 2024 at 9:52 PM