galaxyproject / galaxy

Data intensive science for everyone.
https://galaxyproject.org
Other
1.41k stars 1.01k forks source link

Per-host configuration ignored for some hostnames #17664

Open neoformit opened 8 months ago

neoformit commented 8 months ago

Relates to "per-host configuration" of Galaxy: https://github.com/galaxyproject/galaxy/pull/12328

Galaxy Version and/or server at which you observed the bug Galaxy Version: 23.2.1.dev0 https://dev.gvl.org.au/ Commit: 8bda304592e448510470ba94594ee64357d969c4

I am trying to set the default_panel_view as a by_host parameter. However, when I set the following in galaxy.yml on Galaxy AU Dev it seems to have no effect. The tool panel loads the normal default:

    default_panel_view_by_host:
      proteomics.dev.gvl.org.au: proteomics

However, when I try to replicate the bug locally, the following seems to work fine i.e. I get proteomics as the default panel when I open the site on http://localhost/:

    default_panel_view_by_host:
      localhost: proteomics

So it seems like this feature works, but for some hostnames it stops working?

Additional context I can confirm the same pattern with support_url_by_host (works locally, not on dev.gvl.org.au), so this seems to be a general issue with the _by_host feature and not limited to the default_panel_view param:

WORKS: default_tool_panel: proteomics NOT WORKING: default_tool_panel_by_host: dev.gvl.org.au NOT WORKING: default_tool_panel_by_host: proteomics.dev.gvl.org.au NOT WORKING: support_url_by_host: dev.gvl.org.au NOT WORKING: support_url_by_host: proteomics.dev.gvl.org.au WORKS (local): support_url_by_host: localhost/127.0.0.1

neoformit commented 8 months ago

So I added the following lines to galaxy/config/init.py#813:

            for host_key, host_val in per_host.items():
                if per_host_option == 'support_url_by_host':
                    log.info(f"LOADING SUPPORT URL | host: {host}, host_key: {host_key}, host_val: {host_val}")

With the following galaxy.yml config:

support_url_by_host:
  'dev.gvl.org.au': https://site.usegalaxy.org.au/help
  'proteomics.dev.gvl.org.au': https://google.com 

And on dev.gvl.org.au this produces the following logs on request of proteomics.gvl.org.au:

LOADING SUPPORT URL | host: proteomics.gvl.org.au, host_key: dev.gvl.org.au, host_val: https://site.usegalaxy.org.au/help

Now, looking at the code in config/init.py, it obviously matches the first key that is a substring of host.

So, when using this feature for subdomains, this won't work:

support_url_by_host:
  'dev.gvl.org.au': https://site.usegalaxy.org.au/help
  'proteomics.dev.gvl.org.au': https://google.com 

... but this will:

support_url_by_host:
  'proteomics.dev.gvl.org.au': https://google.com
  'dev.gvl.org.au': https://site.usegalaxy.org.au/help 

I will link this from the PR so that others can see this issue. @jdavcs I'll leave it up to you whether this is a bug or a feature!

neoformit commented 8 months ago

Also note that default_panel_view is not listed as per_host in config_schema.yml:

https://github.com/galaxyproject/galaxy/blob/43b6eb2e1f200eb25d710995af4fdb8e762314a5/lib/galaxy/config/schemas/config_schema.yml#L2662-L2670

So this will not work for John's intended use case (which is also my intended use case!) until we fix that. I'll make a PR for this.

neoformit commented 8 months ago

So I updated the config_schema.yml and that got me this log line (when opening proteomics.dev.gvl.org.au in the browser) to show that the per_host param selection is working:

LOADING 'default_panel_view_by_host' WITH host: proteomics.dev.gvl.org.au, host_key: proteomics.dev.gvl.org.au, host_val: proteomics

... but the default tool panel is still loaded!

I can set the default panel view globally as follows, and that works OK:

default_panel_view: proteomics

So for some reason it's only when default_panel_view comes from a per_host config that it stops working.

neoformit commented 6 months ago

@jdavcs should I open a separate issue for the above?

jdavcs commented 6 months ago

@neoformit Sorry for the delay! I was able to reproduce. Working on it now, so no need for a separate issue.

neoformit commented 6 months ago

Amazing, thanks! This has been a blocker for me for quite a few months now. Also just had some trouble with themes_config_file_by_host along the same lines...

nomadscientist commented 4 months ago

This is now a blocker for the great single-cell subdomain unification as well! Can this please be fixed??? @natefoo <--- I think this is what is blocking you for this, right?

mvdbeek commented 4 months ago

For default_panel_view that's fixed in https://github.com/galaxyproject/galaxy/pull/18471, if other options aren't working it's a good idea to check that the per_host schema option is set and that the config values are parsed as in that PR.