Part 2: Using X11 forwarding with a localhost development story powered by Docker

In discussion with a co-worker regarding the localhost development conundrum he asked if I had tried X11 forwarding. I promptly replied no and we briefly discussed the potential impact this may have.

What could this mean for the localhost story? 

Well….the problems that were encountered in the first iteration of this, in theory should no longer exist.

  1. File change events would be properly raised as we would be natively editing the file on the VM
  2. We wouldn’t have to wait for files to sync’d between OSX and the VM and then having to wait for the file change events to occur.
A visual recap of the environment I ended up with from the first iteration looks like this:
Vagrant was leveraged to provision the VirtualBox VM with Ubuntu and handle the file syncing. Docker Compose was used to bring up the containers and I was making source modifications within my IDE. 

This only changes slightly as we go down the X11 route of things as we would simply be moving the IDE into the provisioned VM:

First things first, we need to install XQuartz on your mac. After that let’s ssh into the VM and install / run PyCharm (note the flags which enable X11 forwarding). 

ssh -XC vagrant@192.168.33.10

mkdir -p ~/opt/packages/pycharm
cd ~/opt/packages/pycharm
wget https://download.jetbrains.com/python/pycharm-professional-2016.1.1.tar.gz
gzip -dc pycharm-professional-2016.1.tar.gz | tar xf -
ln -s ~/opt/packages/pycharm/pycharm-2016.1/ ~/opt/pycharm
# Install zentity (required by pycharm
sudo apt-get update
sudo apt-get install zenity
# Start PyCharm
~/opt/pycharm/bin/pycharm.sh

In terms of look and feel it’s “almost” like you’re working natively however…..it’s just a little awkward. I think that’s the best word to describe it. There are some minor graphical issues and the window sizing that I’ve come to expect when working with a native app just doesn’t work the same.

In terms of speed it’s still a little sluggish. Much faster than relying upon rsync but still not quite good enough IMO.

It was a worthy shot, but just not one that lends itself to a repeatable / maintainable environment. 

Advertisements