My project need to have a database (postgres) for the code itself and another database to have kong api gateway data stored.
I would like to have an instance of pgadmin4 managing both postgres servers.
For this, I created 2 compose files:
The one for the project that is working fine:
services:
db:
image: postgres:16.3
container_name: local_pgdb
restart: always
ports:
- "5432:5432"
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
volumes:
- local_pgdata:/var/lib/postgresql/data
networks:
- pg_Network
pgadmin:
container_name: PgAdmin4
image: dpage/pgadmin4:8.7
restart: always
environment:
PGADMIN_DEFAULT_EMAIL: [email protected]
PGADMIN_DEFAULT_PASSWORD: root
ports:
- "5050:80"
volumes:
- pgadmin-data:/var/lib/pgadmin
networks:
- pg_Network
rabbitmq:
image: rabbitmq:3-management-alpine
container_name: 'rabbitmq'
restart: always
environment:
"RABBITMQ_ERLANG_COOKIE": "unique-erlang-cookie"
ports:
- 5672:5672
- 15672:15672
volumes:
- ~/.docker-conf/rabbitmq/data/:/var/lib/rabbitmq/
- ~/.docker-conf/rabbitmq/log/:/var/log/rabbitmq
networks:
- rabbitmq_go_net
volumes:
local_pgdata:
pgadmin-data:
networks:
rabbitmq_go_net:
driver: bridge
pg_Network:
driver: bridge
The one for kong API Gateway:
services:
#######################################
# Postgres: Kong Database
#######################################
kong-db:
image: postgres:16.3
container_name: kong-db
ports:
- "5433:5433"
networks:
- kong-net
environment:
POSTGRES_DB: kong
POSTGRES_USER: kong
POSTGRES_PASSWORD: kong
healthcheck:
test: ["CMD", "pg_isready", "-U", "kong"]
interval: 10s
timeout: 5s
retries: 5
restart: on-failure
#######################################
# Kong database migration
#######################################
kong-migrations:
image: kong/kong-gateway:3.2.1.0
command: kong migrations bootstrap
container_name: kong-migrations
networks:
- kong-net
depends_on:
kong-db:
condition: service_healthy
environment:
KONG_DATABASE: postgres
KONG_PG_HOST: kong-db
KONG_PG_DATABASE: kong
KONG_PG_USER: kong
KONG_PG_PASSWORD: kong
restart: on-failure
#######################################
# Kong: The API Gateway
#######################################
kong-ce:
image: kong/kong-gateway:3.2.1.0
container_name: kong
networks:
- kong-net
restart: on-failure
depends_on:
kong-db:
condition: service_healthy
environment:
KONG_DATABASE: postgres
KONG_PG_HOST: kong-db
KONG_PG_DATABASE: kong
KONG_PG_USER: kong
KONG_PG_PASSWORD: kong
KONG_PROXY_LISTEN: 0.0.0.0:8000, 0.0.0.0:8443 ssl
KONG_ADMIN_LISTEN: 0.0.0.0:8001, 0.0.0.0:8444 ssl
# KONG_SSL: "on"
# KONG_SSL_CERT: /certs/domain.crt
# KONG_SSL_CERT_KEY: /certs/domain.key
# KONG_LICENSE_DATA: 'Add License Key'
healthcheck:
test: ["CMD", "curl", "-f", "http://kong-ce:8001"]
interval: 5s
timeout: 2s
retries: 10
ports:
- "8000-8001:8000-8001/tcp"
- "8443:8443"
- "8444:8444"
volumes:
pgadmin-data-Kong:
## - ./certs:/certs
networks:
kong-net:
external: true
My problem is to have PGAdmin4 connect to both postgres servers.
When I set a new server up, pgAdmin4 does not connect to it.I
To troubleshoot, I have inspected the container and got the correct ip adress: In vain
I have set everything on the same network: In vain.
Does anyone help me with this?
Any help would be really appreciated. Thank You in advance.