Search code examples
mongodbdockerfiwarefiware-orion

Orion Context Broker and Docker - Empty reply from server


I recently started project involving Orion Context Broker. Tried to started it on windows using docker.

https://hub.docker.com/r/fiware/orion/

First method didn't come out good, error that I got while using original code from tutorial is:

   ERROR: yaml.parser.ParserError: while parsing a block mapping
   in ".\docker-compose.yml", line 1, column 1
   expected <block end>, but found '<block mapping start>'
   in ".\docker-compose.yml", line 5, column 2

Then I decided to move on to second method, I started mongoDB with default parameters. I got it to listening for connections and used the 2A way from docker site.

   sudo docker run -d --name orion1 -p 1026:1026 fiware/orion

It seems to have started because it has not returned any errors while starting. However if I use:

   curl localhost:1026/version

I receive no response whatsoever it just freeze and in mongoDB console I don't have any new connection. The addr of docker container is right. Firewall is off. It seems like it haven't connected, but it's running. If I want to start again orion context broker it tells me that it's already running, so then I stop it, remove orion1 and can start it again. When I connect to running mongoDB from another console it shows a new connection while when connecting with Context Broker there isn't.

When I checked CB logs I got

time=Tuesday 24 Oct 21:37:32 2017.378Z | lvl=ERROR | corr=N/A 
trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | 
op=mongoConnectionPool.cpp[152]:mongoConnect |
msg=Database Startup Error (cannot connect to mongo - doing 100 retries  with a 1000 microsecond interval)

Solution

  • With regards to docker-compose.yml fails, copy paste sometimes is tricky... I'll recommend you to download directly from github repository. The following should work:

    wget https://raw.githubusercontent.com/telefonicaid/fiware-orion/master/docker/docker-compose.yml
    

    With regards to Orion docker failing to connect the database, have a look to section 2B in the docker documentation:

    sudo docker run -d --name orion1 --link mongodb:mongodb -p 1026:1026 fiware/orion -dbhost mongodb
    

    It seems you are missing the --link mongodb:mongodb parameter (which requires previously run a MongoDB docker named mongodb, of course).