Orthanc Upgrade via Docker

Hello everyone, I am looking to get some help upgrading my Orthanc Server from v1.5.8 to the latest one, v1.12.10. I am currently using docker & a docker compose file for Orthanc. I am also using postgres for indexing only.

After some digging and hair pulling lol I believe I have a new docker-compose file setup correctly to migrate the database if needed and to run the latest version of Orthanc & Postgres. Can someone please help me? Am I on the right path? I’m worried about the database and the postgres index.

On a slightly related note, if I want to dump postgres and have Orthanc take care of index and storage, is that possible?

Any help would be greatly appreciated!

My current docker-compose.yml file:

version: "3"
services:
    pacsIP: #used to be orthanc
        image: jodogne/orthanc-plugins:1.5.8
        depends_on:
            - orthanc-index
        restart: unless-stopped
        ports:
            - "4242:4242"
            - "8042:8042"
        volumes:
            - ./data/storage:/var/lib/orthanc/db
            - ./config/orthanc13.json:/etc/orthanc/orthanc.json

    orthanc-index:
        image: postgres:9
        restart: unless-stopped
        volumes:
            - ./data/index:/var/lib/postgresql/data:Z

Here is a modified docker-compose.yml file that will hopefully upgrade everything without issues.

version: '3.1'  # Secrets are only available since this version of Docker Compose
services:
  orthanc:
    image: jodogne/orthanc-plugins:1.12.10 /etc/orthanc --upgrade
    command: ./config/  # Path to the configuration files (stored as secrets)
    depends_on:
            - orthanc-index
        restart: unless-stopped
    ports:
      - 4242:4242
      - 8042:8042
    volumes:
            - ./data/storage:/var/lib/orthanc/db
    secrets:
      - orthanc.json
secrets:
  orthanc13.json:
    file: orthanc13.json

orthanc-index:
        image: postgres:latest
        restart: unless-stopped
        volumes:
            - ./data/index:/var/lib/postgresql/data:Z

Hi,

Note: you can not upgrade PG version simply by changing the posgresql image. Here is a sample procedure to upgrade PG.

Then, once you have upgraded PG, you can upgrade Orthanc by simply changing the Docker image. However, note that the jodogne/orthanc-plugins:1.12.10 images contains an outdated version of the postgresql plugin. You should use orthancteam/orthanc:26.1.0 to have the latest version of all plugins.

In any case, I recommend repeating the upgrade procedure on a separate docker-compose (with other volumes) so you can make sure everything is under your control before applying the upgrade on the production system.

Hope this helps,

Alain.

That helps a lot, thank you! I definitely skipped over upgrading the postgres database, so I appreciate you pointing that out. Saves me a big headache later lol I was actually thinking moving away from postgres and just orthanc’s default indexing to avoid issues like this in the future. Not sure how doable that is…

In my Docker-compose file, would I change the image line to the following to do the upgrade?

image: orthancteam/orthanc /etc/orthanc --upgrade

I’ll repeat myself:
In any case, I recommend repeating the upgrade procedure on a separate docker-compose (with other volumes) so you can make sure everything is under your control before applying the upgrade on the production system.

Then you’ll realize this line is not valid … You MUST understand what you do before you start the upgrade … or feel free to hire a pro who can assist you.

That’s what I am trying to do, understand exactly what my upgrade options are and how to best go about it :grinning_face: I just wasn’t sure if the orthancteam docker image used the same /etc/orthanc –upgrade option or not since I could not find that in the documentation. I did not want to assume.

I already cloned the VM to test, not a chance I do this on production without multiple upgrade tests to see what happens. I do appreciate your help! :grinning_face:

1 Like

This post is an update on what I ended up doing. I hope it helps someone.

Instead of upgrading Orthanc and Postgres in my current VM and deal with potential upgrading issues, I decided it would be best to just create a new VM and try to reimport the DICOM images into a fresh database using the newest versions of Orthanc & Postgres. My line of thinking of was, this might be much cleaner, easier and faster to do it this way instead of trying to upgrade Orthanc & Postgres in the current production version.

Here is what I did.

After creating the new VM, I first created an Orthanc directory that would contain the configuration files (docker compose file, orthanc config, etc.) for Orthanc. The folder hierarchy looks like this:

/opt/
–– orthanc
   |-- ImportDicomFiles.py
   |-- compose.yml
   |-- configuration.json
   |-- ohif.js
   |-- orthanc-index
   |-- orthanc-storage

I then copied the directory that contains the DICOM images from the old VM to the orthanc-storage folder on the new VM.

I then created the compose.yml file for Orthanc. Here is the one I used. Since I was going to use the orthancteam docker image, I based my configuration off the example found here: orthanc-setup-samples/docker/postgresql at master · orthanc-server/orthanc-setup-samples · GitHub

Please note, it is recommended to shut off or remove the Verbose options once you have everything working. I currently have them enabled because I am still testing other configuration options.

services:

  orthanc:
    image: orthancteam/orthanc
    depends_on: [orthanc-index]
    restart: unless-stopped
    ports: ["4242:4242", "8042:8042"]
    volumes: ["./orthanc-storage:/var/lib/orthanc/db", "./ImportDicomFiles.py:/etc/orthanc/ImportDicomFiles.py:ro", "./ohif.js:/etc/orthanc/ohif.js:ro"]
    environment:
      VERBOSE_STARTUP: "true"
      VERBOSE_ENABLED: "true"
      PYTHON_PLUGIN_ENABLED: "true"
      OHIF_PLUGIN_ENABLED: "true"
      OSIMIS_WEB_VIEWER1_PLUGIN_ENABLED: "true"
      STONE_WEB_VIEWER_PLUGIN_ENABLED: "true"
      DICOM_WEB_PLUGIN_ENABLED: "true"
      POSTGRESQL_PLUGIN_ENABLED: "true"
      GDCM_PLUGIN_ENABLED: "true"
    secrets:
      - configuration.json

  orthanc-index:
    image: postgres:15
    restart: unless-stopped
    ports: ["5432:5432"]
    volumes: ["./orthanc-index:/var/lib/postgresql/data"]
    environment:
      POSTGRES_HOST_AUTH_METHOD: "trust"

secrets:
    configuration.json:
      file: configuration.json

volumes:
  orthanc-storage:
  orthanc-index:

You will notice that I had to create the ImportDicomFiles.py. I did this because I found no other way to get this script inside the container. There might be a better, easier way but I did not find it. All I did to create this file was go to orthanc: 9551353f3e03 OrthancServer/Resources/Samples/ImportDicomFiles/ImportDicomFiles.py and save it locally to my VM. I did not modify this file in any way.

Next, I modified the Orthanc configuration file. Here is what my orthanc configuration file looks like. Use your own registered user information. I changed all the sensitive information below from what I am actually using :slight_smile:

{
  "Name": "OrthancTEST1",
  "DicomAet": "TESTS1",
  "RemoteAccessAllowed": true,
  "AuthenticationEnabled": true,
  "PostgreSQL": {
          "EnableIndex": true,
          "EnableStorage": false,
          "Port": 5432,
          "Host": "orthanc-index",
          "Database": "orthanc",
          "Username": "orthanc",
          "Password": "orthanc",
          "EnableSsl": false,
          "Lock": false,
          "EnableVerboseLogs": true
  },
  "RegisteredUsers": {
     "user1": "user1",
     "user2": "user2"
   },
  "OHIF" : {
    "DataSource" : "dicom-web",
    "UserConfiguration" : "/etc/orthanc/ohif.js"
   }
}

Finally, with everything in place, it was time to start Orthanc and do the reimport!

So, I went to the orthanc directory and ran docker compose up so I could see the output. In a separate terminal, I went to the orthanc directory and ran docker exec -it orthanc-orthanc-1 /bin/bash to get into the orthanc container. Once inside, I went to the /etc/orthanc folder.

From there, I ran: pip3 install httplib2 --break-system-packages I had to install the httplib2 package because ImportDicomFiles.py errored out the first time I ran it because that package was missing.

After httplib2 was installed, I finally ran: python3 ImportDicomFiles.py 192.168.0.10 8042 /var/lib/orthanc/db/ user1 user1 and the import started! Success!

The IP address in the ImportDicomFiles.py command I last ran is the IP address of the VM itself. I also had to add the username and password of the user I created in the orthanc configuration. If you are not going to have authentication for Orthanc and you omit the RegisteredUser stuff in the Orthanc configuration, then you would run the ImportDicomFiles.py command like this: python3 ImportDicomFiles.py 192.168.0.10 8042 /var/lib/orthanc/db/

My DICOM images are imported and everything is running good so far. I am still trying to tweak some settings regarding OHIF, but that’s a different problem for a different post lol

I really hope this helps someone who finds themselves in the same boat I was. There is probably a much better and easier way, but I couldn’t find it.

1 Like