hadim / docker-omero

Set of Dockerfile to build a ready-to-use OMERO server
MIT License
15 stars 15 forks source link

omero database user must be created before setting omero config #5

Open thusharaw opened 7 years ago

thusharaw commented 7 years ago

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
+
hadim commented 7 years ago

Thank you for your input.

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

manics commented 7 years ago

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

thusharaw commented 7 years ago

@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 commented 7 years ago

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

hadim commented 7 years ago

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.

atarkowska commented 7 years ago

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.

thusharaw commented 7 years ago

@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=> 
atarkowska commented 7 years ago

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.

thusharaw commented 7 years ago

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

hadim commented 7 years ago

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

thushw commented 7 years ago

I just pushed it.

thusharaw commented 7 years ago

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?

maxgittelman commented 6 years ago

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.

hadim commented 6 years ago

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.

maxgittelman commented 6 years ago

Will do.