Мне нужна помощь здесь. Я заблокирован.
Я получаю эту ошибку
A model (`apihealthcheck`) references a datastore which cannot be found (`postgresql`). If this model definition has an explicit `connection` property, check that it is spelled correctly. If not, check your default `connection` (usually located in `config/models.js`).
при попытке подключить приложение Konga, которое является приложением узла, к базе данных Postgres. Приложение было собрано, и я должен его докертировать. Я запускаю обе службы - конга и postgres - через docker -композит.
Здесь docker-compose.yaml
version: "3"
networks:
kong-net:
driver: bridge
services:
#######################################
# Postgres: The database used by Kong
#######################################
kong-database:
image: postgres:10.6
restart: always
networks:
- kong-net
environment:
POSTGRES_USER: kong
POSTGRES_DB: kong
POSTGRES_PASSWORD: kong
ports:
- "5432:5432"
healthcheck:
test: ["CMD", "pg_isready", "-U", "kong"]
interval: 5s
timeout: 5s
retries: 5
#######################################
# Konga/ UI database prepare
#######################################
ui-prepare:
image: gluufederation/gluu-gateway-ui:4.1.0_sam2
command: "-c prepare -a postgres -u postgresql://kong:kong@kong-database:5432/kong"
volumes:
- ./certificate.pem:/etc/certs/certificate.pem
- ./key.pem:/etc/certs/key.pem
env_file:
- ./.env
networks:
- kong-net
restart: on-failure
links:
- kong-database
depends_on:
- kong-database
и Dockerfile
FROM node:10-alpine
RUN apk update && \
apk add --no-cache bash git
RUN npm install -g bower
WORKDIR /app
# Copy app
COPY . /app
RUN npm --unsafe-perm --verbose install --production \
&& npm update -g
EXPOSE 1337
VOLUME /app/kongadata
# for DB connections
ENV DB_HOST=kong-database \
DB_USER=konga \
DB_PASSWORD=konga \
DB_PORT=5432 \
DB_DATABASE=konga \
DB_POOLSIZE=10 \
DB_SSL=false \
DB_ADAPTER=postgres \
POSTGRES_VERSION=10.x \
HOOK_TIMEOUT=180000 \
KONGA_HOOK_TIMEOUT=180000 \
PORT=1338
#session
ENV SESSION_SECRET=
# certs
ENV SSL_KEY_PATH=/etc/certs/key.pem \
SSL_CERT_PATH=/etc/certs/certificate.pem
# OXD variables
ENV OXD_SERVER_URL=https://localhost:8553 \
OP_SERVER_URL=https://demoexample.gluu.org \
OXD_ID= \
CLIENT_ID= \
CLIENT_SECRET= \
OXD_SERVER_VERSION=4.1 \
GG_VERSION=4.1 \
EXPLICIT_HOST=127.0.0.1 \
GG_UI_REDIRECT_URL_HOST=localhost \
GG_HOST=localhost
RUN chmod 777 ./start.sh
ENTRYPOINT ["/bin/bash","./start.sh"]
Из моего небольшого понимания узла файл config/local.js
переопределит config/connection.js
Теперь вот мой config/local.js
/**
* Created by pang on 7/10/2016.
*/
'use strict';
var fs = require('fs');
module.exports = {
/**
* The default fallback URL to Kong's admin API.
*/
kong_admin_url: process.env.KONG_ADMIN_URL || 'http://localhost:8001',// 'http://gluu.local.org:8001',
connections: {
postgres: {
adapter: 'sails-postgresql',
host: process.env.DB_HOST || 'localhost',
user: process.env.DB_USER || 'postgres',
password: process.env.DB_PASSWORD || 'admin',
port: process.env.DB_PORT && parseInt(process.env.DB_PORT) || 5432,
database: process.env.DB_DATABASE || 'konga',
poolSize: process.env.DB_POOLSIZE && parseInt(process.env.DB_POOLSIZE) || 10,
ssl: process.env.DB_SSL && JSON.parse(process.env.DB_SSL.toLowerCase()) || false
}
},
models: {
connection: process.env.DB_ADAPTER || 'postgres',
},
session: {
secret: process.env.SESSION_SECRET || '' // Add your own SECRET string here
},
ssl: {
key: fs.readFileSync(process.env.SSL_KEY_PATH || 'key.pem'),
cert: fs.readFileSync(process.env.SSL_CERT_PATH || 'cert.pem')
},
hookTimeout: process.env.HOOK_TIMEOUT && parseInt(process.env.HOOK_TIMEOUT) || 180000, // miliseconds
port: process.env.PORT && parseInt(process.env.PORT) || 1338,
environment: 'development',
log: {
level: process.env.LOG_LEVEL || 'info'
},
ggHost: process.env.GG_HOST || 'gluu.local.org',
oxdWeb: process.env.OXD_SERVER_URL || 'https://localhost:8553',
opHost: process.env.OP_SERVER_URL || 'https://ce-dev6.gluu.org',
oxdId: process.env.OXD_ID || '05e3bf4e-7631-4afa-a6ff-a46acc98c52b',
clientId: process.env.CLIENT_ID || '063701b0-05fa-40ca-bf73-d160377fd1dd',
clientSecret: process.env.CLIENT_SECRET || '63e6ebf7-9f2d-48fc-8ece-3b8af0ad10fa',
oxdVersion: process.env.OXD_SERVER_VERSION || '4.1',
ggVersion: process.env.GG_VERSION || '4.1',
postgresVersion: process.env.POSTGRES_VERSION || '10.x',
explicitHost: process.env.EXPLICIT_HOST || '0.0.0.0',
ggUIRedirectURLHost: process.env.GG_UI_REDIRECT_URL_HOST || 'gluu.local.org',
};
А чтобы было проще, позвольте предоставьте файл .env
, который я использую
DB_ADAPTER=postgres
DB_HOST=kong-database
DB_USER=kong
DB_PASSWORD=kong
DB_SSL=false
DB_ADAPTER=postgresql
DB_PORT=5432
POSTGRES_VERSION=10.6
SSL_KEY_PATH=/etc/certs/key.pem
SSL_CERT_PATH=/etc/certs/certificate.pem
CLIENT_SECRET=km1GUr4RkcQD7DewhJPNXrCuZwcKmqjb
DB_DATABASE=kong
NODE_ENV=production
PORT=1337
OXD_SERVER_URL=
OP_SERVER_URL=
OXD_ID=
CLIENT_ID=
CLIENT_SECRET=
OXD_SERVER_VERSION=4.1
GG_HOST=demoexample.gluu.org
GG_UI_REDIRECT_URL_HOST=demoexample.gluu.org
EXPLICIT_HOST=127.0.0.1
GG_VERSION=4.1
KONGA_HOOK_TIMEOUT=180000
Я не уверен, что здесь происходит. Спасибо за любую помощь