Skip to content

Instantly share code, notes, and snippets.

@1ma
Created September 21, 2019 11:10
Show Gist options
  • Save 1ma/9cef5ba98b5a9dd29312d423cbf3228b to your computer and use it in GitHub Desktop.
Save 1ma/9cef5ba98b5a9dd29312d423cbf3228b to your computer and use it in GitHub Desktop.
Syncthing Notes

Syncthing

Architecture

Syncthing works in a decentralized manner, meaning you can simply install the software in all your devices and they will directly stream any changes in your shared folders between them.

However, if you usually only have one device open at a time it won't have anywhere to send the changes. For this reason it's practical to install the software in a server so that at least there's always one online node. This node can also be configured as an "introducer", meaning that every time you set up the software in a new device you just need to setup the server node, and it will automatically setup the rest for you.

Installation

Debian derivatives

The project maintains a PPA here with installation instructions, but in short:

curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
echo "deb https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
sudo apt-get update
sudo apt-get install syncthing

Post Installation

The software must be configured to start automatically on startup. On a recent Debian or Ubuntu this involves setting up a Systemd service.

cat > ~/.config/systemd/user/syncthing.service <<EOF
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)

[Service]
ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4

# Hardening
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true

[Install]
WantedBy=default.target
EOF

systemctl enable syncthing@$USER.service
systemctl start syncthing@$USER.service

Windows

TBD

Backup and Recovery

Configuration Backup

Backup everything under $HOME/.config/syncthing to preserve the identity of the node between full reinstalls.

Disaster recovery

What happens if you rm -rf ~ and how to recover from that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment