ome / omero-server-docker

OMERO.server production docker image
https://hub.docker.com/r/openmicroscopy/omero-server/
BSD 2-Clause "Simplified" License
12 stars 26 forks source link

Override omero.db.name #16

Open joshmoore opened 6 years ago

joshmoore commented 6 years ago

In an attempt to deploy PG+OMERO with the minimal characters on the CLI, I tried:

docker run -d --name db -e POSTGRES_USER=omero -e POSTGRES_PASSWORD=omero postgres
docker run --rm --link db test

(This repo uses "omero" rather than "postgres" as a default, but that would be a breaking change)

I get this error:

[jamoore@idr1-slot2 bf-org]$ docker run --rm --link db test
Running /startup/50-config.py
Running /startup/60-database.sh
postgres connection established
Initialising database
2018-02-07 08:58:58,931 [    omego.db] INFO  DbAdmin: DbAdmin OMERO.server ...
2018-02-07 08:58:58,932 [    omego.db] INFO  Failed to lookup parameter omero.db.pass, using omero
2018-02-07 08:58:58,932 [    omego.db] INFO  Failed to lookup parameter omero.db.name, using None
2018-02-07 08:58:58,932 [    omego.db] INFO  Failed to lookup parameter omero.db.user, using omero
Traceback (most recent call last):
  File "/opt/omero/omego/bin/omego", line 9, in <module>
    load_entry_point('omego==0.6.5', 'console_scripts', 'omego')()
  File "/opt/omero/omego/lib/python2.7/site-packages/omego/main.py", line 52, in entry_point
    (Version.NAME, Version)])
  File "/opt/omero/omego/lib/python2.7/site-packages/yaclifw/framework.py", line 197, in main
    ns.func(ns)
  File "/opt/omero/omego/lib/python2.7/site-packages/omego/db.py", line 340, in __call__
    DbAdmin(d, args.dbcommand, args, ext)
  File "/opt/omero/omego/lib/python2.7/site-packages/omego/db.py", line 77, in __init__
    psqlv = self.psql('--version')
  File "/opt/omero/omego/lib/python2.7/site-packages/omego/db.py", line 259, in psql
    db, env = self.get_db_args_env()
  File "/opt/omero/omego/lib/python2.7/site-packages/omego/db.py", line 249, in get_db_args_env
    raise Exception('Database name required')
Exception: Database name required

We could consider this an omego bug (in which case, happy to migrate this), but another option would be to override omero.db.name with the default of omero here as is done with omero.db.host. See https://github.com/openmicroscopy/omero-server-docker/blob/master/60-database.sh#L12

manics commented 6 years ago

It's a feature! https://github.com/ome/omego/pull/30/commits/3b16ece4ecea1b47b9e56f66b50a90c2e38975cc

Open an issue against omego if you think it should be changed

joshmoore commented 6 years ago

What do you think about working around it here?

manics commented 6 years ago

Are the expectations for omero-server-docker different from omego to justify this? If so then we can change it here, if not we should change omego.

joshmoore commented 6 years ago

Well, minimally, omero-server-docker knows if it's initializing or upgrading, no? https://github.com/openmicroscopy/omero-server-docker/blob/master/60-database.sh#L41 If that's the purpose of the feature in ome/omego@3b16ece to prevent inadvertent upgrades, then it seems like it could be valid to have the docker override in some cases.

joshmoore commented 6 years ago

Note: this is fairly nasty. We might decide to strip issue numbers from snoopy comments. cc: @sbesson