Table des matières

Notes Syncthing

Voir :

Voir aussi :

apt-get update
apt-get install syncthing
 
adduser --group --system syncthing --home /usr/local/var/lib/syncthing

Sur A

syncthing --device-id

Sur B

syncthing --device-id

Sur A

syncthing cli config devices add --device-id $DEVICE_ID_B

Sur B

syncthing cli config devices add --device-id $DEVICE_ID_A
#syncthing cli config folders $FOLDER_ID devices add --device-id $DEVICE_ID_B

Sur A

mkdir ~/DATA_SYNCALL
 
fid=$(uuidgen)
fid=${fid%%-*}
# syncthing cli config folders add --id $fid --label "DATA_SYNCALL" --path /data/syncall/
syncthing cli config folders add --id $fid --label "DATA_SYNCALL" --path ~/DATA_SYNCALL
 
syncthing cli config folders $fid devices add --device-id $DEVICE_ID_B
 
syncthing cli config folders list

Sur B

syncthing cli config folders list
#syncthing cli config devices $DEVICE_ID_A auto-accept-folders set true
 
syncthing cli show pending folders
##syncthing cli config folders add --label DATA_SYNCALL  devices add --device-id $DEVICE_ID_A
 
syncthing cli config folders $FOLDER_ID devices add --device-id $DEVICE_ID_A

Service

Service SystemD Lingering

Source : https://github.com/syncthing/syncthing/blob/main/etc/linux-systemd/user/syncthing.service

~/.config/systemd/user/syncthing.service

[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
StartLimitIntervalSec=60
StartLimitBurst=4
 
[Service]
ExecStart=/usr/bin/syncthing serve --no-browser --no-restart --logflags=0
Restart=on-failure
RestartSec=1
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
 
# Hardening
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true
 
# Elevated permissions to sync ownership (disabled by default),
# see https://docs.syncthing.net/advanced/folder-sync-ownership
#AmbientCapabilities=CAP_CHOWN CAP_FOWNER
 
[Install]
WantedBy=default.target

Autres

[ZUPOI] 13:18:34 INFO: TCP listener ([::]:22000) starting
2024/10/01 13:18:34 connection doesn't allow setting of receive buffer size. Not a *net.UDPConn?. See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details.
[ZUPOI] 13:18:34 INFO: QUIC listener ([::]:22000) starting

/etc/sysctl.d/80-net-core-xmem_max.conf

# Bump maximum receive buffer size to roughly 7.5 MB for Syncthing - as per
# https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size
net.core.rmem_max=7500000
net.core.wmem_max=7500000
 
#fs.inotify.max_user_watches=409600

Activer inotify

curl –s http://ipduserveur:port/rest/system | json_pp
{
"alloc": 32147752, # allocated memory, in use "cpuPercent": 0.669829340548344,
"extAnnounceOK": true, # true if we are registered with the global announce server, false on failure, absent if disabled "goroutines": 34,
"myID": "P56IOI7MZJNU2IQGDREYDM2MGTMGL3BXNPQ6W5BTBBZ4TJXZWICQ",
"sys": 66463976 # allocated memory, total
}

Source : https://www.it-connect.fr/installation-et-configuration-de-syncthing/

Dans la web UI (127.0.0.1:8384) → menu Actions → Configuration → Connexions → décocher “Découverte globale” et cocher “Découverte locale”

Ensuite, pour chaque appareil, vérifier dans → Gérer → Avancé → Adresses = “dynamic”

~/.config/syncthing/config.xml and find relaysEnabled. Set its value false.

<!-- Changer à false -->
<relaysEnabled>false</relaysEnabled>
<globalAnnounceEnabled>false</globalAnnounceEnabled>
<crashReportingEnabled>false</crashReportingEnabled>
<crashReportingEnabled>false</crashReportingEnabled>
<startBrowser>false</startBrowser>
<natEnabled>false</natEnabled>
 
<!-- Supprimer -->
<urURL>https://data.syncthing.net/newdata</urURL>
<releasesURL>https://upgrades.syncthing.net/meta.json</releasesURL>
<crashReportingURL>https://crash.syncthing.net/newcrash</crashReportingURL>
 
<!-- Changer partout "10" à "1" -->
fsWatcherDelayS="1"
 
<!-- Changer gui enabled à "false" -->
<gui enabled="false" tls="false" debugging="false">
env GOMAXPROCS=2 syncthing -no-browser
find /path/to/folder/to/force/sync -type f -print0 | xargs -0 -n1 touch

Ignore

.stignore

.git/