Draft! |
This page is a draft and This may be incomplete, incorrect, or just a
stub or outline. I've decided to allow myself to put draft pages on
my website as an experiment. I'm hoping they will:
|
I’m increasingly happy with Syncthing. It’s really well designed and it works like a charm.
I use it to keep a directory (/home/dave/sync
) synced across four computers (I have a work desktop, a fun desktop, a laptop, and a headless, fanless Celeron-based mini PC running FreeBSD). At any given moment, I can hop on one of the desktops or the laptop and start working out of my sync
directory. My files are kept magically in sync so that jumping between machines is almost completely seamless.
Running on startup
One of my "dotfiles" is .bash_profile
(the login shell script) which contains my neato Syncthing startup:
if /usr/bin/pgrep syncthing >/dev/null; then echo "Syncthing already started!" else echo "Starting Syncthing..." syncthing -no-browser 1>/dev/null 2>&1 & echo "Access Syncthing at http://127.0.0.1:8384" fi
So every time I log in, Syncthing is also started. There are other methods, but this works great across every Unix with Bash I’ve yet tried!
Headless usage
TODO: Running as user or as system-wide daemon.
(For now, I’ll just note that I run it as a user in Slackware (and a Debian instance on WSL!) via the script mentioned above and I run it as a system-wide daemon on a headless FreeBSD.)
Using web interface from headless machine
Unfortunately, there is (currently) no CLI for interacting with Syncthing. You gotta use the web interface (usually reachable at http://localhost:8384).
I had a real forehead-slapping moment today when I realized I could use SSH forwarding to view the web interface of my headless Syncthing instance. The hardest part of setting up SSH port forwarding is remembering the difference between "local" and "remote" forwarding and what the danged format(s) are for the forwarding argument(s).
In short, we want local port forwarding (meaning that I have a service on the remote machine and I want to forward a local port to the remote port). The CLI arguments take this form:
ssh <remote host> -L <local port>:<local address>:<remote port>
So to make the web interface listening on port 8384 on my headless machine ("phobos"), I use the following command:
$ ssh phobos -L 8666:localhost:8384
Note
|
I could normally have set the local port to 8384 to match the remote port, but in this case, I already have a local copy of Syncthing running on my local machine listening on port 8384! So I make the local forwarded port something different (8666 chosen arbitrarily). |
Now I can visit these two addresses:
-
http://localhost:8384/ - local Syncthing
-
http://localhost:8666/ - forwarded Syncthing running on headless computer "phobos"
So both instances can be used at the same time - incredibly convenient for pairing devices!
In fact, this is so much better than running all over the house (even for the machines that have monitors and keyboards), that I forwarded ports (incrementing local port number for each new connection) for all of the other computers when setting up the new headless machine - much more convenient to have all of the interfaces in separate browser tabs.
Manage a herd of machines
I haven’t done anything advanced yet at all. I’m not even sure what my options are yet. Right now, I painstakingly pair all of the machines together, but I believe there are ways to make certain machines "introduce" new computers to the group.
Check for conflict files
(Haven’t actually done this yet, but plan to. Will document my experience then. I see some occasionally.)
Slackware Linux Setup
TODO: I have notes for this, create a new page under slackware/ and link 'em here.
FreeBSD Setup
TODO: I have these notes as well. Clean them up and post 'em here.