Outils pour utilisateurs

Outils du site


tech:notes_syncthing

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
tech:notes_syncthing [2025/04/16 14:36] Jean-Baptistetech:notes_syncthing [2025/09/13 16:35] (Version actuelle) Jean-Baptiste
Ligne 1: Ligne 1:
 +<!DOCTYPE markdown>
 +{{tag>Brouillon}}
 +
 +# Notes Syncthing
 +
 +Voir :
 +* https://domopi.eu/syncthing-un-outil-pour-synchroniser-vos-fichiers/
 +* https://wiki.archlinux.org/title/syncthing
 +* https://man.archlinux.org/man/syncthing-faq.7.en
 +* https://djan-gicquel.fr/IMG/pdf/syncthing_utilisation.pdf
 +* https://laboiteajb.fr/syncthing/
 +
 +Voir aussi :
 +* ''rclone bisync''
 +* **Ksync** qui utilise Syncthing pour synchroniser les containers (containers ou k8s)
 +
 +
 +~~~bash
 +apt-get update
 +apt-get install syncthing
 +
 +adduser --group --system syncthing --home /usr/local/var/lib/syncthing
 +~~~
 +
 +------
 +
 +Sur A
 +~~~bash
 +syncthing --device-id
 +~~~
 +
 +Sur B
 +~~~bash
 +syncthing --device-id
 +~~~
 +
 +Sur A
 +~~~bash
 +syncthing cli config devices add --device-id $DEVICE_ID_B
 +~~~
 +
 +Sur B
 +~~~bash
 +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
 +~~~bash
 +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
 +~~~bash
 +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''
 +~~~ini
 +[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''
 +~~~bash
 +# 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
 +
 +~~~bash
 +curl –s http://ipduserveur:port/rest/system | json_pp
 +~~~
 +
 +~~~javascript
 +{
 +"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''
 +
 +~~~xml
 +<!-- 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">
 +~~~
 +
 +~~~bash
 +env GOMAXPROCS=2 syncthing -no-browser
 +~~~
 +
 +~~~bash
 +find /path/to/folder/to/force/sync -type f -print0 | xargs -0 -n1 touch
 +~~~
 +
 +## Ignore
 +
 +''.stignore''
 +~~~
 +.git/
 +~~~
 +
 +
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki