How to pass configuration commands to omero inside a docker

I have had problems with OMERO refusing to provide images to x-frame in browser as highlighted in these posts:

Adding the following commands directly do solve my problem:
sh-4.2$ /opt/omero/web/OMERO.web/bin/omero config remove omero.web.middleware ‘{“index”: 6, “class”: “django.middleware.clickjacking.XFrameOptionsMiddleware”}’

sh-4.2$ /opt/omero/web/OMERO.web/bin/omero config set – omero.web.cors_origin_whitelist ‘[“https://moodle.gla.ac.uk”]’

However, this has been a temporary solution as a reboot resets the values.
I just can’t find the format the variables need to be when they are entered as a config for the omero docker.
I tried different type of brackets and other formats without success.
Can anyone provide help?
Many thanks
Joao Miguel

Hi @Joao_Miguel,

if you are already building your own image, then it likely easiest to add a config file to the /opt/omero/server/config directory. See GitHub - ome/omero-server-docker: OMERO.server production docker image for details.

If you are already using docker-compose, the easiest step is likely to set the environment variable omero_web_cors__origin__whitelist. See GitHub - ome/omero-server-docker: OMERO.server production docker image for more details.

All the best,
~Josh

Hi Josh,
I actually was following the information you linked. My problem refers to the format I have to place those two variables, if in simple bracket, double bracket or without bracket. The

‘[“https://moodle.gla.ac.uk”]’

Is accepted but nothing changes on the config while

‘{“index”: 6, “class”: “django.middleware.clickjacking.XFrameOptionsMiddleware”}’

gives me an error when I start:

ERROR: yaml.scanner.ScannerError: mapping values are not allowed here
in “./docker-compose.yml”, line 90, column 51

I tried different ways with single brackets, double and without them, none did work.

I hope now my query is clearer
Many thanks

Joao Miguel

Gotcha. I think the issue may be your quotes. Is it possible that those are unicode rather than ascii ' and "? ~Josh

I did copy them from here and I am doing this on ubuntu.
Also, how do I pass the config remove? CONFIG_remove?
Thanks Josh

Sorry for the trouble, Joao. The quotes that get rendered on the webpage are curly to look nicer, but they need to be replaced on the console. (This is something I’ve tried to fix previously, but I’ll look into it again.)

As for needing to run config remove, in that case you will need to add a .omero file with the contents:

config remove omero.web.middleware '{"index": 6, "class": "django.middleware.clickjacking.XFrameOptionsMiddleware"}'

~Josh

Does this go to the extra.omero file as it is? I thought we need to reformat there with CONFIG without dots and spaces.
Sorry if that is a stupid question
Joao Miguel

No, it’s understandable. The reformatting with the dots is intended to allow passing variables via the environment. The shell doesn’t like having variable names with dots in them!

If you are using the files, it’s not a problem. Each .omero is loaded, line for line, as if you had typed the command at the shell. The only difference is that you don’t need to add the initial omero command in front of each line.

~Josh

Wonderful,
As soon as I understood that omero-server and omero-web were running separated and needed to have their specific .omero file I managed to sort omero-web with the settings you suggested. So, for the omero-web, I have a omeroweb.omero file in the /opt/omero/web/config/ folder (with an external volume entry) which contains the following lines:

config remove omero.web.middleware '{"index": 6, "class": "django.middleware.clickjacking.XFrameOptionsMiddleware"}'
config set -- omero.web.cors_origin_whitelist '["https://myexternalwebsite.com"]'

This have solved the x-frame restriction to all browsers I tested, including firefox, chrome, edge and safari. I tested the most updated versions (including safari on sur). I just hope the browsers don’t change anything again.

Unfortunately, the .omero for omero-server is not being recoginised. It is located at
/opt/omero/server/config/extra.omero with the following lines:

config set omero.jvmcfg.system.memory 32000
config set omero.jvmcfg.percent.blitz 25
config set omero.jvmcfg.percent.pixeldata 25
config set omero.jvmcfg.percent.indexer 15
config set omero.jvmcfg.percent.repository 15

I don’t know why it is not being recognised.
I accept suggestions

Many thanks
Joao Miguel

1 Like

This may be related to the version question. Can you make sure you’re up-to-date as in Omero 5.6.3 error - #2 by joshmoore before I dig further?

~Josh