paint-brush
Elevate Your Synology NAS to Interplanetary Heightsby@jenksguo
796 reads
796 reads

Elevate Your Synology NAS to Interplanetary Heights

by Jenks GuoJune 16th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Discover how to install an IPFS node on your Synology NAS and create your personal decentralized storage node.
featured image - Elevate Your Synology NAS to Interplanetary Heights
Jenks Guo HackerNoon profile picture

Discover how to install an IPFS node on your Synology NAS and create your personal decentralized storage node.


Synology NAS home servers remain one of the most cost-effective and efficient solutions for addressing a variety of data storage and file sharing needs in many households. From media streaming and office collaboration to home automation, surveillance, and even remote access, a private cloud storage service can accomplish a great deal.


While Synology offers its proprietary file system and backup system, the Interplanetary File System (IPFS) presents a resilient, decentralized file storage network designed to withstand challenges at the protocol level. Implementing IPFS on your Synology NAS can provide an excellent solution for storing public or encrypted personal data. This article will guide you through the process of setting up IPFS on your Synology NAS device using Docker.

Pre-requisites

To follow this tutorial, you will need

  • A Synology NAS server with Disk Station Manager  (any capacity)
  • A Wi-Fi router (with admin access)
  • A device to access the router and Synology admin page (laptop, PC, tablet or phone)


Here is my setup:

  • Synology DS920
  • 4x Seagate Ironwolf NAS HDD 8TB (RAID5 24TB)
  • Netgear Orbi Mesh Wi-Fi Router
  • MacBook Pro

My disk RAID configuration is RAID5, which allows one out of the four disks to fail without causing data losses. This configuration reduces my effective storage space to 24TB. Synology's site offers a handy RAID calculator for reference.

Setting up IPFS on Synology NAS

The Synology system operates like a mini server, but its system isn’t entirely open. This means you cannot install any open source software you like. However, using DiskStation’s Package Centre to install a docker container to run IPFS. Here’s how:

Step 1 - Access your Synology DSM

You should know how to access Synology NAS Synology DiskStation Manager (DSM). If not, follow this guide to access. I am accessing my DSM using quickconnect.to port forwarding service offered by Synology.

Login page of my Synology DS920 DSM


Step 2 - Open your Package Center and search for “Docker” and click “Install”.


Step 3 - Open Docker app, go to “Registry” and find “ipfs/kubo”, leave the tag as “latest” and click “Select” to install IPFS node software.

Step 4 - Go to “Image”, you should see “ipfs/kubo:latest” image in the list of images.

In “Network” page, leave network as “bridge”, click on “Next”:

You will find more settings on the next page, such as system resources allocation or auto-restart in case of failure. Click on “Next”.

In the “Port Settings” page, assign memorable ports to allow the webui to work reliably. I simply added 1 to the first two digits of all the container ports numbers as shown in the screenshot below.


Local Port - Container Port - Type

  • 5101 - 4001 - TCP
  • 5101 - 4001 - UDP
  • 6101 - 5001 - TCP
  • 9180 - 8080 - TCP
  • 9181 - 8081 - TCP


I chose not to map any volume to it and left it as default on the next page.

Now create the container by clicking “Done” on the next page.

Returning to the “Container” section, you should see “ipfs-kubo1” running.


Congratulations! You now have IPFS running on your Synology home server. Double click on the running container to see the details. You'll notice port 49159 is assigned to kubo’s webui port 5001.

In the next step, we'll figure out how to access the webui so you can upload a file.


Step 5 - Access IPFS WebUI.

To access the webui of IPFS, we will need to visit “https://<your-synology-server-subnet-address>:<docker-assigned-port-for-5001>/webui”. So you will need to find out which address in your home router your synology is running on first. Mine is running on “192.168.1.44” so to visit the webui, I will need to visit “https://192.168.1.44:6101/webui”.


Upon loading, you might notice an error. The webui page is experiencing CORS issues when making API calls. We need to configure the IPFS daemon to accept CORS API calls from sources other than localhost or 127.0.0.1.

Due to Docker's limitations on Synology DSM, this requires a bit of a workaround. First, copy the first command from step two of the webui home page, starting with ipfs config --json API.


HTTPHeaders. Access-Control-Allow-Origin '[http://192.168.1.44:49159", "http://localhost:3000", "http://127.0.0.1…. Go to “Terminal” in the ipfs-kubo1 settings page, click on the down arrow and select “Launch with command”.

Paste in the command and click “OK” to start the new command line window.

The main terminal isn't responsive to our commands due to some issues. However, using this function, we can execute CLI commands one at a time.


Repeat the same process for the second command ipfs config --json API. HTTPHeaders. Access-Control-Allow-Methods '["PUT", "POST"]'.

Now, return to the home page and restart the container.


If we revisit our Synology URL against the port that the webui is expected to run on, we should be able to use the webui without issues. Go ahead and upload your first file on your private IPFS node!

Keep it Secure

What we've just done is to allow anyone on our router to access our IPFS instance. Without any port forwarding, external users should not be able to access it. However, this is not an ideal approach.


Unfortunately, Kubo does not come with a token or login system, so it might be better if you implement a login page or key pair for IPFS instance’s access control. A Synology SSO client might be able to help.


You should also consider enforcing SSL certificates and firewall rules before exposing your IPFS instance publicly.

Benefits of using IPFS on Synology NAS

Low resource consumption:  Synology is designed for long-term, efficient operation. Kubo consumes very little system resources.

Decentralized and owned by the user: By running it on your Synology, you contribute to the decentralization of the IPFS network. It's also beneficial to have your IPFS node up and running all the time to persist your file and help others access the network.


Scalability and reliability, persists data: In addition to your PC, laptops, and perhaps Raspberry Pi, Synology provides another place to host your precious data, making it hard to lose.

Conclusion

Running your private IPFS on Synology home servers using the Docker app provided by its DSM is a fantastic idea. In just a few minutes, you can set it up and get it running. However, securing your instance requires some additional work. Please feel free to reach out to me if you have discovered a good idea on this.