Sharing ideas

Solving problems

Gathering solutions

Exchanging thoughts

Ruby On Rails



Debian & Ubuntu
jQuery & CSS

How I Failed to Create Vagrant-based Ruby on Rails Environment

Did you ever tried to solve a problem of unified development environment? It’s hard. I mean – seriously. ‘It works on my machine’ – how many times did you heard that?

So you have Vagrant or Docker or maybe some other brand-new-solution. With Vagrant you basically build a whole VM environment, with Docker it’s another story (assuming you’re running linux).

Personally I prefer using Vagrant, because with Docker – well, you still need Vagrant to run it on mac/windows. Of course you can be a hipster, and run ubuntu using docker on your CoreOs within Vagrant on MacOs (comment I read somewhere on the Internet that pretty sums it up). And that may have it’s pros that’s I’m refusing to see.

Recently I have build pretty neat (IMO :P) box that consists of:

  • ElasticHQ – for monitoring elasticsearch status
  • mailcatcher (later replaced by – for catching all emails from your dev environment
  • monit – for monitoring processes, memory & cpu usage
  • thin (alternatively puma) – a rack server that is listening on unix socket (served by nginx)
  • upstart – for automatically starting processes
  • rvm – for your ruby & gemsets

Of course you can’t pack too much into one VM, because obviously it will became too bulky and slow, but with right tuning you can safely run few (two-three) minor-sized rails app within one machine. As a rule of thumb tune logging to minimum, tweak configs (especially if you’re using elasticsearch that is memory heavy), don’t be afraid to experiment.

So where is the failure you might ask? Unfortunately I traded it works on my machine to it works in my Vagrant. I s..t you not – this happened to me. Despite the whole Vagrant awesomeness at some point I had to revert to local development env, because Vagrant was not longer reliable. So – what happened? This happened:

And many more issues & possible solutions related to same thing. What’s funny I was never able to reproduce the issues with not updating/reloading code that my colleagues had. I tried both Mac & Linux, different editors and configurations (both NFS & rsync), different versions of software itself, etc. etc. We used same packaged box and yet the basic foundation, the idea of having a dev box didn’t worked. At it’s core it was somehow broken.

Ultimately I didn’t had time to track down the cause of it, my ‘vagrant project’ became a burden to myself and to my team and i decided to axe it. Hopefully some day I will get back to it (and find a solution, because it’s bugging me as hell :P).