torstai 27. helmikuuta 2014

Vagrant: The guest operating system of the machine could not be detected!

TLDR; check that the shell defined by your config.ssh.shell is installed

Edit: Reported as https://github.com/mitchellh/vagrant/issues/3040 and got immediate reaction, cool.

Today I encountered following error with Vagrant when executing "vagrant up":

The guest operating system of the machine could not be detected!
Vagrant requires this knowledge to perform specific tasks such
as mounting shared folders and configuring networks. Please add
the ability to detect this guest operating system to Vagrant
by creating a plugin or reporting a bug.

This box had worked before, and it was based on Ubuntu 13.10, so I was pretty confused.

After enabling debug logging for vagrant (well, after updating vagrant and trying zillion different things :)), following log was given:


.... (a lot of log)
DEBUG ssh: stderr: bash: /bin/zsh: No such file or directory

DEBUG ssh: Exit status: 127
ERROR warden: Error occurred: The guest operating system of the machine could not be detected!
.... (a lot of log)
ERROR vagrant: The guest operating system of the machine could not be detected!
Vagrant requires this knowledge to perform specific tasks such
as mounting shared folders and configuring networks. Please add
the ability to detect this guest operating system to Vagrant
by creating a plugin or reporting a bug.
ERROR vagrant: /opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/guest.rb:48:in `detect!'
/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/lib/vagrant/machine.rb:182:in `guest'

After seeing this, the reason was obvious: I had added zsh as shell with

config.ssh.shell = "/bin/zsh"

And it was not installed to box.

maanantai 17. helmikuuta 2014

Few tips for making application Docker friendly (Or some problems with WebLogic 10.3.6 and Docker)

I've been playing around with Docker trying to install WebLogic 10.3.6. Here's some tips for making application Docker friendly, mainly from issues I encountered. Perhaps some of these are just general good practices

1. Make it possible to bypass disk space checks
Docker (0.8) doesn't allow you to define disk size, so when Weblogic tries to verify that there's enough space on the disk, it fails. Luckily there's a parameter which makes it possible to ignore this. As a side note, Oracle DB has the same option but it still asks user "Are you sure" or something similar. Sucks when trying to install with puppet.

2. Use environment variables to define configuration options.
Docker has excellent way to define environment variables in Dockerfile and in run -command. Also there's a lot of useful variables present. I found this when trying to deploy separate front- and backend -servers, and needed a way to define addresses for connections.

3. Do not assume anything about ports or addresses.
WebLogic maven plugin seems to have some weird issue when port is forwarded to different one, ie. docker run -p 7001:7002 for Admin server. This causes deployment to fail. Just a little thing you should test.

I've managed to get WebLogic up and running with docker, which is a huge plus. Testing our application with WebLogic is so much easier now.

And no, we did not select WebLogic. Our customer did.