Nowadays everything is apparently in the cloud. However the cloud comes in many different sizes and shapes. In my case primarily in the form of dropbox. However there are always downsides of “out sourcing” your data to an undefined cloud. Some popular alternatives include BitTorrent Sync (not open source and your data is still touched by a third party), ownCloud (an open source dropbox clone, however the performance on a Raspberry Pi is not very smooth) and since December 2013 Syncthing. The last one is a kind of open source implementation of BitTorrent Sync, so in contrast to Dropbox your data is distributed over your own computers and not at a distant server. In my setup I use a headless Raspberry Pi that is tucked a way in a cupboard as a node in the network, so this client is always online.
In this setup I’ve installed one Syncthing client on my Mac and one Syncthing client on my Raspberry Pi. The installation for Mac/Windows is very straightforward and just consist of downloading the right executable. After running your browser fires up and opens http://127.0.0.1:8080/ where you see the configuration and status overview.Next ssh into your Rapsberry Pi and download the armv5 version of syncthing (check the latest release here)
tar xvzf syncthing-linux-armv5-v0.8.7.tar.gz
And just run the executable. Note that the generation of the RSA certificate took almost 4 minutes!
pi@ERP ~/syncthing-linux-armv5-v0.8.7 $ ./syncthing 16:05:13 INFO: Generating RSA certificate and key... 16:08:55 OK: Created RSA certificate file 16:08:55 OK: Created RSA key file [RPMIJ] 16:09:14 INFO: syncthing v0.8.7 (go1.2.2 linux-arm) jb@jborg-mbp 2014-05-16 14:28:52 UTC [RPMIJ] 16:09:14 INFO: My ID: PRNIJ4CTJGG5VWZXLNPILFYA65EHKWSDDSJCATOVYT4YVMQVWVAQ [RPMIJ] 16:09:14 INFO: No config file; starting with empty defaults [RPMIJ] 16:09:14 INFO: Edit /home/pi/.config/syncthing/config.xml to taste or use the GUI [RPMIJ] 16:09:14 INFO: Starting web GUI on http://127.0.0.1:8080/ [RPMIJ] 16:09:15 INFO: Populating repository index [RPMIJ] 16:09:18 INFO: No UPnP IGD device found, no port mapping created (read udp4 0.0.0.0:53385: i/o timeout) [RPMIJ] 16:09:18 INFO: Sending local discovery announcements [RPMIJ] 16:09:18 INFO: Sending global discovery announcements [RPMIJ] 16:09:18 OK: Ready to synchronize default (read-write)
The important piece of information is the unique ID: PRNIJ4CTJGG5VWZXLNPILFYA65EHKWSDDSJCATOVYT4YVMQVWVAQNow quickly switch back to you own computer and configure the client. Go to
http://127.0.0.1:8080/ and click on “Add a node”.
Paste the Node ID of the Raspberry Pi into the corresponding field, in this case
PRNIJ4CTJGG5VWZXLNPILFYA65EHKWSDDSJCATOVYT4YVMQVWVAQThen a new Peer node shows up that almost looks like this (without the In Sync part). Click on the Edit button of the Default repository and check the box in front of Raspberry Pi (or whatever name you gave to the node you just added). Now your computer is fully configured. Switch back to your Raspberry Pi and edit the config file. We are now making the same adjustment as we did before in the GUI but now in the config.xml file.
Add the Node ID of your own computer to the repository and node list sections
<repository id=”default” directory=”/home/pi/Sync” ro=”false”> <node id=”PRNIJ4CTJGG5VWZXLNPILFYA65EHKWSDDSJCATOVYT4YVMQVWVAQ”></node> <node id=”Insert the node ID of your computer (so not your Raspberry Pi) here”></node> </repository>
<node id=”Insert the node ID of your computer (so not your Raspberry Pi) here” name=”Your computer name”> <address>dynamic</address> </node>
Save the file.
Now edit the rc.local file to startup syncthing at boottime.
sudo nano /etc/rc.local
And add the line
Now every file you place in ~/Sync is synced to the other nodes in the network. Remeber to run syncthing -upgrade from time to time, since every week a new version is released with bug fixes.Happy Synching!