I wanted to do a post (that I try to keep up to date) with notes about my current dev environment.
This was a setup I WAS using, I no longer really use it I develop on Linux native. This setup though is reasonable if you are on a Windows machine.
My building blocks
- Windows 10 creators update
- Wsltty which I prefer built in bash for windows console
- VMWare workstation with latest Ubuntu installed
- Mobaxterm cause its nice to have an X server
- Vim plus my vim setup installed inside the VM
- chruby plus a bunch of rubies for my dev
- 7+ taskbar tweaker cause Windows makes it annoying to ungroup icons
- i3wm - I use it almost exclusively on my 3 monitor setup
Hacks
A desktop shortcut to my linux VM
I use this shortcut to access my VM - target:
%LOCALAPPDATA%\wsltty\bin\mintty.exe --wsl -o Padding=5 -o Locale=C -o Charset=UTF-8 /bin/wslbridge -C~ -t /bin/bash -c "DISPLAY=0.0.0.0:0.0 ssh -X ubuntu"
It adds a bit of in that I have nice padding on my terminal and connect my mobax windows manager to the session so I can run stuff like git gui
if I want.
A shortcut to puma
I use a custom shortcut to launch puma:
%LOCALAPPDATA%\wsltty\bin\mintty.exe --wsl -o Padding=5 -o Locale=C -o Charset=UTF-8 /bin/wslbridge -C~ -t /bin/bash -c "ssh ubuntu '(cd /home/sam/Source/discourse && echo `pwd` && . ~/.zshrc && cd ~/Source/discourse && bin/puma --kill-existing)'
This shortcut is pinned to my taskbar and allows me to easily launch puma when needed and easily find it.
Using Chrome directly in Windows to access dev
I prefer running Chrome in Windows to running it in X Windows, I prefer the rendering Windows provides and it just works a bit faster in this setup.
I have it configured so ubuntu
always resolves to my VM ip, I handle that by providing VMWare a static lease for the VM per this article.
It basically means I edit:
C:\ProgramData\VMware\vmnetdhcp.conf
And add something like this to the conf
host ubuntu {
hardware ethernet 00:0C:29:16:2A:D6;
fixed-address 192.168.84.132;
}
Once that is done and my c:\Windows\System32\Drivers\etc\hosts
file is edited to reflect, I can access my dev env using ubuntu
instead of shuffling IPs. The IP is stable on reboot so this just works once setup.
Seamless SSH from WSL to VM
I generated an RSA key in my WSL instance and use ssh-copy-id
to stage the public key to the Linux VM.
This means I do not enter passwords when I ssh
into the VM using the above shortcuts, this is critical to this workflow.
Better errors support
Better errors is the awesome gem that makes debugging in dev so much easier. Unfortunately, out of the box, it is super strict about who is allowed access.
I use a to allow my Windows machine access to http://ubuntu:9292/__better_errors
by adding this to my .zshrc
:
export TRUSTED_IP:"0.0.0.0/0"
Feel free to use less of a sledgehammer, but completely losing out on better errors would be a huge shame.
Vim autospec
I use the Vim autospec configuration documented here: discourse/bin/notify_file_change at main · discourse/discourse · GitHub
This means that as soon as I save a spec, autospec runs it using the power of