docker-omero icon indicating copy to clipboard operation
docker-omero copied to clipboard

omero database user must be created before setting omero config

Open thusharaw opened this issue 8 years ago • 15 comments

In omero-web, I think there may be a race when this :

./bin/omero config set omero.web.server_list "[["omero_server", 4064, "omero"]]"

can be called before the omero user is in the database. The database user creation takes a bit of time specially the first time.

I used a snippet like this to check that the user exists prior to executing the config set:

+    output=`psql -U postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname='omero'"`
+    while [ $output != 1 ]; do
+        echo Waiting for omero user to be created in the database
+        sleep 5s
+    done
+

thusharaw avatar Feb 14 '17 21:02 thusharaw

Thank you for your input.

Would you like to submit a PR in order to fix that ?

hadim avatar Feb 15 '17 02:02 hadim

./bin/omero config set doesn't touch the postgres database, it should only modify the configuration file: OMERO.server/etc/grid/config.xml

manics avatar Feb 15 '17 08:02 manics

@manics - So I think the issue is that omero-web starts and tries to connect to omero-server before the omero database is fully setup with the user. So yes, we could do this after the config set.

thusharaw avatar Feb 15 '17 17:02 thusharaw

@hadim : I'd be happy to submit a PR but I don't have access to push my branch to the repo.

thusharaw avatar Feb 15 '17 17:02 thusharaw

To submit a PR people usually fork the repo, create a new branch on their repo and then submit the PR. GitHub makes all of this pretty easy to do : https://help.github.com/articles/creating-a-pull-request/

Let me know if you need help.

hadim avatar Feb 15 '17 17:02 hadim

You should be checking in omero-web startup if server is up before you start OMERO.web, see official testing container https://github.com/openmicroscopy/omero-test-daemon-c7-docker/blob/master/install/py.sh#L13:L17, very similar to the wait you are doing on postgres.

atarkowska avatar Feb 16 '17 07:02 atarkowska

@aleksandra-tarkowska : thanks. That looks a lot better. I was having trouble logging in as omero to the omero-server although it seems that I have set up the config correctly. Do you know what I might be doing wrong? I can log in as "root" : "password" but not "omero":"omero" as I have setup:

omero@5366769815bb:/omero$ OMERO.server/bin/omero login -s localhost -p 4064 -u root -w password
Created session 673af6ea-34c2-4004-a03e-5609eeff814e (root@localhost:4064). Idle timeout: 10 min. Current group: system


omero@5366769815bb:/omero$ OMERO.server/bin/omero login -s localhost -p 4064 -u omero -w omero   
Password check failed for 'omero': []
Password:Cancelled

omero@5366769815bb:/omero$ OMERO.server/bin/omero config get
omero.data.dir=/data/omero_data
omero.db.host=omero-db
omero.db.name=omero
omero.db.pass=omero
omero.db.port=5432
omero.db.user=omero


omero@5366769815bb:/omero$ PGPASSWORD=omero psql -h omero-db -U omero
psql (9.5.5, server 9.4.11)
Type "help" for help.

omero=> 

thusharaw avatar Feb 16 '17 22:02 thusharaw

omero.db.user and omero.db.password are hibernate/JDBC driver credentials that are matching Postgress role. OMERO accounts are stored in omero-database, root is just the default user created on initialization. These are two different things.

atarkowska avatar Feb 16 '17 23:02 atarkowska

@aleksandra-tarkowska - thank you for the hint. I added an omero user and it all works now. I will submit another PR soon.

thusharaw avatar Feb 17 '17 01:02 thusharaw

Ok. Let me know when you're done and I'll test it.

hadim avatar Feb 17 '17 01:02 hadim

I just pushed it.

thushw avatar Feb 17 '17 03:02 thushw

BTW, do you know if it is possible to change the name of the symlink used by OMERO when we do an in place import?

thusharaw avatar Jun 28 '17 16:06 thusharaw

This is somewhat of a naive question. But I am unable to login to the OMERO.web client through localhost. I tried "root" and "password" but receive this: omero-loginfail

I am looking at the way @thusharaw has attempted to login from the command line and would like to try to do the same. Docker however is relatively new to me and I don't know where to find bin/omero. I tried the following but no luck:

mgitt@mgpc:/var/lib/docker$ su omero omero
No passwd entry for user 'omero'

Any idea what user I should be using and where to find bin/omero to run a simple OMERO.server/bin/omero config get would be very useful.

maxgittelman avatar Oct 10 '17 14:10 maxgittelman

You need to login into the container using docker exec -ti omero-server bash. Then the Omero install dir is located in /omero/OMERO.server.

Please, next time open a new issue since it's not directly relevant to this one.

hadim avatar Oct 10 '17 14:10 hadim

Will do.

maxgittelman avatar Oct 10 '17 17:10 maxgittelman