IPFS, the “InterPlanetary File System” is a interesting new protocol for hosting files online in a distributed topology that’s resistant against the natural churn of data being lost, blocked or deleted over time. Ipfs-go v0.4.7 is available on the FreeNAS 11 although this is not exposed in the Web UI. This allows you to view and pin IPFS content using your NAS storage.
This guide is on how to configure and run IPFS on FreeNAS to serve files to the IPFS network and provide a HTTP gateway to local network users.
Create IPFS dataset
Create a dataset for the ipfs data, in my case I chose tank/ipfs mounted at /mnt/tank/ipfs then initialise it for use by ipfs-go.
[root@freenas]# zfs create tank/ipfs [root@freenas]# export IPFS_PATH=/mnt/tank/ipfs [root@freenas]# ipfs-go init
Configure daemon start at boot
Create two tunables with the following settings:
variable=ipfs_go_enable value=YES type=rc.conf variable=ipfs_go_path value=/mnt/tank/ipfs type=rc.conf
Configure IPFS to be network reachable
By default IPFS will be accessible only to the local machine, as a server we want FreeNAS to serve other machines on the network, to allow this we need to edit the config file.
Edit /mnt/tank/ipfs/config and find the following lines:
"API": "/ip4/127.0.0.1/tcp/5001", "Gateway": "/ip4/127.0.0.1/tcp/8080"
Change to read:
"API": "/ip4/0.0.0.0/tcp/5001", "Gateway": "/ip4/0.0.0.0/tcp/8080"
Start and test IPFS
IPFS will already work from the CLI but as a lot of IPFS content is static web sites we want to run the daemon to present that over HTTP.
[root@freenas# service ipfs-go start
You should see the built-in readme file indicating that the system is working.
During early testing I have found the ipfs-go daemon to be somewhat unstable and sometimes needing a restart. I have not yet found the cause or any fix for this yet.
There is a Web UI at http://freenas:5001/webui/ that is supposed to show the status of connections to peers but this is broken on my system showing pages with no peer data.