Archive for category devops

Gatling : load testing like a king

Gatling for rails app @


, ,

Leave a comment

Ansible – tighten your quality feedback loop

Testing your ansible playbook…

, , , , ,

Leave a comment

Security for dummies

A presentation on web application security given for lunch.
Too long didn’t read ? Just pick the slide 38.

, ,

1 Comment

Fresh machine installation notes for ruby developer


  • System Settings –> Privacy : disable “include online search results”
  • Run command as a login shell
  • Terminal : unlimited scroll buffer

Git !

Install and configure git

sudo apt-get install git
git config --global "My Name"
git config --global ""
git config --global --add color.ui true
git config --global push.default simple

I’m a big fan of this customized git prompt, only drawback a carriage return by default at the prompt-end. Just need to modify it in the .bash_profile

export GIT_PROMPT_END=' > '
source ~/.bash-git-prompt/

If needed regenerate a new github ssh key (discard your old keys on github and other server authorized_keys)


Raw sublime text installation via apt-get.
Install the package manager with this

Then install these packages :
– git gutter :

– rubyTest

sublimelinter : highlights lines of code the linter deems to contain (potential) errors.
BeautifyRuby : reformat your ruby code on demand (sometimes messy, but best I found)
Coffeescript : syntax highlighting
puppet : highlight, lint, snippet,…
and a few others 😉

Fix tabs and trailing issue before they appear

  "font_size": 11.0,
  "tab_size": 2,
  "translate_tabs_to_spaces": true,
  "trim_trailing_white_space_on_save": true,
  "ensure_newline_at_eof_on_save": true,
  "hot_exit": false,
  "remember_open_files": false

Have you ever wondered to turn a branch name “feature/my-awesome-feature-123” into a pre-filled commit message “My awesome feature #123”
Then gitils is for you. Last but not least, easy web page/sublime text integration with subl-handler. Thanks @toch !




sudo apt-get install curl
curl -L | bash
source ~/.profile
rvm install ruby

I’m not a big fan, so I disable .rvmrc

I’m not often looking at ri or rdoc (most of the time I’m looking at the code directly) so I tweak ~/.gemrc to avoid downloading these artefacts.

gem: --no-ri --no-rdoc

native gem dependencies

Icu for charlockholmes, Postgresql for pg gem, and a running redis.

sudo apt-get install libicu-dev
sudo aptitude install libpq-dev
sudo apt-get install redis-server
cp /opt/redis/redis.conf.default /opt/redis/redis.conf



sudo apt-get install build-essential linux-headers-generic dkms
sudo apt-get install virtualbox


sudo dpkg -i vagrant_1.3.3_x86_64.deb
rm vagrant_1.3.3_x86_64.deb


rvm use 2.0.0@veewee --create
sudo apt-get install libxslt1-dev libxml2-dev zlib1g-dev
git clone
cd veewee
bundle install

packer ?


sudo add-apt-repository "deb $(lsb_release -sc) partner"
sudo apt-get update
sudo apt-get install skype

Now what ?

Find a boxen equivalent for ubuntu and automate this… time to give a try to kitchenplan or take a look at thoughtbot script (not exactly in my stack, less sexy)

Leave a comment

Puppet : spare 3 minutes per provisionning for your ruby installation.


Info: /Stage[main]/Ruby/Rvm_system_ruby[ruby-1.9.3-p362]: Evaluated in 261.84 seconds


Info: /Stage[main]/Ruby/Exec[rvm_system_ruby_mount-1.9.3-p374]: Evaluated in 69.66 seconds

Thanks to @mark_olson and this puppet snippet :

exec { "rvm_system_ruby_mount-${ruby_full_version}":
     command =>  "/usr/local/rvm/bin/rvm mount -r${operatingsystemrelease}/x86_64/ruby-${ruby_full_version}.tar.bz2 --verify-downloads 1",
     creates => "/usr/local/rvm/wrappers/ruby-${ruby_full_version}",
     require => [

Leave a comment

Vag’rant 1.2.x or the missing upgrade manual

In this article, I will show you the issues you will encounter to upgrade vagrant from 1.0.x to the 1.2.x and how to fix them.

You will need to
– update vagrant it-self
– update the Vagrantfile
– migrate your base boxes to the new layout

Upgrade Vagrant it-self

First the distribution of the software is no more handled by rubygems, so first uninstall all previous vagrant gem versions.

gem uninstall vagrant

also remove any reference to vagrant from your Gemfile.

-gem 'vagrant' 

Then download the new version os-package depending on your distribution and install it.
For my ubuntu laptop it looks like this :

sudo dpkg -i vagrant_1.2.2_x86_64.deb
rm vagrant_1.2.2_x86_64.deb

Upgrade the Vagrantfile

Vagrant 2.0 final will have a stable Vagrantfile format that will remain backwards compatible, just as 1.0 is considered stable.

vagrant up… and then the trouble begins :

A Vagrant 1.0.x state file was found for this environment. Vagrant has
gone ahead and auto-upgraded this to the latest format. Everything
should continue working as normal. Beware, however, that older versions
of Vagrant may no longer be used with this environment.

However, in case anything went wrong, the old dotfile was backed up
to the location below. If everything is okay, it is safe to remove
this backup.

Backup: .../.vagrant.v1.1372160849
.... Vagrantfile:3:in `local_cache': uninitialized constant Vagrant::Environment::DEFAULT_HOME (NameError)

No luck for the backup is polluted with a .vagrant, my Vagrantfile is empty. Thanks to git I can restore it

git checkout -- Gemfile

uninitialized constant Vagrant::Environment::DEFAULT_HOME (NameError)

Now lets fix the first errors, as I was using this gist to cache on my laptop the apt artifacts.
We should replace the DEFAULT_HOME with current directory

   File.expand_path(Vagrant::Environment::DEFAULT_HOME) to              

Don’t forget to add the cache directory to your .gitignore

Shared folders

The apt cache solution is working with a share folder between my laptop, and it’s also affected by a dsl change in vagrant :

config.vm.share_folder "v-cache", "/var/cache/apt/archives/", cache_dir 

is now called synced folder :

config.vm.synced_folder cache_dir, '/var/cache/apt/archives/', id: 'v-cache', owner: 'vagrant', group: 'www-data' 

Forwarded port


config.vm.forward_port 80, 8080

with the upgraded dsl : :forwarded_port, host: 8080, guest: 80  

Network hostonly

A small config changes from :hostonly, "" 

to :private_network, ip: ""

Customize natdns

Previously I was enabling memory and natdns properties via

config.vm.customize(["modifyvm", :id, "--name", "dev-dev606", "--memory", "1024",

These customizations are now specific to the virtualbox provider :

config.vm.provider 'virtualbox' do |v|
      'modifyvm', :id,
      '--name', 'dev-dev606',
      '--memory', '1024',
      '--natdnshostresolver1', 'on',
      '--natdnsproxy1', 'on'

Boot with ui

Sometimes you need to boot the vm with a gui (to diagnose boot issue, clear bad firewall rules)
Previously it was :

  config.vm.boot_mode = :gui

Not this is done via the provider

config.vm.provider "virtualbox" do |v|
  v.gui = true

System call

I used to have a call to librarian-puppet. But now it’s complaining that he can’t find his own gem. Thats because we are launching it in a vagrant with sandboxed ruby that has ownly access to vagrant dependencies. My work around for now is to prefix the call with a rvm use.

 system "/bin/bash -c -l 'rvm use ruby-2.0.0-p247 && cd #{File.dirname(__FILE__)} && bundle exec librarian-puppet install'"

If somebody know a better way to escape the sandbox… leave a comment.
Did someoned knows if librarian-puppet-vagrant is vagrant 1.2 compatible ?

Update your existing base box

The basebox layout has changed (to support multiple provider), it seems that the code that is supposed to upgrade it isn’t working for me.

So here you have the manual steps to migrate them :

cd ~/.vagrant.d/debian607
mkdir virtualbox
mv box-disk1.vmdk box.ovf Vagrantfile virtualbox
cd ../working-box

Then add a metadata.json in ~/.vagrant.d/debian607

cat << EOF > metadata.json
  "provider": "virtualbox"


This upgrade wasn’t really transparent for me. It makes me sad when I think about all these obsolete/broken articles on the net, all these books that will need a second edition. I hope it will not discourage the vagrant adoption too much.

You can use the new plugins :

vagrant plugin install vagrant-vbguest

My final Vagrantfile is available here.

1 Comment

How do you puppet ?

Infrastructure as Code : lessons learned.

Raise your #Reproducibility, #Maintainability, #Testability, #Reusability up to 98%.

Prepared and presented for the Tech Talk #1 @ ICAB thanks to 8thcolor.

, , ,