IQSS / dataverse-docker

Dataverse 6.2 on Docker with integrated services called "Archive in a box" and could be used both as demo and production system and easily integrated with other services.
57 stars 45 forks source link

postgresql - necessity to create the db by the dataverse container ? #25

Open pmauduit opened 5 years ago

pmauduit commented 5 years ago

The dataverse container tries to create the database by connecting onto the postgresql server (from the postgresql container) at first run.

dataverse_1  | Checking if we can talk to Postgres as the admin user...
postgres_1   | FATAL:  password authentication failed for user "postgres"
postgres_1   | DETAIL:  Password does not match for user "postgres".
postgres_1   |  Connection matched pg_hba.conf line 95: "host all all all md5"
dataverse_1  | (Tried executing: PGPASSWORD=secret; export PGPASSWORD; /usr/bin/psql -h postgres -p 5432 -U postgres -d postgres -c 'SELECT * FROM pg_roles' > /dev/null 2>&1) 

But is it necessary, as the env variables on the postgres container should already ensure that the database exist ?

By the way, digging in the entrypoint of the dataverse container, I could not find where the perl script (responsible of the psql command failing above) is supposed to be called exactly:

https://github.com/IQSS/dataverse-docker/blob/master/dataversedock/testdata/scripts/installer/install

Maybe we should consider that the db already exist and not try to create it from the dataverse container.

4tikhonov commented 5 years ago

When this error message appears, during restart?

pmauduit commented 5 years ago

When this error message appears, during restart?

No, on a fresh docker-compose launch. To be honest, I pre-built the images on custom docker repositories and rewrote the docker-compose consequently so that it is more convenient for our customer to launch the compo without having to build the images in his infrastructure, but the docker composition used is pretty much the same as in this repository.

pmauduit commented 5 years ago

This is where the perl script is called from the dataverse container: https://github.com/IQSS/dataverse-docker/blob/master/dataversedock/setupIT.bash#L17

So the script comes from a zip file directly fetched during step2.sh, so it is not easily customizeable, but it seems that a patch (docker.patch) is actually meant to modify it during runtime:

https://github.com/IQSS/dataverse-docker/blob/master/dataversedock/setupIT.bash#L13

4tikhonov commented 5 years ago

Ok, it's clear now what's happened. Just run docker.pach in the glassfish container as it will modify perl script to produce a proper configuration in domain.xml, and update Docker image.

pmauduit commented 5 years ago

I discarded the whole logic trying to connect as admin on postgres in my docker.patch, but it seems that I need now to fiddle with POSTGRES_PASSWORD in the dataverse container which is not taken into account (it still tries to use 'secret' as password).

pmauduit commented 5 years ago

I also noticed that the patch is written the invert way: https://github.com/IQSS/dataverse-docker/blob/master/dataversedock/docker.patch

I generated mine using the following:

diff install.orig install

where install.orig is the untouched version of the perl script

4tikhonov commented 5 years ago

Can you probably install it by following the instruction, and after replace the image with database?

pmauduit commented 5 years ago

I pushed an updated version of the docker.patch file here: https://github.com/pmauduit/dataverse-docker/commit/cf513b7367773dcd9da0504bf8d05defa9c87127

I was able to launch my composition with no issue so far, but I'll retry a launch several time though (and I did not try yet in the current repository).