How to Install ERPNext on Your Synology NAS

How to Install ERPNext on Your Synology NAS

ERPNext is a full-featured business management solution that helps SMEs record all their business transactions in a single system. With ERPNext, SMEs can make informed, fact-based, timely decisions to remain ahead of the competition. It serves as the backbone of a business, adding strength, transparency, and control to your growing enterprise. ERPNext will help you: track all invoices and payments, know what quantity of which product is available in stock, identify and track your key performance indicators (KPIs), identify open customer queries, manage employee payrolls, assign tasks and follow up on them, maintain a database of all your customers, suppliers, and contacts, prepare quotations, track your budgets and spending, determine effective selling price based on the actual raw material, machinery, and effort cost, get reminders on maintenance schedules and publish your website. In this step by step guide I will show you how to install ERPNext on your Synology NAS using Docker & Portainer.

💡Note: This guide works perfectly with the latest ERPNext 15.19.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.

ERPNext Synology NAS Set up 1

  • STEP 5

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

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

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

Check Enable HSTS

Destination:
Protocol: HTTP
Hostname: localhost
Port: 8345

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

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

ERPNext 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 erpnext. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

ERPNext Synology NAS Set up 6

  • STEP 11

Now create six new folders inside the erpnext folder that you created at STEP 10 and name them db, logs, redis-cache, redis-queue, redis-socketio, sites. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

ERPNext Synology NAS Set up 7

  • STEP 12

Download (click on the blue link below) then upload the common_site_config.json file below in the site folder that you have previously created at STEP 10. 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!

👉🏻common_site_config.json

ERPNext Synology NAS Set up 8

  • STEP 13

Right click on the erpnext folder that you have previously created at STEP 12 then click Properties. Follow the instructions in the image below.

ERPNext Synology NAS Set up 9

  • STEP 14

Go to the Permission tab then click Advanced options. From the drop-down menu choose “Make inherited permissions explicit“. Follow the instructions in the image below.

ERPNext Synology NAS Set up 10

  • STEP 15

Select Everyone then click the Edit tab. Follow the instructions in the image below.

ERPNext Synology NAS Set up 11

  • STEP 16

Check all Read and Write Permissions. Click Done. Follow the instructions in the image below.

ERPNext Synology NAS Set up 12

  • STEP 17

After you click Done on STEP 16, check “Apply to this folder, sub-folders and files“. Click Save. Follow the instructions in the image below.

ERPNext Synology NAS Set up 13

  • STEP 18

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 19

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

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

version: "3.9"
services:
  redis-queue:
    image: redis
    container_name: ERPNext-REDIS-QUEUE
    hostname: redis-queue
    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/erpnext/redis-queue:/data:rw
      - /etc/localtime:/etc/localtime:ro
    restart: on-failure:5

  redis-cache:
    image: redis
    container_name: ERPNext-REDIS-CACHE
    hostname: redis-cache
    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/erpnext/redis-cache:/data:rw
      - /etc/localtime:/etc/localtime:ro
    restart: on-failure:5

  redis-socketio:
    image: redis
    container_name: ERPNext-REDIS-SOCKETIO
    hostname: redis-socketio
    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/erpnext/redis-socketio:/data:rw
      - /etc/localtime:/etc/localtime:ro
    restart: on-failure:5

  db:
    image: mariadb:10.8-jammy
    command:
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_unicode_ci
      - --skip-character-set-client-handshake
    container_name: ERPNext-DB
    hostname: erpnext-db
    mem_limit: 1g
    cpu_shares: 768
    security_opt:
      - no-new-privileges:true
    user: 1026:100
    healthcheck:
      test: ["CMD-SHELL", "mysqladmin ping -u root -prootpass | grep 'mysqld is alive' || exit 1"]
    volumes:
      - /volume1/docker/erpnext/db:/var/lib/mysql:rw
      - /etc/localtime:/etc/localtime:ro
    environment:
      MYSQL_ROOT_PASSWORD: rootpass
    restart: on-failure:5

  configurator:
    image: frappe/erpnext:v15.19.2
    entrypoint:
      - bash
      - -c
    command:
      - >
        ls -1 apps > sites/apps.txt;
        bench set-config -g db_host erpnext-db;
        bench set-config -gp db_port 3306;
        bench set-config -g redis_cache "redis://redis-cache";
        bench set-config -g redis_queue "redis://redis-queue";
        bench set-config -g redis_socketio "redis://redis-socketio";
        bench set-config -gp socketio_port 9000;
    container_name: ERPNext-CONFIGURATOR
    hostname: configurator
    cpu_shares: 768
    security_opt:
      - no-new-privileges:true
    volumes:
      - /volume1/docker/erpnext/sites:/home/frappe/frappe-bench/sites:rw
      - /volume1/docker/erpnext/logs:/home/frappe/frappe-bench/logs:rw
      - /etc/localtime:/etc/localtime:ro
    environment:
      DB_HOST: erpnext-db
      DB_PORT: 3306
      REDIS_CACHE: redis-cache
      REDIS_QUEUE: redis-queue
      REDIS_SOCKETIO: redis-socketio
      SOCKETIO_PORT: 9000
    restart: "no"
    depends_on:
      redis-queue:
        condition: service_healthy
      redis-cache:
        condition: service_healthy
      redis-socketio:
        condition: service_healthy
      db:
        condition: service_healthy

  backend:
    image: frappe/erpnext:v15.19.2
    container_name: ERPNext-BACKEND
    hostname: backend
    mem_limit: 1g
    cpu_shares: 768
    security_opt:
      - no-new-privileges:true
    volumes:
      - /volume1/docker/erpnext/sites:/home/frappe/frappe-bench/sites:rw
      - /volume1/docker/erpnext/logs:/home/frappe/frappe-bench/logs:rw
      - /etc/localtime:/etc/localtime:ro
    restart: on-failure:5
    depends_on:
      configurator:
        condition: service_completed_successfully

  websocket:
    image: frappe/erpnext:v15.19.2
    command:
      - node
      - /home/frappe/frappe-bench/apps/frappe/socketio.js
    container_name: ERPNext-WEBOSCKET
    hostname: websocket
    mem_limit: 1g
    cpu_shares: 768
    security_opt:
      - no-new-privileges:true
    volumes:
      - /volume1/docker/erpnext/sites:/home/frappe/frappe-bench/sites:rw
      - /volume1/docker/erpnext/logs:/home/frappe/frappe-bench/logs:rw
      - /etc/localtime:/etc/localtime:ro
    restart: on-failure:5
    depends_on:
      configurator:
        condition: service_completed_successfully

  create-site:
    image: frappe/erpnext:v15.19.2
    entrypoint:
      - bash
      - -c
    command:
      - >
        wait-for-it -t 480 erpnext-db:3306;
        wait-for-it -t 480 redis-cache:6379;
        wait-for-it -t 480 redis-queue:6379;
        wait-for-it -t 480 redis-socketio:6379;
        export start=`date +%s`;
        until [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".db_host // empty"` ]] && \
          [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_cache // empty"` ]] && \
          [[ -n `grep -hs ^ sites/common_site_config.json | jq -r ".redis_queue // empty"` ]];
        do
          echo "Waiting for sites/common_site_config.json to be created";
          sleep 5;
          if (( `date +%s`-start > 120 )); then
            echo "could not find sites/common_site_config.json with required keys";
            exit 1
          fi
        done;
        echo "sites/common_site_config.json found";
        bench new-site Frappe --no-mariadb-socket --mariadb-root-password=rootpass --admin-password=admin --install-app=erpnext --set-default;
    container_name: ERPNext-CREATE-SITE
    hostname: create-site
    security_opt:
      - no-new-privileges:true
    volumes:
      - /volume1/docker/erpnext/sites:/home/frappe/frappe-bench/sites:rw
      - /volume1/docker/erpnext/logs:/home/frappe/frappe-bench/logs:rw
      - /etc/localtime:/etc/localtime:ro
    restart: "no"
    depends_on:
      configurator:
        condition: service_completed_successfully

  queue-default:
    image: frappe/erpnext:v15.19.2
    command: bench worker --queue default
    container_name: ERPNext-QUEUE-DEFAULT
    hostname: queue-default
    mem_limit: 1g
    cpu_shares: 768
    security_opt:
      - no-new-privileges:true
    volumes:
      - /volume1/docker/erpnext/sites:/home/frappe/frappe-bench/sites:rw
      - /volume1/docker/erpnext/logs:/home/frappe/frappe-bench/logs:rw
      - /etc/localtime:/etc/localtime:ro
    restart: on-failure:5
    depends_on:
      configurator:
        condition: service_completed_successfully
 
  queue-long:
    image: frappe/erpnext:v15.19.2
    command: bench worker --queue long
    container_name: ERPNext-QUEUE-LONG
    hostname: queue-long
    mem_limit: 1g
    cpu_shares: 768
    security_opt:
      - no-new-privileges:true
    volumes:
      - /volume1/docker/erpnext/sites:/home/frappe/frappe-bench/sites:rw
      - /volume1/docker/erpnext/logs:/home/frappe/frappe-bench/logs:rw
      - /etc/localtime:/etc/localtime:ro
    restart: on-failure:5
    depends_on:
      configurator:
        condition: service_completed_successfully
 
  queue-short:
    image: frappe/erpnext:v15.19.2
    command: bench worker --queue short
    container_name: ERPNext-QUEUE-SHORT
    hostname: queue-short
    mem_limit: 1g
    cpu_shares: 768
    security_opt:
      - no-new-privileges:true
    volumes:
      - /volume1/docker/erpnext/sites:/home/frappe/frappe-bench/sites:rw
      - /volume1/docker/erpnext/logs:/home/frappe/frappe-bench/logs:rw
      - /etc/localtime:/etc/localtime:ro
    restart: on-failure:5
    depends_on:
      configurator:
        condition: service_completed_successfully
 
  scheduler:
    image: frappe/erpnext:v15.19.2
    command: bench schedule
    container_name: ERPNext-SCHEDULER
    hostname: scheduler
    mem_limit: 1g
    cpu_shares: 768
    security_opt:
      - no-new-privileges:true
    volumes:
      - /volume1/docker/erpnext/sites:/home/frappe/frappe-bench/sites:rw
      - /volume1/docker/erpnext/logs:/home/frappe/frappe-bench/logs:rw
      - /etc/localtime:/etc/localtime:ro
    restart: on-failure:5
    depends_on:
      configurator:
        condition: service_completed_successfully

  frontend:
    image: frappe/erpnext:v15.19.2
    command:
      - nginx-entrypoint.sh
    container_name: ERPNext-FRONTEND
    hostname: frontend
    mem_limit: 1g
    cpu_shares: 768
    security_opt:
      - no-new-privileges:true
    ports:
      - 8345:8080
    volumes:
      - /volume1/docker/erpnext/sites:/home/frappe/frappe-bench/sites:rw
      - /volume1/docker/erpnext/logs:/home/frappe/frappe-bench/logs:rw
      - /etc/localtime:/etc/localtime:ro
    environment:
      BACKEND: backend:8000
      FRAPPE_SITE_NAME_HEADER: Frappe
      SOCKETIO: websocket:9000
      UPSTREAM_REAL_IP_ADDRESS: 127.0.0.1
      UPSTREAM_REAL_IP_HEADER: X-Forwarded-For
      UPSTREAM_REAL_IP_RECURSIVE: "off"
      PROXY_READ_TIMOUT: 120
      CLIENT_MAX_BODY_SIZE: 50m
    restart: on-failure:5
    depends_on:
      backend:
        condition: service_started
      websocket:
        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.

ERPNext Synology NAS Set up 14 new 2023

  • STEP 20

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.

ERPNext Synology NAS Set up 15 new 2023

  • STEP 21

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

ERPNext Synology NAS Set up 16

  • STEP 22

Please wait approximately 10-15 minutes for the installation to be completed. Once the installation is completed, you will see the ERPNext-CONFIGURATOR and ERPNext-CREATE-SITE containers with the status “exited“. Note: At first, you will only see the ERPNext-CONFIGURATOR container with the status exited. You need to wait too see the ERPNext-CREATE-SITE container with the exited status as well. Follow the instructions in the screenshot below. Go to the next STEP.

ERPNext Synology NAS Set up 24 new 2023

  • STEP 23

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

  • STEP 24

Please wait approximately 1 minute for the installation to be completed or you will get a blank page if you try to connect too soon. Now open your browser and type in your HTTPS/SSL certificate like this https://erpnext.yourname.synology.me In my case it’s https://erpnext.mariushosting.synology.me If everything goes right, you will see the ERPNext Login Page. Type in the default Username and Password then click Login. Follow the instructions in the image below.

⚠️Warning: the default username is Administrator and the default password is admin

ERPNext Synology NAS Set up 17 new2 2024

  • STEP 25

Choose your own Language, Country, Time Zone and Currency then click Next. Follow the instructions in the image below.

ERPNext Synology NAS Set up 18 new2 2024

  • STEP 26

Type in your Full Name, Email and your own Password then click Next. Follow the instructions in the image below.

ERPNext Synology NAS Set up 19 new2 2024

  • STEP 27

Wait some minutes.

ERPNext Synology NAS Set up 20 new2 2024

STEP 28

Again like STEP 25, choose your own Language, Country, Time Zone and Currency then click Next. Follow the instructions in the image below.

ERPNext Synology NAS Set up 21 new2 2024

  • STEP 29

Click Next. Follow the instructions in the image below.

ERPNext Synology NAS Set up 22 new2 2024

  • STEP 30

Type in your Full Name then click Next. Follow the instructions in the image below.

ERPNext Synology NAS Set up 23 new2 2024

  • STEP 31

Type in your own Company name and select the Financial year begins then click Complete Setup. Follow the instructions in the image below.

ERPNext Synology NAS Set up 24 new2 2024

  • STEP 32

Your ERPNext Dashboard at a glance!

ERPNext Synology NAS Set up 25 new2 2024

  • STEP 33

At the top right of the page you can click Toggle Theme to change your theme to Dark Mode. Follow the instructions in the image below.

ERPNext Synology NAS Set up 26 new2 2024

Enjoy ERPNext!

Take a look at the ERPNext Full Documentation.

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