Syncthing is decentralized file synchronization tool. Key difference between services like Dropbox is, that data never leaves your network, unless you explicitly configure it to do so.
pros:
- free and open source
- flexible
- more control over your data
cons:
- require setup and maintenance
There can be many usecases for syncthing. For example:
- Synchronize media among devices. For example accessing phone photos. Or removing phone files from another device.
- Copying files from camera’s SD and making it available for everyone
- Mirroring dot files. If you have similar environment across few devices, you can keep them aligned by synchronizing configuration.
- Backup with versioning
- Version control for those who refuse to use git
- Migrating data from one device to another
- Keeping Obsidian/Logseq notes in sync
- etc
I have not found helm chart for that, but deployment is not super complicated. Let’s start with pvc:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: syncthing-pv-claim
labels:
app: syncthing
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Gi
then deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: syncthing
labels:
app: syncthing
spec:
replicas: 1
selector:
matchLabels:
app: syncthing
strategy:
type: Recreate
template:
metadata:
labels:
app: syncthing
spec:
nodeSelector:
containers:
- image: syncthing/syncthing:1.28
name: syncthing
resources:
limits:
memory: "256Mi"
cpu: "500m"
ports:
- containerPort: 8384
name: syncthing
protocol: TCP
- containerPort: 22000
protocol: TCP
name: to-listen
- containerPort: 22000
protocol: UDP
name: to-discover
volumeMounts:
- name: syncthing-persistent-storage
mountPath: /var/syncthing
volumes:
- name: syncthing-persistent-storage
persistentVolumeClaim:
claimName: syncthing-pv-claim
and the service
apiVersion: v1
kind: Service
metadata:
name: syncthing-service
labels:
app: syncthing
spec:
ports:
- name: http
port: 32080
targetPort: 8384
protocol: TCP
- protocol: TCP
port: 32000
targetPort: 22000
name: to-listen
- protocol: UDP
port: 32000
targetPort: 22000
name: to-discover
selector:
app: syncthing
type: NodePort
Now we can access the UI using http port.
We can split the configuration into two parts: Folders and Devices.
Folder can be shared across many devices. It can work in three modes:
- send only
- receive only
- send and receive
It is quite important to choose correct option for your usecase. More advanced options are ignore patterns and file versioning.
To finish basic configuration, add another device to the setup. Easiest would be install it on your phone. If you are using android, I would recommend this build: https://f-droid.org/pl/packages/com.nutomic.syncthingandroid/ . Unfortunately, recently it was removed from Google Play. The problem was with permissions. Tools like syncthing makes most sense when they have wide filesystem access. You could easly create backups of the whole device – if you know what you are doing. But Google decided that users should not give that kind of permissions to any application. When creating a folder using android app, you have a restriction what to share. For example, you can share Camera folder, but not Dowloads. But there is a hack for that. That restriction is enforced only by the “Folder picker” – gui element of the android. You can open WebUI, and edit existing folder, and share everything from your phone, by changing “DCIM/Camera” to something like “/storage/emulatd/0/DCIM”.
I understand the general idea standing behind “protecting privacy”. I can imagine someone wiping their phone by an accident. But enforcing this for power users is annoying.
Leave a Reply