Setting up a read-only Orthanc instance using the Advanced Storage plugin

Hi,

I am fairly new to using Orthanc and I am doing some testing. I have noticed a few things that I am hoping I can get some feedback on. I am trying to use the Indexer mode from the Advanced Storage plugin to index an existing set of DICOM instances on disk. I want the Orthanc instance to be “read-only” but it appears there may be issues with using the ”ReadOnly”: true configuration with the Advanced Storage Indexer mode. Here is the configuration that produces the following log message:

{
  "Plugins" : [ "." ],
  "OrthancExplorer2" : {
    "Enable": true,
    "IsDefaultOrthancUI": true,
  },
  "ReadOnly" : true,
  "AdvancedStorage": {
    "Enable": true,
    "Indexer": {
      "Enable": true,
      "Folders": ["...path...to...data..."],
      "TakeOwnership": false
    }
  }
}

W1109 15:30:05.757252             MAIN advanced-storage:/Plugin.cpp:370] Orthanc is ReadOnly.  The plugin will not be able to adopt files and the indexer mode will not be available

Is this an issue? The indexer mode seems to be working but the message makes me unsure.

Related, if I instead set the ReadOnly option to false and instead use a Lua script to filter HTTP requests, such as with:

{
  "Plugins" : [ "." ],
  "LuaScripts" : [
    "./filter.lua"
  ],
  "OrthancExplorer2" : {
    "Enable": true,
    "IsDefaultOrthancUI": true,
  },
  "RemoteAccessAllowed" : true,
  "ReadOnly" : false,
  "AdvancedStorage": {
    "Enable": true,
    "Indexer": {
      "Enable": true,
      "Folders": ["...path...to...data..."],
      "TakeOwnership": false
    }
  }
}
function IncomingHttpRequestFilter(method, uri, ip, username, httpHeaders)
  if method == 'GET' then
      return true
   else
      return false
   end
end

Then the DICOM instances don’t show up in the Orthanc Explorer 2 (though they do show up in the Legacy UI). Any thoughts or comments on best practices for developing a read-only environment while using advanced storage.

Hi,

I think I have added this message at the beginning of the development and I must admit that I have not really tested the indexer mode in ReadOnly :frowning: .
It probably works because you are still using SQLite but, as soon as you start using PostgreSQL, in ReadOnly mode, we’ll only create ReadOnly transactions and writing to the DB won’t be possible anymore.

There are a few options (considering that you are using PostgreSQL):

  • Deploy 2 orthanc instances connected to the same DB, one that is not available for your users with ReadOnly: false that will perform the indexing. The second one with ReadOnly: true for your users.
  • If your won’t change, first start Orthanc with ReadOnly: false and perform the index and then, start it with ReadOnly: true and allow your users to browse it.
  • Implement user access rights with the Authorization service to prevent your users to delete/modify data.

OE2 makes POST requests to /tools/find while the basic browsing in the legacy UI only uses GET but, as soon as you’ll use the “Do lookup” button, it will also use a POST.

Hope this helps,

Alain

1 Like

Thanks again, @alainmazy. Very helpful.

I figured OE2 must be making more than just GET requests which was the issue, thanks for confirming.

If your won’t change, first start Orthanc with ReadOnly: false and perform the index and then, start it with ReadOnly: true and allow your users to browse it.

Just to confirm, if the data won’t change, I can first start up Orthanc with full read-write permissions to perform the PostgreSQL indexing. Then once the indexing is complete, enable read-only mode and allow users to interact with Orthanc that way. Is this correct?

Yes, that’s correct.