Postgres docker service now fails to start without "POSTGRES_HOST_AUTH_METHOD: trust" option
Problem to solve
-
To use the most recent postgres docker image, it now requires an additional option
POSTGRES_HOST_AUTH_METHOD: trustwhich is not currently listed on the section of the documentation: https://docs.gitlab.com/ee/ci/services/postgres.html -
Sources:
Further details
- Before the weekend the following configuration was working flawlessly:
test-api:
stage: test
image: node:13.8.0-alpine
services:
- postgres:10-alpine
only:
- merge_requests
variables:
POSTGRES_DB: nice_marmot
POSTGRES_USER: runner
POSTGRES_PASSWORD: ""
- Out the blue after the weekend, it stopped working showing the error
Service runner-ed2dce3a-project-4556663-concurrent-0-postgres-0 probably didn't start properly.
Health check error:
ContainerStart: Error response from daemon: Cannot link to a non running container: /runner-ed2dce3a-project-4556663-concurrent-0-postgres-0 AS /runner-ed2dce3a-project-4556663-concurrent-0-postgres-0-wait-for-service/service (executor_docker.go:1259:0s)
Service container logs:
2020-02-17T13:35:29.470574649Z Error: Database is uninitialized and superuser password is not specified.
2020-02-17T13:35:29.470606915Z You must specify POSTGRES_PASSWORD for the superuser. Use
2020-02-17T13:35:29.470611569Z "-e POSTGRES_PASSWORD=password" to set it in "docker run".
2020-02-17T13:35:29.470615118Z
2020-02-17T13:35:29.470618049Z You may also use POSTGRES_HOST_AUTH_METHOD=trust to allow all connections
2020-02-17T13:35:29.470621289Z without a password. This is *not* recommended. See PostgreSQL
2020-02-17T13:35:29.470624357Z documentation about "trust":
2020-02-17T13:35:29.470627495Z https://www.postgresql.org/docs/current/auth-trust.html
*********
- Adding the variable
POSTGRES_HOST_AUTH_METHOD: trustfixes the issue
Proposal
- The documentation (https://docs.gitlab.com/ee/ci/services/postgres.html) should indicate the existence of the variable :)