Doc-Cirrus / orthanc-mongodb

Orthanc MongoDB plugin
Other
19 stars 16 forks source link

Running mongodb plugin inside docker container #25

Open MateuszSkalka opened 3 years ago

MateuszSkalka commented 3 years ago

Hello everyone, I succesfully compiled a docker image with orthanc-mongodb installed inside, when I try to run the container with a custom configuration I encountered an error (from the bash inside docker container):

W1016 20:29:34.006603 main.cpp:821] Loading plugin(s) from: /root/orthanc-mongodb/build/libOrthancMongoDBIndex.so W1016 20:29:34.065896 PluginsManager.cpp:269] Registering plugin 'MongoDBIndex' (version 1.5.7) free(): invalid pointer Aborted (core dumped)

rest of the plugins register properly.

My Dockerfile:

FROM jodogne/orthanc-plugins:1.8.0 RUN apt-get update RUN apt -y install build-essential unzip cmake make libsasl2-dev uuid-dev libssl-dev zlib1g-dev git curl RUN apt -y install python

RUN curl -L --output orthanc.tar.gz https://www.orthanc-server.com/downloads/get.php?path=/orthanc/Orthanc-1.5.7.tar.gz RUN tar -xzf orthanc.tar.gz

RUN git clone https://github.com/Doc-Cirrus/orthanc-mongodb.git RUN mkdir orthanc-mongodb/build \ && cd orthanc-mongodb/build \ && cmake -DCMAKE_CXX_FLAGS='-fPIC' -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DORTHANC_ROOT=/root/Orthanc-1.5.7 -DAUTO_INSTALL_DEPENDENCIES=ON .. \ && make

RUN rm /etc/orthanc/orthanc.json COPY "./orthanc-conf.json" "/etc/orthanc/orthanc-conf.json"

EXPOSE 4242 EXPOSE 8042

ENTRYPOINT ["Orthanc", "/etc/orthanc/orthanc-conf.json"]

part of the json configuration file that cousing the problem:

"Plugins" : [ "/usr/local/share/orthanc/plugins/", "/root/orthanc-mongodb/build/libOrthancMongoDBIndex.so", "/root/orthanc-mongodb/build/libOrthancMongoDBStorage.so" ],

"MongoDB" : { "EnableIndex" : true, // false to use default SQLite "EnableStorage" : true, // false to use default SQLite "ConnectionUri" : "mongodb://localhost:27017/orthanc_db", "ChunkSize" : 261120 },

the error occures no matter witch version of orthanc-plugins image i compile with.

Thanks, Mateusz Skalka

kosch commented 3 years ago

Thats possible, we're a bit behind with Orthanc usage currently. We're using 1.5.8, we're gonna switch to 1.7.4 till the end of October. So at that point this plugin is tested based on 1.7 Orthanc. Maybe end of November we're switch to 1.8 Orthanc. A bit patience is needed ;-)

MateuszSkalka commented 3 years ago

Hi, After chaning Orthanc to version 1.5.8 the same error occures. Is this possibe that something other causes the error?

kosch commented 3 years ago

Maybe MongoDB version, we're still using 3.6.

MateuszSkalka commented 3 years ago

I use MongoDB database which I previously succesfully connected to Orhanc when it wasn't containerized, so i think it can't be the problem

Betalos commented 3 years ago

@MateuszSkalka could you tell me you env versions (mongo, orthanc, os). and which version on the pluging you downloaded

MateuszSkalka commented 3 years ago

The mongoDB version we're using: v4.0.20

I tested and installed the plugins using four different versions of jodogne/orthanc-plugins image from dockerhub, 1.8.0, 1.7.4 , 1.5.8 and 1.5.7, each one gave me similar error, segmentation fault on older versions and invalid pointer on versions 1.8 and 1.7.4

I'm pulling source code from master branch of orthanc-mongodb repository and install rest of the plugins with -DAUTO_INSTALL_DEPENDENCIES=ON

Betalos commented 3 years ago

OK I see. try this repo https://github.com/Betalos/orthanc-mongodb and also I'm not sure about the DAUTO_INSTALL_DEPENDENCIES=ON I have not used it so try to install the deps manually (readme section). The plugin I have it up and running with 1.8.0/1.7.*. I would suspect it's a 'jodogne/orthanc-plugins image from dockerhub' related, try to build everything yourself just to be sure.

ihor-mozil commented 3 years ago

I'm able to reproduce this with jodogne base image, however the 1.5.8 version prduces different seg fault that relates to open ssl initialization, the 1.8.0 version segfaults when trying to parse the Orthanc configuration. I'm not sure I'll be able to figure this out. If I find anything I'll post here. Manual installation on CentOS looks like working.

ihor-mozil commented 3 years ago

New branch orthanc-1.8.0 has been created. The parsing issue was fixed. I don't know exactly what it was. It looks like the deprecated jsoncpp methods causes some issues with the newer g++ v8.

Please try this Docker file. It works for me good.

FROM jodogne/orthanc-plugins:1.8.0 RUN apt-get update RUN apt -y install build-essential unzip cmake make libsasl2-dev uuid-dev libssl-dev zlib1g-dev git curl RUN apt -y install python

RUN curl -L --output orthanc.tar.gz https://www.orthanc-server.com/downloads/get.php?path=/orthanc/Orthanc-1.5.7.tar.gz RUN tar -xzf orthanc.tar.gz

RUN git clone -b orthanc-1.8.0 https://github.com/Doc-Cirrus/orthanc-mongodb.git RUN mkdir orthanc-mongodb/build && cd orthanc-mongodb/build && cmake -DCMAKE_CXX_FLAGS='-fPIC' -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DORTHANC_ROOT=/root/Orthanc-1.5.7 -DAUTO_INSTALL_DEPENDENCIES=ON .. && make

RUN rm /etc/orthanc/orthanc.json COPY "./orthanc-conf.json" "/etc/orthanc/orthanc-conf.json"

EXPOSE 4242 EXPOSE 8042

ENTRYPOINT ["Orthanc", "/etc/orthanc/"]