Syncthing: Difference between revisions

Onny (talk | contribs)
m Cleanup
Onny (talk | contribs)
Cleanup
Line 4: Line 4:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
services.syncthing.enable = true;
services.syncthing = {
  enable = true;
  settings.gui = {
    user = "myuser";
    password = "mypassword";
  };
};
</syntaxhighlight>
</syntaxhighlight>


You can confirm Syncthing runs by visiting http://127.0.0.1:8384/ .
You can confirm Syncthing runs by visiting http://127.0.0.1:8384/ and authenticate using the credentials above.


== Configuration ==
Follow the official ''[https://docs.syncthing.net/intro/getting-started.html Getting Started]'' guide to get started.
Follow the official ''[https://docs.syncthing.net/intro/getting-started.html Getting Started]'' guide to get started.


== Configuration ==
Note: using a declarative configuration will overwrite files in <code>configDir</code>.
Note: using a declarative configuration will overwrite files in <code>configDir</code>.


Line 72: Line 78:


Syncthing uses port 22000 to facilitate discovery of nodes on the local area network. If this port is blocked by the firewall, nodes will have to go all the way to the announce servers, then use a bridge to tunnel through NAT. This is much slower than just sending data in a "node1 -> router -> node2" path.
Syncthing uses port 22000 to facilitate discovery of nodes on the local area network. If this port is blocked by the firewall, nodes will have to go all the way to the announce servers, then use a bridge to tunnel through NAT. This is much slower than just sending data in a "node1 -> router -> node2" path.
=== Web GUI ===
If running a headless server, you should also change guiAddress to a publicly visible one (or just 0.0.0.0:8384, for example).
It is also a good idea to protect the web GUI with a username and password:
<syntaxHighlight lang="nix">
services.syncthing.settings.gui = {
    user = "username";
    password = "password";
};
</syntaxHighlight>
Alternatively, you can leave the GUI inaccessible from the web and forward it using SSH:
<syntaxhighlight lang="bash">$ ssh -L 9998:localhost:8384 user@syncthing-host</syntaxhighlight>Then open up [http://127.0.0.1:9998 127.0.0.1:9998] to administer the node.


=== Declarative node IDs ===
=== Declarative node IDs ===