VM images of Ubuntu Server 14.04 LTS (Trusty Tahr) with Vagrant and Docker Containers

This article is an update to https://ochronus.com/docker-primer-django/ post for Ubuntu Server 14.04 LTS (Trusty Tahr).

TL;DR if you’re lucky and everything is installed right and you don’t want to understand deeper, try:

vagrant init ubuntu/trusty64
vagrant up

First, let’s install Vagrant on the host computer (a MacOS X Mavericks here, using Homebrew Cask that can install binary install packages):

brew cask install vagrant

Then let’s create a directory where we’ll store the Vagrant related file for this host:

mkdir -p ~/dev/vagrant_trusty

cd ~/dev/vagrant_trusty

Create the shared folder

mkdir vagrant-docker

And let’s create this “Vagrantfile” file to describe our new VM in the Vagrant language:

Vagrant.configure(“2”) do |config|
config.vm.box = “trusty”
config.vm.box_url = “https://cloud-images.ubuntu.com/vagrant/trusty/trusty-server-cloudimg-amd64-juju-vagrant-disk1.box”
# we’ll forward the port 8000 from the VM to the port 8000 on the host (OS X)
config.vm.network :forwarded_port, host: 8000, guest: 8000
config.vm.synced_folder(“vagrant-docker”, “/vagrant”)

# add a bit more memory, it never hurts. It’s VM specific and we’re using Virtualbox here.
config.vm.provider :virtualbox do |vb|
vb.customize [“modifyvm”, :id, “–memory”, 2048]
end
end

Now it’s done, we can create the VM:

$ vagrant up
Bringing machine ‘default’ up with ‘virtualbox’ provider…
==> default: Box ‘trusty’ could not be found. Attempting to find and install…
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Adding box ‘trusty’ (v0) for provider: virtualbox
default: Downloading: https://cloud-images.ubuntu.com/vagrant/trusty/trusty-server-cloudimg-amd64-juju-vagrant-disk1.box
default: Progress: 0% (Rate: 1271k/s, Estimated time remaining: 0:08:32)
default: Progress: 1% (Rate: 1532k/s, Estimated time remaining: 0:07:15)
default: Progress: 41% (Rate: 1520k/s, Estimated time remaining: 0:04:10)
default: Progress: 81% (Rate: 1532k/s, Estimated time remaining: 0:01:18)
default: Progress: 84% (Rate: 1545k/s, Estimated time remaining: 0:01:06)
==> default: Successfully added box ‘trusty’ (v0) for ‘virtualbox’!
==> default: Importing base box ‘trusty’…
==> default: Matching MAC address for NAT networking…
==> default: Setting the name of the VM: vagrant_default_1407250776484_38665

==> default: Clearing any previously set forwarded ports…
==> default: Clearing any previously set network interfaces…
==> default: Preparing network interfaces based on configuration…
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports…
default: 22 => 2122 (adapter 1)
default: 80 => 6080 (adapter 1)
default: 8001 => 18123 (adapter 1)
default: 22 => 2222 (adapter 1)
==> default: Running ‘pre-boot’ VM customizations…
==> default: Booting VM…
==> default: Waiting for machine to boot. This may take a few minutes…
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying…
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM…
==> default: Configuring and enabling network interfaces…
==> default: Mounting shared folders…
default: /vagrant => /Users/user/dev/vagrant/vagrant-docker
==> default: Running provisioner: shell…
default: Running: inline script
==> default: You have not informed bzr of your Launchpad ID, and you must do this to
==> default: write to Launchpad or access private data. See “bzr help launchpad-login”.
==> default: Branched 13 revisions.
==> default: Bootstrapping Juju…
==> default: uploading tools for series [precise trusty]
==> default: Logging to /home/vagrant/.juju/local/cloud-init-output.log on remote host
==> default: Bootstrapping Juju machine agent
==> default: Starting Juju machine agent (juju-agent-vagrant-local)
==> default: Taking a nap to let state server come up…
==> default: Added charm “cs:trusty/juju-gui-3” to the environment.
==> default: Setting up Juju GUI dependencies…this may take a minute.
==> default: You can find the log in /var/log/juju-setup.log
==> default: You have not informed bzr of your Launchpad ID, and you must do this to
==> default: write to Launchpad or access private data. See “bzr help launchpad-login”.
==> default: Branched 25 revisions.
==> default: Taking a nap to let Juju Gui get setup
==> default:
==> default: Setting up transparent redirect for Juju-Gui
==> default: Redirecting localhost:80 to 10.0.3.77:80
==> default:
==> default: Executing: sudo iptables -t nat -A PREROUTING -p tcp –dport 8001 -j DNAT –to 10.0.3.77:80
==> default: Executing: sudo iptables -t nat -A POSTROUTING -j MASQUERADE
==> default:
==> default: From your browser on your hosts, you should be able to
==> default: access the GUI by going to: http://127.0.0.1:6080
==> default:
==> default: Your password is: XXXXXXXX
==> default: juju-gui start/running, process 13405
==> default: juju-gui start/running, process 13405

$

If you have some problems about conflicting local host and guest ports, it’s ONE of the different Vagrantfile being used that may be the cause of your trouble: https://stackoverflow.com/questions/10953070/how-to-debug-vagrant-cannot-forward-the-specified-ports-on-this-vm-message/25142933#25142933

Watch out, your Vagrantfile is **not the only one** being used when bringing up a Vagrant box/instance.

When you get this:

~/dev/vagrant user$ vagrant reload
Vagrant cannot forward the specified ports on this VM, since they
would collide with some other application that is already listening
on these ports. The forwarded port to 8001 is already in use
on the host machine.

To fix this, modify your current projects Vagrantfile to use another
port. Example, where ‘1234’ would be replaced by a unique host port:

config.vm.network :forwarded_port, guest: 8001, host: 1234

Sometimes, Vagrant will attempt to auto-correct this for you. In this
case, Vagrant was unable to. This is usually because the guest machine
is in a state which doesn’t allow modifying port forwarding.
~/dev/vagrant user$

You are actually not only using the Vagrantfile from ~/dev/vagrant but also the one from your “box” distribution .box file which is typically located here:

~/.vagrant.d/boxes/trusty/0/virtualbox/Vagrantfile

And if you have a look at it you’ll see it has plenty of **default** port mappings:

$ cat ~/.vagrant.d/boxes//trusty/0/virtualbox/Vagrantfile
$script = <<SCRIPT
bzr branch lp:jujuredirector/quickstart /tmp/jujuredir
bash /tmp/jujuredir/setup-juju.sh
SCRIPT

Vagrant.configure(“2”) do |config|
# This Vagrantfile is auto-generated by ‘vagrant package’ to contain
# the MAC address of the box. Custom configuration should be placed in
# the actual ‘Vagrantfile’ in this box.

config.vm.base_mac = “080027DFD2C4”
config.vm.network :forwarded_port, guest: 22, host: 2122, host_ip: “127.0.0.1”
config.vm.network :forwarded_port, guest: 80, host: 6080, host_ip: “127.0.0.1”
config.vm.network :forwarded_port, guest: 8001, host: 8001, host_ip: “127.0.0.1”
config.vm.network “private_network”, ip: “172.16.250.15”
config.vm.provision “shell”, inline: $script

end

# Load include vagrant file if it exists after the auto-generated
# so it can override any of the settings
include_vagrantfile = File.expand_path(“../include/_Vagrantfile”, __FILE__)
load include_vagrantfile if File.exist?(include_vagrantfile)

So, go ahead and edit this file to remove the offending colliding forwarding port(s):

config.vm.network :forwarded_port, guest: 22, host: 2122, host_ip: “127.0.0.1”
config.vm.network :forwarded_port, guest: 80, host: 6080, host_ip: “127.0.0.1”
# config.vm.network :forwarded_port, guest: 8001, host: 8001, host_ip: “127.0.0.1”

By:

~/dev/vagrant user$ cp ~/.vagrant.d/boxes//trusty/0/virtualbox/Vagrantfile ~/.vagrant.d/boxes//trusty/0/virtualbox/Vagrantfile.old
~/dev/vagrant user$ vi ~/.vagrant.d/boxes//trusty/0/virtualbox/Vagrantfile

and watch out for other Vagrantfiles inclusion i.e.:

include_vagrantfile = File.expand_path(“../include/_Vagrantfile”, __FILE__)

And now it works:

$ vagrant up
Bringing machine ‘default’ up with ‘virtualbox’ provider…
==> default: Importing base box ‘trusty’…
==> default: Matching MAC address for NAT networking…
==> default: Setting the name of the VM: vagrant_default_1401234565101_12345
==> default: Clearing any previously set forwarded ports…
==> default: Clearing any previously set network interfaces…
==> default: Preparing network interfaces based on configuration…
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports…
default: 22 => 2122 (adapter 1)
default: 80 => 6080 (adapter 1)
default: 22 => 2222 (adapter 1)
==> default: Running ‘pre-boot’ VM customizations…
==> default: Booting VM…
==> default: Waiting for machine to boot. This may take a few minutes…
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying…
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM…
==> default: Configuring and enabling network interfaces…
==> default: Mounting shared folders…
default: /vagrant => /Home/user/dev/vagrant/vagrant-docker
==> default: Running provisioner: shell…
default: Running: inline script

Type then:

vagrant ssh

And you will be connected.

Enjoy your Vagrant install of Ubuntu Server 14.04 LTS (Trusty Tahr).

Packaged with this Ubuntu Server 14.04 LTS (Trusty Tahr), you will get Juju and Docker pre-installed. This will enable you to connect to http://127.0.0.1:8001 to access Juju web UI.

Update:

Then you want to run Docker. Two ways to do that:

  1. Run Docker from within Linux Ubuntu 14.04
  2. Run Docker from within Mac OS X with Boot2Docker

 

Conférence /tmp/lab à la Gaité Lyrique : Flo Kaufmann / Le son du métro

Dans le cadre de son cycle de conférences Laboratoire ouvert, le TMP/LAB/ invite le “bricoleur universel” Flo Kaufmann.
A cette occasion, il nous présentera son projet “le son du métro” sous forme d’une conférence-atelier.

Cette soirée particulière aura lieu le jeudi 6 octobre à 19H00 dans la salle de conférence de la Gaité Lyrique.

Entrée libre.

La Gaité Lyrique :
 3 bis rue Papin
 75003 Paris
Métro : Réaumur-Sébastopol,  lignes 3, 4
ou    Arts et Métiers,  lignes 3, 11

 

Flo kaufmann est né en 1973 et vit à Soleure en Suisse. A la fois électronicien, ingénieur du son et artiste, il est un véritable « bricoleur universel ». Flo Kaufmann s’intéresse à la musique électronique expérimentale, il crée des installations son et vidéo à partir de ses propres outils et ses propres instruments.
Son travail s’est fortement dirigé vers l’objet du disque comme un matériau lui donnant ses orientations sonores personnelles. Il réalise sa première gravure en 1993 en utilisant un tour de coupe artisanal dédié aux films radiographiques, puis il construit sa propre unité de production et débute dans le mastering du disque professionnelle après l’acquisition d’un tour de Neumann en 1995.

Outre ses qualités de “maître graveur”, il est aussi DJ et performeur, créateur de visuels analogiques et travaillent de multiples autres média comme des cylindres en cire Edison, des videos et tous autres épaves techniques. Il collabore régulièrement avec de nombreux artistes comme Mickael et Max Egger, Ursula Sherrer, Chris dubflow and Christian Marclay…

Sous une forme de conférence/atelier, Flo Kaufmann nous présentera son projet “le son du métro” :

« Depuis ma première visite à Paris, je me suis demandé ce qu’il y avait sur cette piste brune du ticket de métro : Comment ca marche ? Quelles sont les informations transmises ? En 2009, alors que j’étais pour six mois en résidence à Paris, j’ai commencé à collecter des centaines de tickets. Pendant plusieurs mois, j’ai fait un immense puzzle et effectué le décodage de ces tickets avec des outils très primitifs : une carte son, un magnéto Revox A77, un Walkman trouvé sur la rue, une carte Arduino et quelques lignes de code. L’idée n’est pas d’escroquer le RER ou le métro, mais plutôt d’utiliser les datas pour créer une base de compositions algorithmiques. Le projet est en cours de réalisation et devrait aboutir à la création d’un disque vinyle avec sur une face les sons bruts de 50 stations et sur l’autre face les compositions faites à partir des pistes magnétiques. »

Site de Flo kaufmann : http://www.floka.com/

 

OpenWrt Workshop

Samedi 4 avril 2009 au /tmp/lab, de 14h30 à 20h30.

Voici les différents points qui seront abordés :

Sur OpenWrt :

  • de comprendre la structure générale d’OpenWrt ;
  • de construire votre propre image du firmware pour votre cible matérielle ;
  • de porter un logiciel de votre choix et de le tester ;
  • de le flasher depuis le firmware original ou depuis une ancienne version d’OpenWrt.

Sur le Wi-Fi :

  • de faire un petit rappel sur les différents modes de fonctionnement possibles : Master, Managed, Mesh, Ad-hoc, Monitor ;
  • de tester ces différents modes de fonctionnement (suivant le matériel)  et les configurations correspondantes dans OpenWrt.

Sur les protocoles de routage :

  • quelques réseaux de tests simples utilisants OLSR, 802.11s et Babel.

Pour plus d’informations, consulter la page sur le Wiki.

A samedi !