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@

mkdir -p ~/opt/packages/pycharm
cd ~/opt/packages/pycharm
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

In terms of look and feel it’s “almost” like you’re working natively however…’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. 

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s