Search code examples
fiwarefiware-orion

Run Orion on docker in HTTPS


Hello again me ( sorry ),

I wanted to configure Orion which is running in docker to run on HTTPS. Steps i took:

  1. Download script

  2. Generate key and cert from it (localhost.key/localhost.crt)

  3. Run cli command contextBroker -https -key /localhost.key -cert /localhost.crt

Additional info:

{
"orion" : {
"version" : "1.13.0-next",
"uptime" : "0 d, 0 h, 15 m, 56 s",
"git_hash" : "95ec3913f20682214891e92a5afbb0122293ffa2",
"compile_time" : "Thu Jun 14 11:03:03 UTC 2018",
"compiled_by" : "root",
"compiled_in" : "bfe336509e64",
"release_date" : "Thu Jun 14 11:03:03 UTC 2018",
"doc" : "https://fiware-orion.readthedocs.org/en/master/"
}
}

Error log after i enter cli command:

 lvl=ERROR | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=contextBroker.cpp[382]:pidFile | msg=PID-file '/tmp/contextBroker.pid' found. A broker seems to be running already

And more info:

root          1  0.0  0.6 383308 13592 ?        Ssl  08:31   0:00 
/usr/bin/contextBroker -fg -multiservice -ngsiv1Autocast -dbhost mongo
root        184  0.0  0.0   9096   868 pts/0    S+   08:54   0:00 grep -- 
color=auto contextBroker

Questions: Have i made mistake in my approach to this, it seem that with my cli command i try to create another cb process and got error like this?

More info when i run this command:

/usr/bin/contextBroker -fg -multiservice -ngsiv1Autocast -dbhost mongo -https 
-key /localhost.key -cert /localhost.cert

I get this error:

time=Friday 15 Jun 09:25:20 2018.271Z | lvl=FATAL | corr=N/A | trans=N/A | 
from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=rest.cpp[1732]:restStart | 
msg=Fatal Error (error starting REST interface)

I know what this error mean because i saw u already respond to that on multiple posts, that there is 2 process using port and solution is killing one. But i see no such processes only from code above. Hope this info helps on.

Thanks.

Update on 2 errors:

PID-file '/tmp/contextBroker.pid' found. A broker seems to be running already

Removing old pid as u suggested solved this error. I procede then with running cli command:

contextBroker -https -key /localhost.key -cert /localhost.crt

Then i checked:

ps ax | grep contextBroker

Output:

 1 ?        Ssl    0:00 /usr/bin/contextBroker -fg -multiservice -ngsiv1Autocast -dbhost mongo
90 ?        Ss     0:00 contextBroker -https -key /localhost.key -cert /localhost.crt
95 pts/0    S+     0:00 grep --color=auto contextBroker

Netstat output:

tcp        0      0 0.0.0.0:1026            0.0.0.0:*               LISTEN   
1/contextBroker
tcp6       0      0 :::1026                 :::*                    LISTEN      
1/contextBroker

Solution for people with similar problem.

mongo:
   image: mongo:3.4
   command: --nojournal
orion:
   image: fiware/orion
   volumes:
     - /home/igor/Fiware/Orion/localhost.key:/localhost.key
     - /home/igor/Fiware/Orion/localhost.pem:/localhost.pem 
   links:
     - mongo
   ports:
     - "1026:1026"
   command: -dbhost mongo -https -key /localhost.key -cert /localhost.pem

Solution

  • Let's have a look to the different errors:

    PID-file '/tmp/contextBroker.pid' found. A broker seems to be running already

    This can be due to two reasons:

    • Another Context Broker is running in the same machine using the same PID file
    • Another Context Broker was running and it stopped in an unordered way (e.g. a crash) so it wasn't able to remove the PID file before stopping

    Solution:

    • Check no other Context Broker is runing in that machine (e.g. ps ax | grep contextBroker). If any, kill it.
    • Remove /tmp/contextBroker.pid file if it exists.

    Fatal Error (error starting REST interface)

    This error is tipically due to another process is using the same port that Orion (default: 1026). Check no other process is using it, e.g. using netstat. Typically this is due another instance of Orion has been previously started but it may be due to other causes.