Syncthing: Difference between revisions
Note that ids are not sensitive |
m style fixes |
||
| (5 intermediate revisions by 5 users not shown) | |||
| Line 7: | Line 7: | ||
To temporarily use Syncthing in a shell environment without modifying your system configuration, you can run: | To temporarily use Syncthing in a shell environment without modifying your system configuration, you can run: | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="console"> | ||
nix-shell -p syncthing --run syncthing | $ nix-shell -p syncthing --run syncthing | ||
</syntaxhighlight> | </syntaxhighlight> | ||
This provides Syncthing in your current shell without adding it to your system configuration. You can open the web interface at http://127.0.0.1:8384/ to configure and use it. | This provides Syncthing in your current shell without adding it to your system configuration. You can open the web interface at http://127.0.0.1:8384/ to configure and use it. | ||
| Line 22: | Line 22: | ||
Once you've rebuilt your system, Syncthing will be available as a system service. You can visit http://127.0.0.1:8384/ to configure it through the web interface. | Once you've rebuilt your system, Syncthing will be available as a system service. You can visit http://127.0.0.1:8384/ to configure it through the web interface. | ||
If accessing the web interface from other networked computers you will need to open a | If accessing the web interface from other networked computers you will need to change the gui bind address and open a TCP port:<syntaxhighlight lang="nix"> | ||
# Example for /etc/nixos/configuration.nix | |||
services.syncthing = { | |||
enable = true; | |||
openDefaultPorts = true; # Open ports in the firewall for Syncthing. (NOTE: this will not open syncthing gui port) | |||
guiAddress = "0.0.0.0:8384"; # By default syncthing only listens to localhost | |||
}; | |||
# port 8384 is the default port to allow access from the network. | # port 8384 is the default port to allow access from the network. | ||
networking.firewall.allowedTCPPorts = [ 8384 ]; | networking.firewall.allowedTCPPorts = [ 8384 ]; | ||
| Line 42: | Line 50: | ||
}; | }; | ||
}; | }; | ||
</syntaxhighlight>Note: If you want to use [[Agenix]] to set the GUI password use [https://search.nixos.org/options?channel=unstable&query=syncthing&show=services.syncthing.guiPasswordFile services.syncthing.guiPasswordFile] instead of setting.gui.password. | </syntaxhighlight>Note: If you want to use [[Agenix]] to set the GUI password, use [https://search.nixos.org/options?channel=unstable&query=syncthing&show=services.syncthing.guiPasswordFile services.syncthing.guiPasswordFile] instead of setting.gui.password. | ||
==== Advanced ==== | ==== Advanced ==== | ||
| Line 51: | Line 59: | ||
enable = true; | enable = true; | ||
openDefaultPorts = true; | openDefaultPorts = true; | ||
guiPasswordFile = "/etc/syncthing-gui-password"; | |||
settings = { | settings = { | ||
gui | gui.user = "myuser"; | ||
devices = { | devices = { | ||
"device1" = { id = "DEVICE-ID-GOES-HERE"; }; | "device1" = { id = "DEVICE-ID-GOES-HERE"; }; | ||
| Line 134: | Line 140: | ||
To generate a new key.cert and key.pem for a deployment, you can use the -generate argument: | To generate a new key.cert and key.pem for a deployment, you can use the -generate argument: | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="console"> | ||
$ nix-shell -p syncthing --run "syncthing generate -- | $ nix-shell -p syncthing --run "syncthing generate --home myconfig/" | ||
2024/04/23 11:41:17 INFO: Generating ECDSA key and certificate for syncthing... | 2024/04/23 11:41:17 INFO: Generating ECDSA key and certificate for syncthing... | ||
2024/04/23 11:41:17 INFO: Device ID: DMWVMM6-MKEQVB4-I4UZTRH-5A6E24O-XHQTL3K-AAI5R5L-MXNMUGX-QTGRHQ2 | 2024/04/23 11:41:17 INFO: Device ID: DMWVMM6-MKEQVB4-I4UZTRH-5A6E24O-XHQTL3K-AAI5R5L-MXNMUGX-QTGRHQ2 | ||
| Line 151: | Line 157: | ||
== Troubleshooting == | == Troubleshooting == | ||
=== Some settings not being applied === | |||
Note the [https://search.nixos.org/options?channel=unstable&show=services.syncthing.settings services.syncthing.settings] option accepts anything that can be parsed into JSON, even if it does not have a corresponding config option. Check the logs of the <code>syncthing-init</code> service with <code>systemctl status syncthing-init.service</code>to see if some settings are not being applied. | |||
== See also == | == See also == | ||