Custom configuration file + docker + google cloud run

I have a custom configuration file that I want loaded when orthanc runs.
Its only got a few basic things in like name change, adds some registered users etc.
This is meant to augment the default config file (stored in /etc/orthanc)

This seems very easy (!) when running the orthanc from the command line
e.g.

$ docker run -p 4242:4242 -p 8042:8042 --rm /tmp/orthanc.json:/etc/orthanc/orthanc.json:ro jodogne/orthanc:1.11.0
(Source)

However when I run in the cloud I cant get it to see my file.
I have tried specifying the path to ‘container arguments’ field of the Cloud Run setup

Notes:

  • Im using the jodogne/orthanc Docker image. (1.11)
  • Im running the container using Google cloud Run (as an http service)
  • Within my dockerfile I COPY my custom configuration file to the container (root directory)
  • I cant use docker compose because Cloud Run doesnt support it.
  • I cant use ‘secrets’ to hold the config unless i set up a volume mount point but i dont think i want to go down that path. More like, I dont think I need to.
    If anyone has any insight I would be most grateful! I feel like it could be something very easy to sort out… and maybe its a problem with Google cloud Run more than anything else which i appreciate is not the focus of this group :slight_smile:

Thought I would give it a shot!

Kind regards,
Joe

Hello,

As you guess, Google doesn’t support the Orthanc project by providing the Orthanc developers with a free test account on their cloud platform, so I cannot provide any definitive answer.

Nonetheless, I would suggest you to try and protect the sensitive information inside it through the setting of environment variables:
https://book.orthanc-server.com/users/configuration.html#environment-variables

HTH,
Sébastien-

Thanks Sébastien, thats a good idea.
I tried loading the config as a secret environment variable: ORTHANC_JSON as suggesed in documentation.
Unfortunately my custom config values are not loading? Im simply testing to see if my new users get regsitered.
Google cloud logs dont give much help.
I think i will have to get deeper into the orthanc logs.

Im still hoping ive just missed something simple in my container setup…

Hi Joe,

Note: my experience is mostly in running the Osimis Docker image (https://hub.docker.com/r/osimis/orthanc ) in Docker and on Kubernetes, so not 100% sure it applies to the image you are using.

Besides the ORTHANC_JSON env var, you can override specific configuration elements using environment variables, might be convenient if oneliners are needed:

ORTHANC__REGISTERED_USERS={“demo”: “demo”}

More documentation and examples at https://book.orthanc-server.com/users/docker-osimis.html

I’d advise you to test the configuration in a local docker-compose.yaml (see aforementioned docs) before deploying to Cloud Run.

Finally, I guess you’re taking first steps, but at some point you’ll need to consider an external database and file storage as well :slight_smile:

Regards
Walco

Hi Walco,

Thanks for your reply.

Unfortunately I can’t use docker compose with google cloud. it is not supported.
I don’t understand why, but I could not get orthanc to pick up environment variables, specifically ORTHANC_JSON, although i did try others.
I was able to put my config into a google cloud ‘secret’ and expose this as both an environment variable (ORTHANC_JSON) and also as a mounted file at /run/secrets/ and /etc/orthanc/. Again, nothing was recognised.

In the end I got my config loaded by simply copying it within my docker file i.e.
COPY orthanc.json /etc/orthanc/

It’s not ideal because the passwords are plain text but it’s also fine for a demo.

I am definitely still keen to understand where i’ve gone wrong!

At least I can continue and as you say - now I need to think about storing the DICOM files…

Kind regards,
Joe

Hi Joe,

Which images are you using? The ORTHANC_JSON environment variable is only recognized by the osimis/orthanc Docker images. With these images, you may also define VERBOSE_STARTUP at true to have a better view of what’s going on at startup wrt generating the configuration and loading plugins.

HTH,

Alain.

This was the solution…

I had been using the jodogne/orthanc images!

Thank you Alain.