gutmensch / docker-dmarc-report

211 stars 23 forks source link

postgresql not being recognized as database type #45

Closed goose-ws closed 6 months ago

goose-ws commented 6 months ago

Trying to migrate away from mariadb to postgres for various reasons. I've followed the necessary steps, but am getting an error that leads me to believe there's a bug in the way the database should be identified.

version: "3.4"

networks:
  frontend:
    driver: bridge
  backend:
    driver: bridge
    internal: true

services:
  dmarc-report:
    image: gutmensch/dmarc-report:latest
    hostname: dmarc-report
    container_name: dmarc-report
    depends_on:
      - postgresql
    environment:
      REPORT_DB_TYPE: "pgsql"
      REPORT_DB_HOST: "postgresql"
      REPORT_DB_PORT: "5432"
      REPORT_DB_NAME: "dmarc-report"
      REPORT_DB_USER: "dmarc-report"
      REPORT_DB_PASS: "[Removed]"
      PARSER_IMAP_SERVER: "imap.fastmail.com"
      PARSER_IMAP_PORT: "993"
      PARSER_IMAP_USER: "[Removed]"
      PARSER_IMAP_PASS: "[Removed]"
      PARSER_IMAP_READ_FOLDER: "DMARC"
      PARSER_IMAP_MOVE_FOLDER: "Processed"
      PARSER_IMAP_MOVE_FOLDER_ERR: "Inbox"
      PARSER_IMAP_IGNORE_ERROR: "1"
      PARSER_IMAP_VERIFY: "1"
      PARSER_IMAP_SSL: "1"
      PARSER_IMAP_TLS: "0"
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
    restart: unless-stopped
    logging:
      driver: json-file
      options:
        max-file: "3"
        max-size: "10M"
    networks:
      - "backend"
      - "frontend"

  postgresql:
    image: postgres:16
    hostname: postgresql
    container_name: postgresql
    environment:
      TZ: "America/New_York"
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/docker/config/postgresql/16:/var/lib/postgresql/data"
      - "/docker/config/postgresql/socket:/var/run/postgresql"
    restart: unless-stopped
    logging:
      driver: json-file
      options:
        max-file: "3"
        max-size: "10M"
    networks:
      - "backend"

Docker logs show the following when I attempt to pull up the web interface:

2024-01-09T20:11:19.036391311Z 2024-01-09 15:11:19,036 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
2024-01-09T20:11:19.036479745Z 2024-01-09 15:11:19,036 INFO Included extra file "/etc/supervisor/conf.d/crond.conf" during parsing
2024-01-09T20:11:19.036487587Z 2024-01-09 15:11:19,036 INFO Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing
2024-01-09T20:11:19.044063952Z 2024-01-09 15:11:19,043 INFO RPC interface 'supervisor' initialized
2024-01-09T20:11:19.044155895Z 2024-01-09 15:11:19,044 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2024-01-09T20:11:19.044566136Z 2024-01-09 15:11:19,044 INFO supervisord started with pid 18
2024-01-09T20:11:20.047884644Z 2024-01-09 15:11:20,047 INFO spawned: 'cron' with pid 20
2024-01-09T20:11:20.050022753Z 2024-01-09 15:11:20,049 INFO spawned: 'nginx' with pid 21
2024-01-09T20:11:20.052130727Z 2024-01-09 15:11:20,051 INFO spawned: 'php-fpm' with pid 22
2024-01-09T20:11:20.094736044Z [09-Jan-2024 15:11:20] NOTICE: fpm is running, pid 22
2024-01-09T20:11:20.094807573Z [09-Jan-2024 15:11:20] NOTICE: ready to handle connections
2024-01-09T20:11:21.096273335Z 2024-01-09 15:11:21,095 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-01-09T20:11:21.096369906Z 2024-01-09 15:11:21,096 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-01-09T20:11:21.096484074Z 2024-01-09 15:11:21,096 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-01-09T20:12:48.211019188Z NOTICE: PHP message: PHP Warning:  mysqli::__construct(): Error while reading greeting packet. PID=55 in /var/www/viewer/dmarcts-report-viewer.php on line 238
2024-01-09T20:12:48.211103404Z NOTICE: PHP message: PHP Warning:  mysqli::__construct(): (HY000/2006): MySQL server has gone away in /var/www/viewer/dmarcts-report-viewer.php on line 238
2024-01-09T20:12:48.211260117Z 2024/01/09 15:12:48 [error] 23#23: *1 FastCGI sent in stderr: "PHP message: PHP Warning:  mysqli::__construct(): Error while reading greeting packet. PID=55 in /var/www/viewer/dmarcts-report-viewer.php on line 238PHP message: PHP Warning:  mysqli::__construct(): (HY000/2006): MySQL server has gone away in /var/www/viewer/dmarcts-report-viewer.php on line 238" while reading response header from upstream, client: 172.20.0.1, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1"
2024-01-09T20:12:48.212132594Z 172.20.0.1 - - [09/Jan/2024:15:12:48 -0500] "GET / HTTP/1.1" 200 249 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0" "-" 60.013 60.015 . -
2024-01-09T20:12:48.303179457Z 2024/01/09 15:12:48 [error] 23#23: *1 open() "/var/www/viewer/favicon.ico" failed (2: No such file or directory), client: 172.20.0.1, server: _, request: "GET /favicon.ico HTTP/1.1", host: "127.0.0.1", referrer: "http://127.0.0.1/"
2024-01-09T20:12:48.303320173Z 172.20.0.1 - - [09/Jan/2024:15:12:48 -0500] "GET /favicon.ico HTTP/1.1" 404 125 "http://127.0.0.1/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0" "-" 0.000 - . -

Seems that even though my REPORT_DB_TYPE is pgsql the program is still attempting to establish a mysql/mariadb connection.

goose-ws commented 6 months ago

For reasons I can't entirely understand, despite being on the :latest tag, deleting the image and re-pulling it seems to have fixed it.