Having a short feedback loop is essential for my development workflow. With a short feedback loop I mean really short - seconds if the situation demands it. I want to be able to show my customer the changes I made just seconds ago. Ultimately make changes to code and prototype together with the customer. This is almost trivial if you are lucky enough to be co-located right next to your customer. However, this is seldom the case.

Sometimes the proper way to solve a problem is to use pen-and-paper or apply process. However, when you need to get feedback on your code changes to a real system, then tools can provide leverage and benefit if you are not co-located with your stakeholder. We need something to be able to share the local development environment as easy as Amazon’s one-click ordering. Luckily there is a good range of options available nowadays to help us keep the feedback loop as short as possible.

Aside from being a simple and powerful tool for configuring your local development environment to match production, Vagrant can also share your local box to the world with a single command vagrant share.

I have setup a simple Vagrant box with nginx, node and mongo, which is used here for demonstration purposes. In this specific case we want to forward https port, which requires the extra params vagrant share --https §PORT

Step 1 : Create Account to Vagrant Cloud
Step 2 : Spin up your environment, login to Vagrant Cloud and share
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# clone example vm box and boot it up
$ git clone https://github.com/vkomulai/vagrant-nginx-node-mongo-box.git
$ cd vagrant-nginx-node-mongo-box
$ vagrant up

[...VM boots up and installs dependencies (this will take some time)...]

# login to Vagrant cloud
$ vagrant login
Atlas Username: your.username@foobar.io
Password (will be hidden):******
You are now logged in.

# We are using https, which is forwarded to port 7777
$ vagrant share --https 7777

[...Some more magic...]

==> default: Checking authentication and authorization...
==> default: Creating Vagrant Share session...
default: Share will be at: selfish-panda-4911
==> default: Your Vagrant Share is running! Name: selfish-panda-4911
==> default: URL: http://selfish-panda-4911.vagrantshare.com
Step 3 : Test and share your box url
1
2
$ curl --insecure https://selfish-panda-4911.vagrantshare.com
<!DOCTYPE html><html><head><title>Hello stranger on Node port 3000</title><link rel="stylesheet" href="/stylesheets/style.css"></head><body><h1>Hello stranger on Node port 3000</h1></body></html>

That is quite simple, isn’t it? In my next post I plan to drill down a bit deeper on methods for keeping the feedback loop short.