line / promgen

Promgen is a configuration file generator for Prometheus
https://line.github.io/promgen/
MIT License
1.04k stars 150 forks source link

Errors on worker #387

Open JuezFenix opened 2 years ago

JuezFenix commented 2 years ago

Hi, im trying to deploy the tool. Afer some problems using local binds, i change the compose, like this:

version: '2'

volumes:
  prometheus:
  prom_data:
  alert_data:
  mysql_data:
  promgen_data:
  redis_data:

services:
  web:
    image: line/promgen
    command: web -b 0.0.0.0:8000
    environment:
     - ALLOWED_HOSTS=*
    ports:
      - "8080:8000"
    links:
      - mysql
      - redis
    volumes:
      - prometheus:/etc/prometheus
      - promgen_data:/etc/promgen

  worker:
    image: line/promgen
    command: worker -l info --queues localhost,celery
    links:
      - prometheus
      - mysql
      - redis
    volumes:
      - prometheus:/etc/prometheus
      - promgen_data:/etc/promgen

  prometheus:
    image: prom/prometheus
    links:
      - alertmanager
      - blackbox
    ports:
      - "9090:9090"
    volumes:
      - prometheus:/etc/prometheus
      - prom_data:/prometheus

  blackbox:
    image: prom/blackbox-exporter
    network_mode: bridge
    volumes:
      - prometheus:/etc/prometheus

  alertmanager:
    image: prom/alertmanager
    command: --config.file=/etc/prometheus/alertmanager.yml
    links:
      - web
    ports:
      - "9093:9093"
    volumes:
      - prometheus:/etc/prometheus
      - alert_data:/alertmanager

  mysql:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: demo
      MYSQL_DATABASE: promgen
      MYSQL_USER: promgen
      MYSQL_PASSWORD: promgen
    volumes:
      - mysql_data:/var/lib/mysql

  redis:
    image: redis
    volumes:
      - redis_data:/data

Copied alertmanager.yml and prometheus.yml thay work well.

The webui respond, but saying internal error and worker say like that:

[2022-03-30 19:17:10,565: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 111] Connection refused.

I cannot use volumes? Only local bind? (i have permision problems on it) Can i solve this problem?

Edit to fix yaml formatting

kfdm commented 2 years ago

Cannot connect to amqp://guest:**@127.0.0.1:5672//: suggests that the broker settings are incorrect. You need to add something similar to this to your environment for the web and worker nodes

    environment:
      CELERY_BROKER_URL: redis://redis:6379/0

In the example docker-compose I have them included in a base state https://github.com/line/promgen/blob/f962eaf1e945248eb5f0d4f09300ae0ee9d0d112/docker-compose.yml#L10-L13