Next step I'm looking to put Orthanc with Postgres in a single
container. Use case many self contained slightly more scalable than
50k (sqlite) mini research PACS.
We use Orthanc and Postgres routinely in production, this is a great
solution. However, I second Erik Anderson in saying you shouldn't run
PG inside the same Docker container as Orthanc. If you're looking for a
technology that supports this kind of use-case, you may look at LXD.
When it comes to Docker, the standard approach is to run one logical
service per container. For background information on this, look for
various articles around the theme "A Docker container is not a VM".
You can easily describe this with a tool like docker-compose:
[docker-compose.yml]
version: "2"
services:
orthanc:
build: orthanc
depends_on: [orthanc-index]
restart: unless-stopped
ports: ["104:4242", "80:8042"]
volumes: ["orthanc-storage:/var/lib/orthanc/db"]
orthanc-index:
image: postgres
restart: unless-stopped
volumes: ["orthanc-index:/var/lib/postgresql/data"]
volumes:
orthanc-storage:
orthanc-index:
[orthanc/Dockerfile]
FROM jodogne/orthanc-plugins
COPY orthanc.json /etc/orthanc/
[orthanc/orthanc.json]
{
"Name": "Foo",
"Plugins": ["/usr/share/orthanc/plugins"],
"DicomAet": "FOO",
"DicomModalities": {
"bar": ["BAR", "bar", 104]
},
"RemoteAccessAllowed": true,
"PostgreSQL": {
"EnableIndex": true,
"EnableStorage": false,
"Host": "orthanc-index",
"Database": "postgres",
"Username": "postgres"
}
}
Does anyone have a VM image with Orthanc with Postgres?
- such that DB configs reference localhost.
You can create the above files in a directory in a VM, then issue
"docker-compose up -d" and you should be good to go (use ports 104 and
80 of the VM to connect to Orthanc).
Regarding Swarm, you'll have to adapt this to a Docker "stack" file;
the format is mostly compatible with docker-compose and may eventually
supplant it. You have to pay attention to persistent volumes however,
which you don't want spread across nodes mindlessly. Leads: consider
using a distributed filesystem for Orthanc storage, or a key/value
store with associated plugin, or even a Postgres database with
"EnableStorage": "true". For the index, only use one replica and
consider things like CloudStor or other solutions that will ensure the
data is always where the container is running (or accessible from
there). PG also has built-in replication capabilities to explore.
I suggest starting small, though scaling does get interesting ;).
Stateless services are usually easy to work with, especially with a
solution like Swarm or K8s, but state is often a little bit of a
challenge.