Changing db to RDB like postgres

Can i change whole db of orthanc to postgres instead of sqllite , please thank you

Hi,

This topic has been addressed here

HTH,

Alain

Thank you for your replying ,
this my docker compose that i have already did ,but still in orthanc storage folder

DOCKER-COMPOSE.YML
pacs:
image: pacs_second
ports: [ “8042:8042”, “4242:4242” ]
volumes:
- pacs-storage:/var/lib/orthanc/db
- ./demo-setup/config.json:/etc/orthanc/orthanc.json
- ./demo-setup/config.json:/root/orthanc.json
depends_on: [ pacs-db ]
env_file:
- ./demo-setup/common.env
environment:
VERBOSE_ENABLED: “true”

pacs-db:
image: postgres:14
volumes: [ “pacs-db:/var/lib/postgresql/data” ]
environment:
POSTGRES_HOST_AUTH_METHOD: “trust”
POSTGRES_PASSWORD: “pacs”
POSTGRES_USER: “pacs”
POSTGRES_DB: “pacsdb”

Orthanc config , postgres plugin config:
“PostgreSQL”: {
“EnableIndex”: true,
“EnableStorage”: true,
“ConnectionUri”: “postgresql://pacs:pacs@pacs-db:5432/pacsdb”,
// “Database”:“pacs-db”,
“Lock” : false,
// //view .yml file
// “Username”: “pacs”,
// “Password”: “pacs”,
“EnableSsl”: false, // New in release 3.0
“MaximumConnectionRetries”: 10, // New in release 3.0
“ConnectionRetryInterval”: 5, // New in release 3.0
“IndexConnectionsCount”: 1, // New in release 4.0
“TransactionMode”: “ReadCommitted”, // New in release 6.0 ||Serializable
“EnableVerboseLogs”: true // New in release 6.0
}

Question :
Will the data be completely saved in the postgres database after replication, instead of being stored in OrthancStorage, or only the metadata part?

Hello,

The configuration that you have posted contains both “EnableIndex”: true and “EnableStorage”: true. Therefore, postgres will be used both for the DB/metadata and for DICOM storage.

Please note that changing your configuration will not remove or migrate the existing files.

If the newly stored files are still saved to the local storage, you might want to post detailed log files

(Why do you map the same file at two locations with - ./demo-setup/config.json:/etc/orthanc/orthanc.json and - ./demo-setup/config.json:/root/orthanc.json ? )

I appreciate your help !

Q : (Why do you map the same file at two locations with - ./demo-setup/config.json:/etc/orthanc/orthanc.json and - ./demo-setup/config.json:/root/orthanc.json ? )
Response Q : its just to make sure that my config will be used , in both case , if orthanc reads the config from /etc/orthanc or in /root

- Orthanc Logs :

W0703 09:14:43.763592 MAIN main.cpp:2049] Orthanc version: mainline (20240506T123311)
W0703 09:14:43.763751 MAIN OrthancConfiguration.cpp:57] Reading the configuration from: “/root/orthanc.json”
W0703 09:14:43.952024 MAIN main.cpp:913] Loading plugin(s) from: /usr/share/orthanc/plugins
E0703 09:14:43.952061 MAIN PluginsManager.cpp:246] Inexistent path to plugins: /usr/share/orthanc/plugins
W0703 09:14:43.952066 MAIN main.cpp:913] Loading plugin(s) from: /usr/local/share/orthanc/plugins
W0703 09:14:43.952400 MAIN PluginsManager.cpp:273] Registering plugin ‘worklists’ (version mainline)
W0703 09:14:43.952412 MAIN worklists:/Plugin.cpp:228] Sample worklist plugin is initializing
W0703 09:14:43.952809 MAIN worklists:/Plugin.cpp:241] The database of worklists will be read from folder: /var/lib/orthanc/WorklistsDB
W0703 09:14:43.953014 MAIN PluginsManager.cpp:273] Registering plugin ‘serve-folders’ (version mainline)
W0703 09:14:43.953393 MAIN serve-folders:/Plugin.cpp:414] ServeFolders: Empty configuration file: No additional folder will be served!
W0703 09:14:43.954457 MAIN PluginsManager.cpp:273] Registering plugin ‘multitenant-dicom’ (version mainline)
W0703 09:14:44.124069 MAIN PluginsManager.cpp:273] Registering plugin ‘delayed-deletion’ (version mainline)
W0703 09:14:44.124378 MAIN delayed-deletion:/Plugin.cpp:315] DelayedDeletion - plugin is loaded but not enabled (no “DelayedDeletion” section found in configuration)
W0703 09:14:44.124721 MAIN PluginsManager.cpp:273] Registering plugin ‘connectivity-checks’ (version mainline)
W0703 09:14:44.124994 MAIN PluginsManager.cpp:273] Registering plugin ‘housekeeper’ (version mainline)
W0703 09:14:44.125015 MAIN housekeeper:/Plugin.cpp:809] Housekeeper plugin is initializing
W0703 09:14:44.125568 MAIN housekeeper:/Plugin.cpp:927] Housekeeper plugin is disabled by the configuration file
W0703 09:14:44.126267 MAIN PluginsManager.cpp:273] Registering plugin ‘postgresql-storage’ (version mainline)
W0703 09:14:44.126760 MAIN postgresql-storage:/PostgreSQLParameters.cpp:108] PostgreSQL: using READ COMMITTED transaction mode
W0703 09:14:45.575861 MAIN postgresql-storage:/StorageBackend.cpp:698] The storage area plugin will retry up to 10 time(s) in the case of a collision
W0703 09:14:45.576843 MAIN PluginsManager.cpp:273] Registering plugin ‘postgresql-index’ (version mainline)
W0703 09:14:45.577488 MAIN postgresql-index:/PostgreSQLParameters.cpp:108] PostgreSQL: using READ COMMITTED transaction mode
W0703 09:14:45.577519 MAIN postgresql-index:/IndexBackend.cpp:2798] The index plugin will use 1 connection(s) to the database, and will retry up to 10 time(s) in the case of a collision
W0703 09:14:45.578186 MAIN PluginsManager.cpp:273] Registering plugin ‘authorization’ (version mainline)
W0703 09:14:45.578217 MAIN PluginsManager.cpp:157] Initializing the authorization plugin
W0703 09:14:45.579410 MAIN authorization:/Plugin.cpp:1221] Authorization plugin: url defined for Token Validation: http://192.168.100.81:8000/tokens/validate, resource tokens validation is enabled
W0703 09:14:45.579435 MAIN authorization:/Plugin.cpp:1232] Authorization plugin: url defined for User Profile: http://192.168.100.81:8000/user/get-profile, user tokens validation is enabled
W0703 09:14:45.579869 MAIN authorization:/Plugin.cpp:1254] Authorization plugin: base url defined for Token Creation : http://192.168.100.81:8000/tokens/
W0703 09:14:45.579913 MAIN authorization:/Plugin.cpp:1417] Authorization plugin: Registering Incoming HTTP Request Filter
W0703 09:14:45.581466 MAIN PluginsManager.cpp:273] Registering plugin ‘python’ (version mainline)
W0703 09:14:45.581496 MAIN PluginsManager.cpp:157] Python plugin is initializing
W0703 09:14:45.582111 MAIN PluginsManager.cpp:157] Using Python script “config.py” from directory: /root/.
W0703 09:14:45.582139 MAIN PluginsManager.cpp:157] Force global loading of Python shared library: /usr/lib/x86_64-linux-gnu/libpython3.7m.so.1.0
W0703 09:14:45.582218 MAIN PluginsManager.cpp:157] Program name: /usr/local/sbin/Orthanc
W0703 09:14:45.773058 MAIN PluginsManager.cpp:273] Registering plugin ‘stone-webviewer’ (version mainline)
W0703 09:14:45.776438 MAIN PluginsManager.cpp:273] Registering plugin ‘orthanc-explorer-2’ (version mainline)
W0703 09:14:45.776942 MAIN PluginsManager.cpp:157] Root URI to the Orthanc-Explorer 2 application: /ui/
W0703 09:14:45.777670 MAIN PluginsManager.cpp:273] Registering plugin ‘dicom-web’ (version mainline)
W0703 09:14:45.778181 MAIN dicom-web:/Plugin.cpp:564] URI to the DICOMweb REST API: /dicom-web/
W0703 09:14:45.778421 MAIN dicom-web:/Plugin.cpp:646] DICOMWeb PublicRoot: /dicom-web/
W0703 09:14:45.778435 MAIN dicom-web:/Plugin.cpp:657] URI to the WADO-URI API: /wado
W0703 09:14:45.778465 MAIN main.cpp:1712] Using a custom database from plugins
W0703 09:14:45.778513 MAIN main.cpp:1723] Using a custom storage area from plugins
W0703 09:14:45.783090 MAIN postgresql-index:/PostgreSQLIndex.cpp:127] The database schema already exists, checking if it needs to be updated
W0703 09:14:45.853832 MAIN main.cpp:1678] The DB latency is 79 ”s
W0703 09:14:45.853866 MAIN HttpClient.cpp:1194] HTTPS will use the CA certificates from this file: /root
W0703 09:14:45.854213 MAIN LuaContext.cpp:94] Lua says: Lua toolbox installed
W0703 09:14:45.854397 MAIN LuaContext.cpp:94] Lua says: Lua toolbox installed
W0703 09:14:45.854667 MAIN ServerContext.cpp:574] Disk compression is disabled
W0703 09:14:45.854684 MAIN ServerIndex.cpp:381] No limit on the number of stored patients
W0703 09:14:45.854690 MAIN ServerIndex.cpp:401] No limit on the size of the storage area
W0703 09:14:45.904407 MAIN ServerContext.cpp:285] Reloading the jobs from the last execution of Orthanc
W0703 09:14:45.904616 MAIN JobsEngine.cpp:272] The jobs engine has started with 2 threads
W0703 09:14:45.904676 MAIN main.cpp:295] Security risk in DICOM SCP: C-FIND requests are always allowed, even from unknown modalities
W0703 09:14:45.904686 MAIN main.cpp:300] Security risk in DICOM SCP: C-FIND requests for worklists are always allowed, even from unknown modalities
W0703 09:14:45.904966 MAIN main.cpp:1319] DICOM server listening with AET PACS on port: 4242
W0703 09:14:45.904994 MAIN HttpServer.cpp:2045] HTTP compression is disabled
W0703 09:14:45.905007 MAIN main.cpp:1050] ====> Remote access is enabled while user authentication is explicitly disabled, your setup is POSSIBLY INSECURE <====
W0703 09:14:45.905014 MAIN main.cpp:1174] Remote LUA script execution is disabled
W0703 09:14:45.905019 MAIN main.cpp:1186] REST API cannot write to the file system bacause the “RestApiWriteToFileSystemEnabled” configuration is set to false. The URI /instances/
/export is disabled. This is the most secure configuration.
W0703 09:14:45.906370 MAIN HttpServer.cpp:1803] HTTP server listening on port: 8042 (HTTPS encryption is disabled, remote access is allowed)
W0703 09:14:45.906403 MAIN main.cpp:925] Orthanc has started

Hi @brokendev (I feel a little bad using your handle to address you :rofl:)

Being given my input above, and your logs that seem to indicate that Postgres is indeed running fine, what is the situation?

As a recap, you should not see any new Dicom resource that you would import into Orthanc being saved to the filesystem storage (...Using a custom storage area from plugins...). Is that so?

Just let us know in case of any pending issue.

There’s no problem, it’s my last file log and I thought it was good, I’d just like to have your opinion,
Thank you for your attention. :sweat_smile:

1 Like