Keeping alive socks proxy

Making this suggestion searchable by quoting advice given in slack and adding to forums.

Autossh for keeping alive the socks proxy:

Not sure who to message with this, but I have a suggestion.

I’m using datomic cloud and developing against it, which basically means a long running datomic-socks-proxy process. This was quite painful due to frequent timeouts and disconnects, causing me to having to keep jumping across and restarting it.

I installed autossh instead and hacked the script to use this, and it is now much more stable (and survives sleeps of my laptop). I wonder whether it might be worth having the standard script check for the installation of autossh and if found, use that instead (and maybe print a message to the user if not found, before continuing with the regular ssh client).

For anybody interested in my little hack, I just commented out the ssh command at the bottom of the script, and added the autossh one. Like this…

`#ssh -v -i $PK -CND ${SOCKS_PORT:=8182} ec2-user@${BASTION_IP}`
`autossh -M 0 -o "ServerAliveInterval 5" -o "ServerAliveCountMax 3" -v -i $PK -CND ${SOCKS_PORT:=8182} ec2-user@${BASTION_IP}`
2 Likes

To the Datomic team, this will help me. Then we can override the SSH command as we want (I sed it now).

${SSH:=ssh} -v -o IdentitiesOnly=yes -i $PK -CND ${SOCKS_PORT:=8182} ec2-user@${BASTION_IP}