R
R
reqww2020-12-10 10:55:35
PostgreSQL
reqww, 2020-12-10 10:55:35

Grafana not working with PostgreSQL from Docker?

Run docker-compose with this config:

version: '3'

services:

  nginx:
    container_name: nginx
    build: ./nginx
    ports:
      - 8000:80
    depends_on: 
      - web
    volumes: 
      - static_volume:/home/app/web/staticfiles

  db:
    container_name: postgres
    image: postgres:13.0
    volumes: 
      - pg_data:/var/lib/postgresql/data/
    environment: 
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_db=postgres

  influxdb:
    image: influxdb:latest
    container_name: influxdb
    ports:
      - 8086:8086
    volumes:
      - influxdb:/var/lib/influxdb
    restart: always

  grafana:
    container_name: grafana
    restart: always
    image: grafana/grafana
    depends_on:
      - db
      - influxdb
    ports:
      - "3000:3000"
    environment:
      - plugins="crate-datasource,grafana-clock-panel,grafana-worldmap-panel,natel-plotly-panel"
    volumes:
      - grafana:/var/lib/grafana

  redis:
    container_name: redis
    image: redis
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/var/lib/redis/data/
    restart: always

  web:
    container_name: web
    build:
      context: ./
      dockerfile: Dockerfile
    command: gunicorn backend.wsgi:application --bind 0.0.0.0:8000
    volumes: 
      - static_volume:/home/app/web/staticfiles
    expose: 
      - 8000
    env_file:
      - ./.env
    depends_on: 
      - db
      - redis

volumes: 
  pg_data:
  static_volume:
  redis_data:
  influxdb:
  grafana:


The web service has janga, it works fine, it pulls everything up, everything is in order with the base, it connects.

Now I decided to use grafana for monitoring and load testing
. To begin with, I decided to just try connecting it to PostgreSQL.

Tried like this: 5fd1d3b3af6e4530181641.png
So:
5fd1d3cfe0e35451533094.png
And like this:
5fd1d3e29c69f956628494.png

And everywhere the same error:
5fd1d3f8503b8457221791.png

What can be done about it?
I will be grateful for any help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zohan1993, 2020-12-10
@reqww

Host: db:5432
Database: postgres
User: postgres
Password: postgres
SSL Mode: disable

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question