idealista / prom2teams

prom2teams is an HTTP server built with Python that receives alert notifications from a previously configured Prometheus Alertmanager instance and forwards it to Microsoft Teams using defined connectors
Apache License 2.0
268 stars 84 forks source link

Permission denied: '/opt/prom2teams/config.ini' #307

Closed re-mscho closed 1 year ago

re-mscho commented 1 year ago

Description

I get an error on startup when mounting a custom config file readonly in docker.

NOTE: We are not allowed to have config files which are not readonly. It's a very bad idea anyway to have configuration files that are writable. This is very special to prom2teams and I've not seen any other software that needs this.

Steps to Reproduce

  1. Run idealista/prom2teams:4.0.0 docker image using docker-compose

Expected behavior: Service should start

Actual behavior: Service crashes with following error:

PermissionError: [Errno 13] Permission denied: '/opt/prom2teams/config.ini'
Traceback (most recent call last):
  File "/opt/prom2teams/replace_config.py", line 13, in <module>
    with open('/opt/prom2teams/config.ini', 'w') as file:

Reproduces how often: Always

Environment

Additional Information

docker-compose.yml

...
  prom2teams:
    image: idealista/prom2teams:4.0.0
    container_name: prom2teams
    volumes:
      - /etc/prom2teams/config.ini:/opt/prom2teams/config.ini:ro
    restart: unless-stopped
    expose:
      - 8089
    networks:
      - monitoring_net
    labels:
      org.label-schema.group: "monitoring"
pierrediancourt commented 1 year ago

I'm also facing this issue but my volume is NOT read-only ! OS : Ubuntu 20.04 docker compose : v2.10.2

Full error log :

[uWSGI] getting INI configuration from /opt/prom2teams/uwsgi.ini
*** Starting uWSGI 2.0.20 (64bit) on [Thu Sep  1 16:41:24 2022] ***
compiled with version: 11.2.1 20220219 on 16 August 2022 11:04:57
os: Linux-5.4.0-125-generic #141-Ubuntu SMP Wed Aug 10 13:42:03 UTC 2022
nodename: prom2teams
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 12
current working directory: /opt/prom2teams
detected binary path: /usr/local/bin/uwsgi
chdir() to /opt/prom2teams
your memory page size is 4096 bytes
detected max file descriptor number: 1048576
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address uwsgihost:uwsgiport fd 3
unable to find protocol uwsgiprotocol
Traceback (most recent call last):
  File "/opt/prom2teams/replace_config.py", line 13, in <module>
    with open('/opt/prom2teams/config.ini', 'w') as file:
PermissionError: [Errno 13] Permission denied: '/opt/prom2teams/config.ini'

docker-compose.yml :

  prom2teams:
    image: idealista/prom2teams:4.0.0
    hostname: prom2teams
    container_name: monitoring_prom2teams
    restart: unless-stopped
    volumes:
      - ./prom2teams/config.ini:/opt/prom2teams/config.ini
      - ./prom2teams/template.j2:/opt/prom2teams/template.j2
    expose:
      - 8089
    labels:
      org.label-schema.group: "monitoring"
    networks:
      - default
stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

pierrediancourt commented 1 year ago

Up ! I had to go back to release 3.3.0 because of this issue :)

abdennour commented 1 year ago

Same issue in Openshift 4.x ! Please expedite reviewing #316

santi-eidu commented 1 year ago

New release 4.2.1 should fix the error.

kevin-sedimentum commented 1 year ago

Can confirm. This is fixed in version 4.2.1