Skip to content

no pg_hba.conf entry for host "x.x.x.x" #482

@roks0n

Description

@roks0n

I've had a docker swarm setup running for months now but started receiving the following error today:
FATAL: no pg_hba.conf entry for host "10.0.7.2", user "xxxx", database "xxxx", SSL off

This is how my docker-compose.yml looked like initially:

version: '3.6'

services:
  web:
    image: myimage
    networks:
      - frontend
      - backend
    depends_on:
      - db
    deploy:
      replicas: 3
    environment:
      DEBUG: '0'
      DATABASE_URL: 'postgres://xxxx@xxxx:5432/xxxx'
    command: uwsgi --ini etc/uwsgi.ini --http-socket 0.0.0.0:8001
    logging:
      driver: "json-file"
      options:
        max-size: "10M"
        max-file: "20"

  db:
    image: postgres:9.6.9
    networks:
      - backend
    ports:
      - "5432:5432"
    volumes:
      - ./data/postgres:/var/lib/postgresql/data
    deploy:
      placement:
        constraints: [node.role == manager]
    logging:
      driver: "json-file"
      options:
        max-size: "10M"
        max-file: "20"

networks:
  frontend:
  backend:
    driver: overlay
    attachable: true

After reading how I could potentially solve this I also added this to the db's volume:
- ./pg_hba.conf:/var/lib/postgresql/data/pg_hba.conf

with a modified pg_hba.conf where I added the following for testing purposes:
host all all 0.0.0.0/0 trust

Afterwords I removed the stack and deployed it again. I've checked the db container and pg_hba.conf reflected the changes but the issues was still there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions