Closed zagrev closed 9 years ago
There are basically three environment variables involved in database connection from gerrit to postgresql. The DB_ENV_POSTGRES_DB specifies which database to be connected. The DB_ENV_POSTGRES_USER and DB_ENV_POSTGRES_PASSWORD specify the user name and password. These variables can be created automatically in gerrit container by --link postgres:db if POSTGRES_DB, POSTGRES_USER and POSTGRES_PASSWORD are defined in the postgres container which is what I recommend in the README. Since you are using an existing postgres container which means those three environment variables may be occupied by another existing database or even not existed at all. You can check it by execute docker exec postgres env. In this case you can define these environment variables as the docker run options like: docker run \ --link postgres:db \ -e DATABASE_TYPE=postgresql \ -e DB_ENV_POSTGRES_DB=gerrit2 \ -e DB_ENV_POSTGRES_USER=gerrit2 \ -e DB_ENV_POSTGRES_PASSWORD=gerrit \ .... You can reference [Section database] in gerrit-entrypoint.sh if you want to know how these variables are used to define gerrit.config file.
Thanks! After reading the Docker documentation on --link it makes much more sense.
I am trying to use openfrontier/gerrit:latest -> 2.11.2 with an existing postgres database. Since the database already exists (in a container called postgres), I just created a user/pw gerrit2/gerrit in the database
and started up the gerrit container with this command line:
But I am getting this in the gerrit logs:
And this in the postgres logs:
So the two containers are talking correctly.
This looks like the password is wrong. I have also tried with password
gerrit2
without success. Can you tell me the password to use? Perhaps you can make the postgres user and password configurable?