Installing multiple instances on single server?

Hello,

First post from a short time user of this slick application.

Previous posts on the discussion group have suggested the capability of having multiple instances of Orthanc on a single server and I would like to do this.

How would one go about this for a Windows system?

The command to create a service is ‘sc create’ so I expect it would be something like :

sc create Orthanc2 binpath= ""c:\program files (x86)\Orthanc\Orthanc Server 1.0.0\Orthanc-1.0.0-Release.exe" E:\Orthanc_data\Configuration2.json " start= auto DisplayName= Orthanc-Physics
(Note additiona quotes and escape characters in order to handle spaces in the exe path).

This successfully creates the service but it will not start.I notice that the “path to executable” for this created service contains the quotes and the config file whereas the default service just has the exe path without quotes and no config filename, but is this significant?

Running the above exe from the command line starts and runs OK, however, so the service doesn’t seem to be failing to run due to a config file issue. The command used for this test was actually:
“c:\program files (x86)\Orthanc\Orthanc Server 1.0.0\Orthanc-1.0.0-Release.exe” E:\Orthanc_data\Configuration2.json

So the bits I am unclear about for running a second instance are:-

  1. how to get it running as a 2nd service?
  2. how to get it to write to a (preferably separate) log file? It is hard to identify any problems without this.
  3. and also I am curious as to how the application know where the orthanc_data folder is for the new instance as it isn’t in the config file or the registry as far as I can tell?

Any suggestions appreciated,

Gary

Hello,

(1) Yes, multiple instances of Orthanc can run on a single server.

In such situations, I would highly recommend you to favor a Linux server. Indeed, creating a Windows service (as the one that is shipped by the Orthanc project) is a complex task. Read for instance the following link:
http://stackoverflow.com/questions/3582108/create-windows-service-from-executable

But, the official “Orthanc-1.0.0-Release.exe” binary does not implement the “ServiceMain” callback function by itself:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms685138(v=vs.85).aspx

As a consequence, this binary cannot be run as such as a service. You will have to create a C or C# wrapper service above the Orthanc command-line server. There are many tutorials around, e.g. on CodeProject:
http://www.codeproject.com/Articles/106742/Creating-a-simple-Windows-Service

http://www.codeproject.com/Articles/499465/Simple-Windows-Service-in-Cplusplus

(2) The official Windows service of Orthanc will put its logs inside a “Logs” directory next to the data folder.

(3) The parameters of the Windows service are stored in the registry, inside the key “HKEY_LOCAL_MACHINE\SOFTWARE\Orthanc\Orthanc Server”.

HTH,
Sébastien-

How to run multiple instances of Orthanc on single linux machine?

Just start multiple instances of Orthanc, with different TCP ports and different path to the databases.

Check out the “HttpPort”, “DicomPort”, “StorageDirectory” and “IndexDirectory” options in the configuration file:
http://book.orthanc-server.com/users/configuration.html

Sébastien-

How set “StorageDirectory” and “IndexDirectory” for different instances for Orthanc server.

use one configuration file per instance of Orthanc.