Replacement for old docker /usr/lib/orthanc/setup.d feature

140 views
Skip to first unread message

John Roberts

unread,
Jul 26, 2021, 4:52:09 PM7/26/21
to Orthanc Users
In my older docker setups, I made use of the /usr/lib/orthanc/setup.d folder to drop in my own startup bash scripts that I wanted executed along with Orthanc's own initialization. 

The scripts were for container-specific setup, as for example, maintaining self-signed SSL certs for use by the Orthanc running within the container.  This is in contrast to baking settings into the docker image itself.

I realize the newer Orthanc framework employs python (invoked by the /docker-entrypoint.sh) to perform its initialization.

What might be the best way to migrate my own initialization scripts to the new framework?  I could pull out the existing /docker-entrypoint.sh and modify it to invoke my additional scripts.  In that approach, I would need to regularly check the Orthanc original entrypoint to adopt any changes in my own version.

I don't see a hook in the python initialization that would indicate I could invoke my own python scripts in some directory.

Are there hooks in the Orthanc docker setups for running addendum initialization scripts after the official Orthanc initialization scripts have executed?

Thanks,
John.

Alain Mazy

unread,
Jul 27, 2021, 10:22:19 AM7/27/21
to John Roberts, Orthanc Users
Hi John,

We've never foreseen anything like the hook you mention but I understand that this could be quite useful.

What about defining a "BEFORE_ORTHANC_STARTUP_SCRIPT" env var that would point to your custom script.  If the env var is not set, nothing happens; if set, your script is called ?  Would that solve your problem ?

Any suggestion for a better name for that env var is welcome ;-)

Best regards,

Alain


--
You received this message because you are subscribed to the Google Groups "Orthanc Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orthanc-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/orthanc-users/7c42ebeb-4ba9-4f00-af5d-370a3268c7cen%40googlegroups.com.

John Roberts

unread,
Jul 28, 2021, 12:03:55 PM7/28/21
to Orthanc Users
That seems reasonable.  This is similar to the init script directory in the PostGre docker distribution.

In my case, I launch Orthanc with PostGre using docker-compose.  With the ability to run "first launch" init scripts, I can automatically create the database on the PostGre side as well as generate the SSL certs for the Orthanc container to run in secure mode.

The main reason I need to create the certs up front is that I find Orthanc will abort startup if you turn on SSL, but don't provide the certificates to begin with.  In the docker scenario, aborting Orthanc brings down the container.  I'd like to eliminate having to create the certs before container launch.  

My end goal is a collection of docker-compose, docker, and addendum scripts that will launch a duo SSL enabled Osimis Orthanc/PostGRE setup in one simple docker-compose up command.

John.

Alain Mazy

unread,
Jul 29, 2021, 5:33:21 AM7/29/21
to John Roberts, Orthanc Users
Hi John,



Could you validate it on your side ?  Once Ok, I'll merge it in the master branch.

Best regards,

Alain

John Roberts

unread,
Jul 29, 2021, 1:12:58 PM7/29/21
to Orthanc Users
Hi Alain,

I tested the branch image and it worked great.  My script to create the SSL certs ran and Orthanc started just fine.

Thanks for the quick turnaround.
John.

Alain Mazy

unread,
Aug 2, 2021, 3:00:05 AM8/2/21
to John Roberts, Orthanc Users
Hi John,

Great.  This has been included in v 21.8.0 of the osimis/orthanc images.

Best regards,

Alain

Reply all
Reply to author
Forward
0 new messages