docker-pgbouncer icon indicating copy to clipboard operation
docker-pgbouncer copied to clipboard

Docker compose syntax

Open MathiasDrapier opened this issue 4 years ago • 0 comments

Hello, I am trying to deploy a psql and pgbouncer services from the following yml file:

version: "3.7"
services:
  psql:
    image: postgres
    restart: always
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: xxxx
      PGDATA: /data/postgres
    volumes:
       - /home/debian/postgres:/data/postgres
    networks:
      - direct_web
    deploy:
      replicas: 1
      restart_policy:
        condition: on-failure
      placement:
        constraints:
         - node.hostname == first
  pgbouncer:
    image: edoburu/pgbouncer
    environment:
       - DB_USER=postgres
       - DB_PASSWORD=xxxx
       - DB_HOST=psql
       - DB_NAME=test
       - POOL_MODE=transaction
       - ADMIN_USERS=postgres,user
    ports:
      - "5432:5432"
    networks:
      - direct_web
    deploy:
      replicas: 1
      restart_policy:
        condition: on-failure
      placement:
        constraints:
         - node.hostname == first
    depends_on:
      - psql
networks:
  direct_web:
    name: direct_web
    external: true

I get this following error in pgbouncer logs :

Create pgbouncer config in /etc/pgbouncer
################## Auto generated ##################
[databases]
test= host=psql port=5432 user=postgres

[pgbouncer]
listen_addr = 0.0.0.0
listen_port = 5432
unix_socket_dir =
user = postgres
auth_file = /etc/pgbouncer/userlist.txt
auth_type = md5
pool_mode = transaction
ignore_startup_parameters = extra_float_digits

# Log settings
admin_users = postgres,user

# Connection sanity checks, timeouts

# TLS settings

# Dangerous timeouts
 ################## end file ##################
2021-04-20 13:35:59.761 UTC [1] ERROR could not open auth_file /etc/pgbouncer/userlist.txt: No such file or directory
2021-04-20 13:35:59.766 UTC [1] LOG kernel file descriptor limit: 1048576 (hard: 1048576); max_client_conn: 100, max expected fd use: 132
 Starting /usr/bin/pgbouncer /etc/pgbouncer/pgbouncer.ini...
2021-04-20 13:35:59.768 UTC [1] LOG listening on 0.0.0.0:5432
2021-04-20 13:35:59.768 UTC [1] LOG process up: PgBouncer 1.15.0, libevent 2.1.12-stable (epoll), adns: udns 0.4, tls: OpenSSL 1.1.1i  8 Dec 2020

MathiasDrapier avatar Apr 20 '21 13:04 MathiasDrapier