I thought I would document some of what I’ve been attempting to do. I don’t expect an answer at this point, unless anyone has helpful hints. I’ve got a pretty sophisticated set of Lua scripts running on Orthanc. So I realize I’m pushing the capability. Ultimately, I’m going to rewrite the functionality to use the RestAPI outside of Orthanc, rather than the native Lua. But for the moment, I’m stuck with my complicated Lua Scripts.
I’m probably running into the similar lua version problems as discussed in the thread on the lua socket module. In my case, I’m working with the luasql-postgres to make calls to the same backend postgres server I’m using for Orthanc’s postgres index. In the Osimis images of the last year, my calls to connect to the remote database simply fail with very little error reporting - even with Orthanc run in verbose mode.
I can install lua5.3 on the host system (docker container) and produce the same errors loading the luasql-postgres module. So, this really does seem to be a lua5.3 vs luasql-postgres 5.1/2 issue than an Orthanc lua problem. The trick is figuring out how to get the host lua to work with the 5.3 lua compiled into Orthanc.
As near as I can tell, that luasql-postgres module is supported by the ubuntu distributions (<=16) and available for apt-get install up to Lua 5.2, but not 5.3. At some point, I guess the internal Orthanc Lua evolved to 5.3 and then stopped working well with the older Lua 5.1 extensions. I think the base Docker image I’ve been using that still works dates back to late 2017.
I tried installing the luasql-postgres module with luarocks. Luarocks sort of worked and compiled luasql-postgres, but not quite, with the module crashing during actual Lua execution with complaints about missing symbols in the dynamic link library. I suspect there might be some version conflict between the host (ubuntu 16 docker based Osimis Orthanc) and luarock’s installed version of luasql-postgres, but I’m not sure.
Compiling luasql-postgres completely from scratch isn’t all that appealing, since I’m working from within docker containers. I’m not so keen on installing the compilation infrastructure necessary to pull this off, only to then have to strip it out to reduce the docker container size back to a reasonable size.
Following Sebastien’s suggestions in that socket thread, I took the Osimis Dockerfile and attempted to modify it to build on top of ubuntu 18.04 since bionic has direct (apt-get) support for the luasq-postgres plugin for lua 5.3. Everything seemed to build ok, except that when I attempt to start the Orthanc container I get an error during boot
"SQL error: ERROR: syntax error at or near “ASSERT”
LINE 32: ASSERT studyKey IS NULL;
This seems to arise from a postgres sql file used when Orthanc selects the postgres backend for its indexing (which is what I do). I can only guess that moving to Ubuntu bionic 18.04 was too much for the Osimis build combined with my use of Postgres. Granted, the Osimis build has grown a lot more sophisticated and it’s possible I might not be turning off some plugin that’s causing a problem here. The above postgres error comes right after Orthanc reporting “Installing the CreateInstance extension”.
Again, I’m not expecting a solution here. I think it’s probably a lot to expect all the new things (the OS, luasql and Osimis) to play nice together.
John.