Re:Ask HN: How do you like developing on an M1 Mac so far?
by tbrock on Saturday January 16, 2021 @02:22PM
(#25804655)
Yes, just set up a localforward in your .ssh/config like this:
Host dev
HostName <ip_of_dev_box>
User <my_username>
ForwardAgent yes
AddKeysToAgent yes
IdentityFile ~/.ssh/id_m1_air
LocalForward 8443 localhost:8443
LocalForward 8080 localhost:8080
LocalForward 8065 localhost:8065
LocalForward 3000 localhost:3000
...
Those line's effectively mean forward my local port 8443 to the remote host's 8443. The local port + remote port (and even the remote host) don't need to be the same.Since it’s forwarding a TCP port your aren’t limited to forwarding just the web traffic either. I forward:
- Database ports (run mysql or psql locally for example)
- Docker socket
- Backend api ports
- Redis port
- Webserver port
And more...Then you just use local clients as if those things were all running on your local machine
Re:Ask HN: How do you like developing on an M1 Mac so far?
by tga on Saturday January 16, 2021 @02:46PM
(#25804854)
Just one more step missing for a fully remote docker setup: have you ever tried combining this with a sshfs mount so you can also develop an app running in a remote container?
Re:Ask HN: How do you like developing on an M1 Mac so far?
by jokethrowaway on Saturday January 16, 2021 @04:27PM
(#25805663)
Visual Studio has [this](https://code.visualstudio.com/docs/remote/ssh) which is quite painless to use
Re:Ask HN: How do you like developing on an M1 Mac so far?
by tbrock on Saturday January 16, 2021 @02:50PM
(#25804889)
Maybe I'll try that
Re:Ask HN: How do you like developing on an M1 Mac so far?
by ataylor32 on Saturday January 16, 2021 @03:40PM
(#25805301)
Thanks! This sounds like a great setup.
Re:Ask HN: How do you like developing on an M1 Mac so far?
by beagle3 on Saturday January 16, 2021 @05:13PM
(#25806014)
It’s worth reading a bit about sshuttle. It basically leverages ssh into a simple one way VPN as far as ergonomics and user experience go (but the underlying implementation is closer to opening LocalForward connections on demand).
Highly recommended.
Re:Ask HN: How do you like developing on an M1 Mac so far?
by crgwbr on Sunday January 17, 2021 @08:02PM
(#25817053)
Almost as easy: just setup a point to point WireGuard tunnel. I used sshuttle for remote Docker dev for a while, but found that WireGuard way outperforms it.
Re:Ask HN: How do you like developing on an M1 Mac so far?
by beagle3 on Monday January 18, 2021 @11:10AM
(#25823134)
sshuttle is definitely no efficiency daemon - however, it only requires being able to ssh to the other side, amd run Python there, and that’s it - whereas for Wireguard you need root on the other side, a sufficiently new kernel (or building an out of kernel module) - it’s way better if you can use it but IME it isn’t “almost as easy” - sshuttle usually just works if you can ssh.
> I do all of my development remotely via ssh and local forwards
I do a little with SSH tunnels, but not much. Do you mean you have it set up so that on your Mac you can go to localhost:8080 (or whatever) in your browser and it will actually go to the remote machine?