我有一个启动 kong 和 konga 服务的 docker-compose 文件。Kong 正确启动,但 konga 失败并出现以下错误:
debug: Preparing database...
Using postgres DB Adapter.
Failed to connect to DB { error: password authentication failed for user "kong"
at Connection.parseE (/app/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:539:11)
at Connection.parseMessage (/app/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:366:17)
at Socket.<anonymous> (/app/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:105:22)
at Socket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
name: 'error',
length: 100,
severity: 'FATAL',
code: '28P01',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '333',
routine: 'auth_failed' }
在我的 docker-compose 中,Kong 服务来自他们的github页面并且运行良好。我相信,问题出在 Konga 上。Konga服务如下:
version: '2.1'
volumes:
kong_data: {}
services:
db:
image: postgres:latest
environment:
POSTGRES_DB: ${KONG_PG_DATABASE:-kong}
POSTGRES_PASSWORD: ${KONG_PG_PASSWORD:-kong}
POSTGRES_USER: ${KONG_PG_USER:-kong}
healthcheck:
test: ["CMD", "pg_isready", "-U", "${KONG_PG_USER:-kong}"]
interval: 30s
timeout: 30s
retries: 3
restart: on-failure
stdin_open: true
tty: true
networks:
- kong_net
volumes:
- kong_data:/var/lib/postgresql/data
konga-prepare:
image: pantsel/konga:latest
command: “-c prepare -a postgres -u postgresql://kong@db:5432/konga_db”
networks:
- kong_net
restart: on-failure
links:
- db
depends_on:
- db
konga:
image: pantsel/konga:latest
restart: always
networks:
- kong_net
environment:
DB_ADAPTER: postgres
DB_HOST: db
DB_PORT: 5432
DB_USER: konga
DB_PASSWORD:
TOKEN_SECRET: km1GUr4RkcQD7DewhJPNXrCuZwcKmqjb
DB_DATABASE: konga_db
NODE_ENV: production
depends_on:
- db
ports:
- "1337:1337"
如何解决身份验证错误?