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

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.

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 :wink:

Best regards,

Alain

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.

Hi John,

I’ve implemented it in a branch: https://bitbucket.org/osimis/orthanc-builder/commits/446b874e8940cf39ea5157c770b6abd57c7de00b

Here’s a sample project to demonstrate it: https://bitbucket.org/osimis/orthanc-setup-samples/src/master/docker/custom-startup-script/

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

Best regards,

Alain

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.

Hi John,

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

Best regards,

Alain