cmc/cleberg.net
My personal web garden & blog.
clone: git clone https://gitbay.org/cmc/cleberg.net.git
main: content/blog/2022-10-04-syncthing.org · raw
1#+date: [2022-10-04 Tue 00:00:00]
2#+title: Self-Hosting Guide: Syncthing
3#+description: How to set up Syncthing for private, peer-to-peer file sync.
4#+slug: syncthing
5#+filetags: :linux:self-hosting:
6
7* An Overview of Syncthing
8
9If you've been looking around the self-hosted cloud storage space for a while,
10you've undoubtedly run into someone suggesting [[https://syncthing.net][Syncthing]] as an option. However,
11it is an unusual alternative for those users out there who are used to having a
12centralized cloud server that serves as the "controller" of the data and
13interacts with clients on devices to fetch files.
14
15This post is a walkthrough of the Syncthing software, how I set up my personal
16storage, and some pros and cons of using the software.
17
18* Installing Syncthing
19
20To install Syncthing, visit the [[https://syncthing.net/downloads/][Downloads]] page or install via your device's
21package manager.
22
23** Server & Desktop
24
25You can install Syncthing on servers and desktops via the Downloads page linked
26above or via the command-line.
27
28For Debian-based distros:
29
30#+begin_src sh
31sudo apt install syncthing
32#+end_src
33
34For Fedora-based distros:
35
36#+begin_src sh
37sudo dnf install syncthing
38#+end_src
39
40** Mobile
41
42Syncthing for Android is available on [[https://f-droid.org/packages/com.nutomic.syncthingandroid/][F-Droid]] and [[https://play.google.com/store/apps/details?id=com.nutomic.syncthingandroid][Google Play]]. Syncthing does
43not have an official iOS client, but there is a third-party client called [[https://apps.apple.com/us/app/m%C3%B6bius-sync/id1539203216][Möbius
44Sync]].
45
46* How Does Syncthing Work?
47
48To start, I wanted to include the main marketing blurb from their website:
49
50#+begin_quote
51Syncthing is a continuous file synchronization program. It synchronizes
52files between two or more computers in real time, safely protected from
53prying eyes. Your data is your data alone, and you deserve to choose
54where it is stored, whether it is shared with some third party, and how
55it's transmitted over the internet.
56#+end_quote
57
58Let's break this apart and add in some other details to help explain what
59exactly Syncthing does in order to sync files between devices.
60
61** Local Syncthing Server(s)
62
63Syncthing syncs files between multiple devices by creating a local server on
64each device. These local servers handle a few different things, such as watching
65files and directories for changes, hosting an administrative GUI website, and
66authenticating with connected devices.
67
68You can also start, stop, and restart the Syncthing server via the command-line
69or web dashboard. If you're running Syncthing on a device with =systemd=, you
70can use the following commands:
71
72#+begin_src sh
73sudo systemctl start syncthing@username.service
74sudo systemctl restart syncthing@username.service
75sudo systemctl stop syncthing@username.service
76#+end_src
77
78** Syncthing Dashboard
79
80This biggest part of Syncthing is the admin GUI website that runs on each device
81(note that mobile devices will use the Syncthing app rather than the web GUI).
82The administrative graphical user interface (GUI) is available through the web
83browser on the local device that is running Syncthing - simply go to
84=http://localhost:8384= or =http://127.0.0.1:8384=. This web page is the place
85where you will change settings, add/modify synced files, and add/modify
86connected devices.
87
88Here's an example web GUI dashboard:
89
90#+caption: Syncthing Dashboard
91#+attr_html: :alt Syncthing web page on macOS, showing folders, device info, and remote devices.
92[[https://img.cleberg.net/blog/20221020-syncthing/syncthing_gui.webp]]
93
94** Remote Devices
95
96A cloud storage solution wouldn't be very useful if you aren't able to share
97data among various devices. Syncthing does this by sharing Device IDs to connect
98servers, and then by manually sharing Folders with devices that have been
99connected.
100
101For instance, if you have a laptop running Syncthing and then install the
102Syncthing mobile app on a phone, you could scan the laptop's QR (quick-response)
103code for Device ID and then accept the authentication on the laptop's dashboard.
104Next, you can use either device to select a folder for sharing and dictating
105which device should send, receive, or both.
106
107When you connect devices, you can set one device as an "Introducer," which can
108add devices from the introducer to the device list, for mutually shared folders.
109You can also configure Auto Accept, compression, rate limits, and more settings
110per device.
111
112* My Personal Cloud Storage Set-up
113
114Personally, I use a model similar to a traditional cloud storage service. I have
115a "centralized" server running 24/7 that acts as an Introducer for my Syncthing
116network. I think of this as my main storage and all other devices as tertiary
117client devices. I will likely add additional servers as backups as time goes on
118so that I don't have to rely on my laptop or phone as the only backups.
119
120Currently, I have one desktop and one mobile device connected to the network,
121both running intermittently as they are not powered-on 24/7.
122
123The initial set-up of the software was easy enough, but data transfer rates were
124incredibly slow for me due to the Wi-Fi. Instead, I plugged my laptop into the
125ethernet network that my server is on and manually copied my folders over to the
126server with =scp=. Once complete, Syncthing validated that all files were there
127and not missing, and it did not need to transfer any data through the WAN.
128
129As slow as the transfer was going, this probably saved me a few days of waiting
130for my ~100 gigabytes to sync.
131
132* Pros & Cons
133
134I've put together a short list of pros and cons for Syncthing. I thought about
135my experiences with Nextcloud, WebDAV, proprietary services (Google Drive,
136iCloud, etc.), and privacy-focused cloud solutions (pCloud, Tresorit, etc.).
137
138*Pros:*
139
140- I've faced no data loss at all through my two-month trial run.
141- No third-parties store your data on their servers.
142- You have full control over your data and can take your data and leave at any
143 time.
144- It's possible to encrypt client-side easily with software like Cryptomator.
145- No proprietary clients or mounted volumes, just plain files and folders.
146
147*Cons:*
148
149- The learning curve is steeper than traditional cloud services and is focused
150 on a technical audience.
151- If a device needs to modify files in a Folder, the devices will need to sync
152 ALL files from the folder, which may be large. To avoid size restraints, split
153 large folders into smaller folders for syncing.
154- Syncing can be slow due to the clients/servers initially connecting or
155 re-connecting after sleeping.
156- Multiple personal devices are required and require the user to own or rent
157 them as no third-party servers are involved in the storage of data.
158
159Overall, I've had a great experience with Syncthing so far. I've had no data
160loss, syncing has been quick and easy when changes are made to files, device
161connections are reliable, and I love the freedom of controlling the clients and
162servers as I choose.
163
164Not to mention that I appreciate that I - or someone else - could pull the
165Syncthing [[https://github.com/syncthing][source code]] and continue development/support if the Syncthing
166Foundation decides to stop developing the software or sells the business.