Using Unison to sync my desktop computer with a container in the cloud
1
vote
1
answer
328
views
I'd like to use Unison to sync a directory between my desktop computer and a container that lives in the cloud. I have this kind of working with Unison, but the problem I'm seeing is that every time I spin up the container, it can have a different hostname and IP number, and sshd will be running on a different port number.
To make this mostly transparent to me, every time I spin up the container, I edit my ~/.ssh/config file like so:
Host pod
User root
Hostname 184.26.5.182
Port 10666
I replace the IP number and port number accordingly.
Once I've done this, I can log into the container using ssh pod
, etc. I can run scripts that rsync stuff around with no problem, even though they have the host alias "pod" hardwired into them. (If I knew how to make rsync do a bidirectional sync with deletions, then I'd just use that, but I'm pretty sure that that is not possible.)
My Unison config file looks like this:
root = /Users/me/path/to/dir
root = ssh://pod//path/to/dir
ignore = Path subdir1
ignore = Path subdir2
Unfortunately, this does not work great because every time I spin up the container, I get a different port number (the IP number doesn't usually change), and Unison considers this to be a fresh sync. Which is not at all what I want.
Is there a way to tell Unison to ignore the fact that the remote container seems to have changed to a different computer, and to just trust that my "pod" host alias can be relied on for host identity?
Asked by Douglas
(121 rep)
Jan 16, 2023, 08:37 PM
Last activity: Jan 17, 2023, 04:04 AM
Last activity: Jan 17, 2023, 04:04 AM