How to Install Lychee on Your Synology NAS

How to Install Lychee on Your Synology NAS

Lychee is a free photo-management tool, which runs on your server or web-space. Installing is a matter of seconds. Upload, manage and share photos like from a native application. Lychee comes with everything you need and all your photos are stored securely. In this step by step guide I will show you how to install Lychee on your Synology NAS using Docker and Portainer.

💡Note: This guide works perfectly with the latest Lychee v5.1.2 release.

  • 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.

Lychee Synology NAS Set up 1

  • STEP 5

Now click the “Create” button. Follow the instructions in the image below.

Lychee Synology NAS Set up 2

  • 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 Lychee. After that, add the following instructions:

Source:
Protocol: HTTPS
Hostname: lychee.yourname.synology.me
Port: 443

Check Enable HSTS

Destination:
Protocol: HTTP
Hostname: localhost
Port: 6280

Lychee Synology NAS Set up 3

  • 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.

Synology Proxy WebSocket

  • STEP 8

Go to Control Panel / Network / Connectivity tab/ Check Enable HTTP/2 then click Apply. Follow the instructions in the image below.

Lychee Synology NAS Set up 4

  • STEP 9

Go to Control Panel / Security / Advanced tab/ Check Enable HTTP Compression then click Apply. Follow the instructions in the image below.

Lychee Synology NAS Set up 5

  • STEP 10

Go to File Station and open the docker folder. Inside the docker folder, create one new folder and name it lychee. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Lychee Synology NAS Set up 6

  • STEP 11

Now create five new folders inside the lychee folder that you created at STEP 10 and name them conf, db, redis, sym, uploads. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

Lychee Synology NAS Set up 7

  • 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.

1 Synology Portainer Add Stack

  • STEP 13

In the Name field type in lychee. Follow the instructions in the image below.

Note: Copy Paste the code below in the Portainer Stacks Web editor.

version: "3.9"
services:
  redis:
    image: redis
    container_name: Lychee-REDIS
    hostname: lychee-redis
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: ["CMD-SHELL", "redis-cli ping || exit 1"]
    user: 1026:100
    environment:
      - TZ=Europe/Bucharest
    volumes:
      - /volume1/docker/lychee/redis:/data
    restart: always

  db:
    image: mariadb:11.3-jammy
    container_name: Lychee-DB
    hostname: lychee-db
    security_opt:
      - no-new-privileges:true
    environment:
      - TZ=Europe/Bucharest
      - MYSQL_ROOT_PASSWORD=rootpass
      - MYSQL_DATABASE=lychee
      - MYSQL_USER=lycheeuser
      - MYSQL_PASSWORD=lycheepass
    volumes:
      - /volume1/docker/lychee/db:/var/lib/mysql:rw
    ports:
      - 3306:3306
    restart: always

  lychee:
    image: lycheeorg/lychee:latest
    container_name: Lychee
    hostname: lychee
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: curl -f -s http://localhost:80/ || exit 1
    volumes:
      - /volume1/docker/lychee/conf:/conf
      - /volume1/docker/lychee/uploads:/uploads
      - /volume1/docker/lychee/sym:/sym
    environment:
      - PUID=1026
      - PGID=100
      - PHP_TZ=Europe/Bucharest
      - TIMEZONE=Europe/Bucharest
      - DB_CONNECTION=mysql
      - DB_HOST=lychee-db
      - DB_PORT=3306
      - DB_DATABASE=lychee
      - DB_USERNAME=lycheeuser
      - DB_PASSWORD=lycheepass
      - CACHE_DRIVER=redis
      - REDIS_HOST=lychee-redis
      - REDIS_PASSWORD=null
      - REDIS_PORT=6379
      - STARTUP_DELAY=10
      - APP_NAME=Laravel
      - APP_DEBUG=false      
      - APP_URL=https://lychee.yourname.synology.me
      - TRUSTED_PROXIES=*
      - SECURITY_HEADER_HSTS_ENABLE=true
       #- MAIL_DRIVER=smtp
       #- MAIL_HOST=smtp.gmail.com
       #- MAIL_PORT=587
       #- MAIL_USERNAME=Your-own-gmail-address
       #- MAIL_PASSWORD=Your-own-gmail-address
       #- MAIL_ENCRYPTION=starttls
       #- MAIL_FROM_NAME=Your-own-gmail-address
       #- MAIL_FROM_ADDRESS=Your-own-app-password
    ports:
      - 6280:80
    restart: always
    depends_on:
      db:
        condition: service_started
      redis:
        condition: service_healthy

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 numbers for PUID and PGID with your own values. (Follow my step by step guide on how to do this.) 1026 is my personal PUID value and 100 is my personal PGID 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 PHP_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 TIMEZONE. (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 APP_URL and type in your own synology.me DDNS with https:// at the beginning that you have previously created at STEP 6.
Note: If you want, you can also add your own SMTP email details by removing all the # in the code above. If you don’t have SMTP details, then leave the code as it is with the #. (Follow my guide on how to Activate Gmail SMTP For Docker Containers.)

Lychee-Synology-NAS-Set-up-8-new-2026

  • 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.

Lychee Synology NAS Set up 9 new 2024

  • STEP 15

If everything goes right, you will see the following message at the top right of your screen: “Success Stack successfully deployed“.

Lychee Synology NAS Set up 10

  • STEP 16

Go back to STEP 1 or you will deal with karma 🙂.

  • STEP 17

Please wait approximately 5 minutes for the installation to be completed or you will get a blank Synology page if you try to connect too soon. Now open your browser and type in your HTTPS/SSL certificate like this https://lychee.yourname.synology.me In my case it’s https://lychee.mariushosting.synology.me If everything goes right, you will see the Lychee admin set up page. Type in your own Username and Password. Confirm the password then click Create admin account. Follow the instructions in the image below.

Lychee Synology NAS Set up 11

  • STEP 18

Click Open Lychee. Follow the instructions in the image below.

Lychee Synology NAS Set up 12

  • STEP 19

Type in the Username and Password that you have previously created at STEP 17. Click Sign In. Follow the instructions in the image below.

Lychee Synology NAS Set up 13 new 2024

  • STEP 20

Your Lychee at a glance! Upload your own photos by clicking the + button at the top right of the page. Follow the instructions in the image below.

Lychee Synology NAS Set up 14 new 2024

  • STEP 21

Your Lychee at a glance!

Lychee Synology NAS Set up 15 new 2024

Enjoy Lychee!

Note: Lychee integrates a Honeypot and will return 418 if you hit some specific addresses. For example, if anyone tries to access the cross product of those e.g. admin.html, they will get a 418 back. You can then use that response with fail2ban to get rid of undesirable visitors: See more on the official Lychee page documentation.

🆘TROUBLESHOOTING

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: Find out how to update the Lychee container with the latest image.
Note: How to Free Disk Space on Your NAS if You Run Docker.
Note: Instead of the synology.me DDNS you can also use your own domain name.
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 / February 23rd, 2024 at 2:31 PM