How to Install UniFi Network Controller on Your Synology NAS

How to Install UniFi Network Controller on Your Synology NAS

The UniFi Controller or Network Application is a wireless network management software solution from Ubiquiti Networks that supports the latest UniFi Network Application app. It allows you to manage multiple wireless networks using a web browser. Compared to my previous guide, How to Install Unifi Controller 7 on Your Synology NAS, this guide is fully compatible with theĀ latest Unifi Network Application 8.6.9. In this step by step guide I will show you how to Install the Unifi Network Application on your Synology NAS using Docker & Portainer.

šŸ’”Note:Ā This guide works perfectly with the latest Unifi Network Application 8.6.9Ā release.

šŸ’”Note: Check out my new guide on how to Install Unifi Network Application 8.6.9 on Your UGREEN NAS.

  • 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

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

UniFi Network Controller Synology NAS Set up 1

  • STEP 4

Now create two new folders inside the unifi folder that you have previously created at STEP 3 and name them config and db. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

UniFi Network Controller Synology NAS Set up 2

  • STEP 5

Download (click on the blue link below) then unzip and upload the init-mongo.js file below in the db folder that you have previously created at STEP 4. Follow the instructions in the image below. šŸ”’Note: Support my work to unlock the password. You can use this password to download any file on mariushosting forever!

šŸ‘‰šŸ»Download init-mongo.js

UniFi Network Controller Synology NAS Set up 3

  • STEP 6

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 7

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

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

version: "3.9"
services:
  db:
    image: mongo:4.4 # only up to 4.4 !
    container_name: Unifi-Network-Application-Database
    hostname: unifi-db
    mem_limit: 2g
    cpu_shares: 768
    security_opt:
      - no-new-privileges:false
    healthcheck:
      test: ["CMD", "mongo", "--eval", "db.adminCommand('ping')"]
      interval: 10s
      timeout: 10s
      retries: 5
      start_period: 20s
    volumes:
      - /volume1/docker/unifi/db:/data/db:rw
      - /volume1/docker/unifi/db/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
    restart: on-failure:5

  unifi-network-application:
    image: ghcr.io/linuxserver/unifi-network-application:latest
    container_name: Unifi-Network-Application
    hostname: unifi-network-application
    mem_limit: 4g
    cpu_shares: 1024
    security_opt:
      - no-new-privileges:false
    ports:
      - 8443:8443       # Required - web admin port
      - 3478:3478/udp   # Required - STUN port
      - 10001:10001/udp # Required - AP discovery
      - 8080:8080       # Required - Device communication
      #- 1900:1900/udp   # optional - controller discoverable on L2 network
      - 8843:8843       # optional - Unifi guest portal HTTPS redirect port
      - 8880:8880       # optional - Unifi guest portal HTTP redirect port
      - 6789:6789       # optional - For mobile throughput test
      - 5514:5514/udp   # optional - Remote syslog port
    volumes:
      - /volume1/docker/unifi/config:/config:rw
    environment:
      TZ: Europe/Bucharest
      PUID: 1026
      PGID: 100
      MONGO_USER: unifiuser
      MONGO_PASS: unifipass
      MONGO_HOST: unifi-db
      MONGO_PORT: 27017
      MONGO_DBNAME: unifi
      MEM_LIMIT: 2048   # optional - Java memory limit
      MEM_STARTUP: 2048 # optional - Java initial/minimum memory
    restart: on-failure:5
    depends_on:
      db:
        condition: service_started

Note: After you paste the code in the Web editor, 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 PUID and PGID 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: At the beginning of the Docker Compose code, you can also change the mongo:4.4 image with the latest mongo:7 image if your NAS supports AVX.

UniFi Network Controller Synology NAS Set up 4 new2

  • STEP 8

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.

UniFi Network Controller Synology NAS Set up 5

  • STEP 9

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

UniFi Network Controller Synology NAS Set up 6

  • STEP 10

Go back toĀ STEP 1Ā or you will deal with karma šŸ™‚.

  • STEP 11

The installation process can take up to a few seconds/minutes. It will depend on your Internet speed connection. Now open your browser andĀ type inĀ http://Synology-ip-address:8080/setup You will be automatically redirected to an https 8443 port. If you are using the chrome browser, click Advanced. Follow the instructions in the image below.

UniFi Network Controller Synology NAS Set up 7 new 2024

  • STEP 12

Click to Proceed to your local NAS IP (unsafe). Follow the instructions in the image below.

UniFi Network Controller Synology NAS Set up 8

  • STEP 13

Select a name for the Server Controller, then check “I agree with the user license and terms of service”. Click Next to start the installation wizard.

UniFi Network Controller Synology NAS Set up 9

Enjoy UniFi Network Controller!

šŸ†˜TROUBLESHOOTING

If you encounter issues by using this container, make sure to check out the Common Docker issuesĀ article.

Fix: Make sure RULE 6 on your Synology Firewall is correctly set up.
Fix: Once you have installed Unifi Network Controller, go to Settings / System and scroll all the way to the bottom and enable “override inform host“, using the IP address of the NAS as the value.

If you are using the mongo:7 image instead of the mongo:4.4 image, you should change the healthcheck at STEP 7 from:

    healthcheck:
      test: ["CMD", "mongo", "--eval", "db.adminCommand('ping')"]

to

    healthcheck:
      test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]

So, mongo for mongo:4.4 and mongosh for mongo:7

Note: If you want to run the UniFi Network Controller container over HTTPS, check How to Run Docker Containers Over HTTPS. In order to make UniFi Network Controller work via HTTPS, it’s mandatory to activate WebSocket.

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 UniFi Network Controller container with the latest image.
Note: How to Add USB Support on DSM 7.2.
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 / November 29th, 2024 at 12:22 AM