Orthanc + MySQL + docker compose

I am looking for reference docker-compose yml file that uses MySQL for Orthanc.
So far, I only came across a couple from Github and both use Osimis setup or derivative from Osimis.
I would like to use a generic Orthanc setup (like pulling the Orthanc image from jodogne and not from a third party)
Currently, I have some issue setting up the volumes & environments in the yml file. So, looking for a reference.

Can someone point out where I can get such a compose yml file for MySQL?
Thanks in advance.
Sorcerer

Additional note:
My current yml file is below: It works on its own. Aka, Orthanc runs and I can upload an image study to prove that it works.
But I am not sure my current yml is really correct as I am trying to modify a Github example where it shown a demo on “Orthanc (using PostgreSQL) + OHIF” and I want to change it to “Orthanc (using MySQL) + OHIF”
Here is my current yml file:

version: “3”
services:
orthanc:
image: jodogne/orthanc-plugins:latest
depends_on: [mysqldb]
ports: [“4242:4242”, “9080:8042”]
volumes: [“mysqldata:/var/lib/orthanc”]
environment:
MYSQL_HOST: mysqldb
MYSQL_DB: orthanc
restart: unless-stopped
mysqldb:
image: mysql:latest
volumes: [“mysqldb:/var/lib/mysql”]
environment:
MYSQL_DATABASE: orthanc
restart: unless-stopped
volumes:
mysqldata:
mysqldb:

Indeed, do check that the database is really used. AFAIK these environment
variables are only supported on the Osimis image[1]. This would mean Orthanc
ignores them in your case and _actually_ uses the default SQLite backend
instead.

That being said, they're for convenience only: this image merely runs a few
"setup procedures" to write the appropriate JSON configuration files based
on those environment variables. If you want to use the image built by SJ,
you'll want to derive an image of your own on top of it (e.g. with a
Dockerfile) to add your own configuration files (in this case see [3] for
reference and/or [4] for what the setup procedure otherwise does). There are
examples in [2][5]. Alternatively you can bindmount them from the Docker
host but we don't usually recommend that for various reasons (sharing
volumes across containers and hosts in general is sometimes unnecessarily
tricky).

Disclaimer: I work at Osimis.

Incidentally, if you have any feedback regarding the Osimis images, we'd be
very grateful for it!

[1]
https://osimis.atlassian.net/wiki/spaces/OKB/pages/26738689/How+to+use+osimis+orthanc+Docker+images#H
owtouseosimis/orthancDockerimages?-MySQL
[2] https://bitbucket.org/osimis/orthanc-setup-samples/
[3] https://book.orthanc-server.com/plugins/mysql.html
[4]
https://bitbucket.org/osimis/orthanc-builder/src/master/docker/orthanc/setup.d/mysql.sh
[5]
https://osimis.atlassian.net/wiki/spaces/OKB/pages/26738689/How+to+use+osimis+orthanc+Docker+images#Howtouseosimis/orthancDockerimages?-Addingyourownconfiguration

Quick sidenote:

        orthanc:
                ...
                volumes: ["mysqldata:/var/lib/orthanc"]
                environment:
                        MYSQL_HOST: mysqldb

Once you have this working you'll probably want to change this volume
definition.

* If you're only using MySQL for indexing (OrthancMySQLIndex setting), then
you should rename the volume from `mysqldata` to `storage` or `dicom-
storage` since it will not contain anything specific to MySQL.

* If you're using MySQL for both indexing and storage (OrthancMySQLStorage
setting) then AFAIK you can remove the volume altogether as the directory
will not be used. Do check first to make sure!

Hello,

I’m trying to connect Orthanc to MySQL using Docker. My .yaml file has the orthanc service and the mysql_bd service.

orthanc-server:
environment:

ORTHANC__MYSQL_PLUGIN_ENABLED: “true”
ORTHANC__MYSQL_INDEX_ENABLED: “true”
ORTHANC__MYSQL_STORAGE_ENABLED: “true”
ORTHANC__MYSQL_HOST: mysql_db
ORTHANC__MYSQL_PORT: “3306”
ORTHANC__MYSQL_DB: “orthanc”
ORTHANC__MYSQL_USER: “orthanc”
ORTHANC__MYSQL_PASSWORD: “”

mysql_db:
image: mysql:8.0.19
command: --default-authentication-plugin=mysql_native_password
restart: always
#ports:

- 7001:3306

environment:
MYSQL_ROOT_PASSWORD:
MYSQL_DATABASE: orthanc
MYSQL_USER: orthanc
MYSQL_PASSWORD:

I already tried everything that I could remember but nothing works. Orthanc keeps using SQLite:

orthanc-server_1 | W1112 19:34:48.389390 OrthancInitialization.cpp:293] SQLite index directory: “/var/lib/orthanc/db”
orthanc-server_1 | W1112 19:34:48.392685 OrthancInitialization.cpp:370] Storage directory: “/var/lib/orthanc/db”

I connect my Orthanc instance on my PC to a container running the MySQL database using the same configs I put here (the MySQL configs I wrote on the mysql.json). However, I’m can’t make everything work together.
Does anyone knows what the problem is?

Thanks!

A domingo, 15 de março de 2020 à(s) 21:25:50 UTC, t...@osimis.io escreveu:

Hi Clasus,

To configure orthanc using environmental variables like that you will need to ensure you’re using the osimis/orthanc images that are later than 20.04(?). Your yml file doesn’t appear to include which docker image you’re using.

There is an example on how to set up orthanc with MySQL here https://bitbucket.org/osimis/orthanc-setup-samples/src/master/docker/mysql/

Hth

James

Binary Logo

James Manners • Director
Suite 3, Level 2, 10 Queens Road, Melbourne, Victoria 3004, Australia

T: 03 9017 5230 M: 0422 973 235 E: james@binary.com.au W: binary.com.au

Hi James,

Thanks for your answer. I’m runing the latest image version or osimis/orthanc (I downloaded it a couple weeks ago).

I found that example and changed my .yaml file to match that one but I’m still getting this error
E1112 19:59:21.967942 PluginsManager.cpp:164] MySQL error (2002,HY000): Can’t connect to MySQL server on ‘mysql_db’ (115)

Any idea?

A quinta-feira, 12 de novembro de 2020 à(s) 20:07:06 UTC, ja…@binary.com.au escreveu:

Hi Clasus,
Can you post you new yml file?
James

Binary Logo

James Manners • Director
Suite 3, Level 2, 10 Queens Road, Melbourne, Victoria 3004, Australia

T: 03 9017 5230 M: 0422 973 235 E: james@binary.com.au W: binary.com.au

I solved the problem which was: I was not waiting enough time. Since my pc is not that good, the mysql setup wasn’t completed and Orthanc was trying to connect to the database which does exists at the time. While Mysql service is starting, the Orthanc one keeps giving errors but as soon as the first completes, Orthanc starts normally.

I have 2 more doubts.

ORTHANC__REGISTERED_USERS: |
{“demo”: “demo”}

Can you explain or where can I find more info about what this does?
The other one is caused by that env variable that seems to de deprecated but I did not found the new one.
WARNING: You’re using a deprecated environment variable name: WVB_STUDY_DOWNLOAD_ENABLED
orthanc-server_1 | WARNING: ************* you are using deprecated settings, these deprecated settings will be removed in June 2021 *************

Thanks for your time!

A quinta-feira, 12 de novembro de 2020 à(s) 20:18:44 UTC, ja…@binary.com.au escreveu:

Hi Clasus,

That’s great to hear that things are working now.

In regards to the registered users, please see https://book.orthanc-server.com/faq/authentication.html

I can’t comment on the deprecated environment variable. But from the error of this is a variable you are using, you will need to change it to the new environmental variable format as described https://book.orthanc-server.com/users/docker-osimis.html

James

Binary Logo

James Manners • Director
Suite 3, Level 2, 10 Queens Road, Melbourne, Victoria 3004, Australia

T: 03 9017 5230 M: 0422 973 235 E: james@binary.com.au W: binary.com.au

Hi James,

I hope you can help me again. I’m trying to replicate the containers to host another pacs instalation but something is not right. Although, Orthanc service starts, I can’t upload a study for that instance. Here’s my .YAML file

version: “3.3”
services:
orthanc-server:
image: osimis/orthanc:20.11.1
depends_on: [mysqldb2, orthanc-auth-service]
restart: unless-stopped
ports: [“9002:8042”, “9003:4242”]
volumes:

  • ~/STORAGE/Storage_2/ORT/:/var/lib/orthanc/db:Z
    environment:
    ORTHANC__NAME: “OrthancServer”
    OSIMIS_WEB_VIEWER1_PLUGIN_ENABLED: “true”

ORTHANC__MYSQL_PLUGIN_ENABLED: “true”
ORTHANC__MYSQL__HOST: mysqldb2
ORTHANC__MYSQL__USERNAME: orthanc
ORTHANC__MYSQL__DATABASE: orthanc
ORTHANC__MYSQL__PASSWORD:
ORTHANC__MYSQL__ENABLE_STORAGE: “true”

mysqldb2:
image: mysql:8.0.19
command:
[
mysqld,
–default-authentication-plugin=mysql_native_password,
–log-bin-trust-function-creators=1,
]
restart: always
environment:
MYSQL_ROOT_PASSWORD:
MYSQL_DATABASE: orthanc
MYSQL_USER: orthanc
MYSQL_PASSWORD:
volumes:

  • ~/STORAGE/Storage_2/BD/:/var/lib/mysql:Z

I have successfully created the containers for the first instance and they are working. However, if I try to create another instance things doesn’t work. I changed the mysqldb service name (added “2” since I thought it could be the name). I made the same this for the orthanc server service but still no luck.

Do you know what the problem is and how can I solve it? Btw, the problem with the env variable was the name as you said.

A quinta-feira, 12 de novembro de 2020 à(s) 21:16:40 UTC, ja…@binary.com.au escreveu:

Hi Clasus,

That looks good to me. I’m assuming your having difficulties sending to orthanc with a Dixon connection? If so you will need to configure orthanc with your remote modality by setting RTHANC__DCIOM_MODALITIES environmental variable like this example https://bitbucket.org/osimis/orthanc-setup-samples/src/master/docker/dicom-association/docker-compose.yml. This page https://book.orthanc-server.com/integrations/modality.html?highlight=modality explains it.

I’m guessing a bit because I don’t know your exact setup.

James

Binary Logo

James Manners • Director
Suite 3, Level 2, 10 Queens Road, Melbourne, Victoria 3004, Australia

T: 03 9017 5230 M: 0422 973 235 E: james@binary.com.au W: binary.com.au

Hello James,

Let me thank you for your time and your help!
I tried to send from my pacs (the one I have in my pc) to the remote one (both are connected to the same network). I already had that configured and it works for the first instance but not for the second one. Since I couldn’t send the study that way, I accessed the web interface and tried to load directly there but again, I couldn’t.

What I have is a server and I want to be able to run multiple instances (containers) of orthanc+mysql on that server. For example, I want Orthanc1+Mysql1, Orthanc2+Mysql2 in the same host (server).

A sexta-feira, 13 de novembro de 2020 à(s) 21:02:04 UTC, ja…@binary.com.au escreveu:

Hi,

So after spending some time trying to understand why the upload failed, I finally got it. The problem was related with the authorization plugin which I have enabled. With that it’s not possible to upload the files directly on the website and you cant see them (at least with my rules). However, it’s possible to send the studies from an instance to another if you configure the Dicom Modalities which is great!

A sábado, 14 de novembro de 2020 à(s) 16:07:15 UTC, Clasus escreveu:

Hi Clasus,

Thanks for getting back to us with what happened. It will help others. Sorry I didn’t get a chance to get back to you.

James

Binary Logo

James Manners • Director
Suite 3, Level 2, 10 Queens Road, Melbourne, Victoria 3004, Australia

T: 03 9017 5230 M: 0422 973 235 E: james@binary.com.au W: binary.com.au