How we pair using AWS, tmux, vim and emacs

By Chris | November 9, 2018

At Gower Street, we often describe ourselves as a hybrid remote team: we’re physically separate from each other, but we’re not asynchronous.

software-development

We are a remote-first development team: the team is based in London, Newcastle, Market Harborough, Reading, the Cotswolds and Winchester, and we get together for developer meetups once every three months. However, we don’t tend to work in the same way as other remote teams.

Many of these teams parcel out work to individual developers who are then expected to get it done under their own steam, perhaps checking in once or twice per day on Slack. Whilst developers do sometimes pull work from the backlog and work offline for part of the day, more often than not we practice pair programming, working together on the same EC2 instance.

Whilst there are many tools out there that allow remote screen sharing and even remote editing on a desktop, we’ve found our tmux setup works better for us for the following reasons:

  • It allows you to use your own editor and configuration. There’s no special “pairing editor” required.
  • It’s fast. Because SSH uses very little bandwidth there is no appreciable lag typing on modern broadband connections.

The key disadvantage is that you need to use a terminal editor such as vim or emacs rather than an IDE. There are however many good terminal editors which emulate desktop editors and IDEs, so the editor need not be a barrier.

Configuration

We configured our pairing boxes using terraform, with a minimal terminal editor configuration, and all the developer public keys set up. We preload the machines with a private key used for Github access, and we set up Route53 DNS entries to make it easy for us to connect to these machines. We currently have three such machines running for our team of six, but are looking to expand as our team continues to grow.

Connection

After negotiating via Slack which pair is using which pairing box, each individual pair uses ssh to log into the pairing machine, with a command typed into the local machine terminal similar to the following:

ssh -L 4242:localhost:4242 -L 3449:localhost:3449 <username>@pairing-machine.gower.st

The -L switch allows us to visit http://localhost:4242 on our machine, and connect to a webserver running on that port on the remote machine, so that we can test our changes.

The pair then jumps into a video chat. We use appear.in for all our video meetings and pairing - because it just works without any configuration.

Once we’re both in the same pairing machine, we need to both connect to the same terminal so we can see what the other is typing. We use tmux for this. Tmux is an incredibly useful tool that works much like a window manager for the terminal with screen sharing capabilities. It allows you to have multiple terminal panes and tabs running, and crucially shares that session with all others on the machine.

If one person types tmux to start a new tmux session, and the other types tmux attach to connect to their session. Immediately you’re both in the same terminal, and can both type into the terminal, run commands, start editors, etc.

Continuously improving

We are always looking to improve our setup. Our pairing machines were supposed to be like “cattle”, which we can easily delete and restart, but they’ve become like “pets”. Too much custom configuration that has crept onto the machines, and developers sometimes leave tmux sessions open for several days which can block ports that others want to use.

To fix this, we’d love to create these pairing boxes on demand and shut them down when we’re done. It should even be possible to set up editor configurations as docker containers, making it very easy to containerise much of our development workflow.

How do you currently pair on code? Let us know on Twitter.


Would you like to comment? Reply on Twitter.

We're currently hiring!