crazy-max / docker-matomo

Matomo (formerly Piwik) Docker image
MIT License
170 stars 43 forks source link

Cron-Job (archive) doesn't work anymore since 01-01-2024 #152

Closed rafaelmaeuer closed 8 months ago

rafaelmaeuer commented 8 months ago

Support guidelines

I've found a bug and checked that ...

Description

Cron-Job (archive) doesn't work anymore since 01-01-2024:

Bildschirmfoto 2024-02-22 um 12 54 09

Expected behaviour

Cron-Job (archive) should run as it did in 2023 and before...

Actual behaviour

Cron-Job (archive) doesn't work anymore since 01-01-2024:

Steps to reproduce

Don't know if it occurs on new installs?

Docker info

Client: Docker Engine - Community
 Version:    25.0.3
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.12.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.24.5
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 7
  Running: 7
  Paused: 0
  Stopped: 0
 Images: 7
 Server Version: 25.0.3
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc version: v1.1.12-0-g51d5e94
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
 Kernel Version: 5.15.0-1051-oracle
 Operating System: Ubuntu 20.04.6 LTS
 OSType: linux
 Architecture: aarch64
 CPUs: 2
 Total Memory: 11.66GiB
 Name: vm-a1-matomo
 ID: W6D2:6H6Y:GKQY:PVXE:LCRD:N6TL:6YOI:2JMX:LA2P:BFE6:GAJK:ED5Z
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Docker Compose config

name: matomo
services:
  cron:
    container_name: cron
    depends_on:
      matomo:
        condition: service_started
        required: true
    environment:
      ARCHIVE_OPTIONS: --concurrent-requests-per-website=3
      CRON_ARCHIVE: 0 * * * *
      LOG_LEVEL: WARN
      MEMORY_LIMIT: 256M
      OPCACHE_MEM_SIZE: "128"
      REAL_IP_FROM: 0.0.0.0/32
      REAL_IP_HEADER: X-Forwarded-For
      SHORTCODE_DOMAIN: shorten.er
      SIDECAR_CRON: "1"
      TZ: Europe/Berlin
      UPLOAD_MAX_SIZE: 16M
    healthcheck:
      disable: true
    image: crazymax/matomo:latest
    networks:
      default: null
    restart: always
    volumes:
      - type: volume
        source: matomo
        target: /data
        volume: {}
      - type: volume
        source: geoip-updater
        target: /data/geoip
        volume: {}
  db:
    command:
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_unicode_ci
      - --max_allowed_packet=256M
    container_name: maria-db
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: "no"
      MYSQL_DATABASE: <hidden>
      MYSQL_PASSWORD: <hidden>
      MYSQL_USER: <hidden>
    image: mariadb:10.5
    networks:
      default: null
    restart: always
    volumes:
      - type: volume
        source: db
        target: /var/lib/mysql
        volume: {}
  geoip-updater:
    container_name: geoip-updater
    environment:
      DOWNLOAD_PATH: /data
      EDITION_IDS: GeoLite2-ASN,GeoLite2-City,GeoLite2-Country
      LICENSE_KEY: <hidden>
      LOG_JSON: "false"
      LOG_LEVEL: info
      SCHEDULE: 0 0 * * 0
      TZ: Europe/Berlin
    image: crazymax/geoip-updater:latest
    networks:
      default: null
    restart: always
    volumes:
      - type: volume
        source: geoip-updater
        target: /data
        volume: {}
  matomo:
    container_name: matomo
    depends_on:
      db:
        condition: service_started
        required: true
      msmtpd:
        condition: service_started
        required: true
      redis:
        condition: service_started
        required: true
    environment:
      LOG_LEVEL: WARN
      MEMORY_LIMIT: 256M
      OPCACHE_MEM_SIZE: "128"
      REAL_IP_FROM: 0.0.0.0/32
      REAL_IP_HEADER: X-Forwarded-For
      SHORTCODE_DOMAIN: shorten.er
      TZ: Europe/Berlin
      UPLOAD_MAX_SIZE: 16M
    image: crazymax/matomo:latest
    labels:
      traefik.enable: "true"
      traefik.http.routers.matomo.entrypoints: https
      traefik.http.routers.matomo.rule: Host(`<hidden>`)
      traefik.http.routers.matomo.tls: "true"
      traefik.http.routers.matomo.tls.certresolver: letsencrypt
      traefik.http.routers.matomo.tls.domains[0].main: <hidden>
      traefik.http.services.matomo.loadbalancer.server.port: "8000"
    networks:
      default: null
    ports:
      - target: 8000
        published: "8000"
        protocol: tcp
    restart: always
    volumes:
      - type: volume
        source: matomo
        target: /data
        volume: {}
      - type: volume
        source: geoip-updater
        target: /data/geoip
        volume: {}
  msmtpd:
    container_name: msmtpd
    environment:
      SMTP_AUTH: "on"
      SMTP_FROM: <hidden>
      SMTP_HOST: <hidden>
      SMTP_PASSWORD: <hidden>
      SMTP_PORT: "465"
      SMTP_STARTTLS: "off"
      SMTP_TLS: "on"
      SMTP_TLS_CHECKCERT: "on"
      SMTP_USER: <hidden>
      TZ: Europe/Berlin
    image: crazymax/msmtpd:latest
    networks:
      default: null
    restart: always
  redis:
    container_name: redis
    image: redis:4.0-alpine
    networks:
      default: null
    restart: always
  traefik:
    command:
      - --global.checknewversion=false
      - --global.sendanonymoususage=false
      - --log=true
      - --log.level=INFO
      - --entrypoints.http=true
      - --entrypoints.http.address=:80
      - --entrypoints.http.http.redirections.entrypoint.to=https
      - --entrypoints.http.http.redirections.entrypoint.scheme=https
      - --entrypoints.https=true
      - --entrypoints.https.address=:443
      - --certificatesresolvers.letsencrypt
      - --certificatesresolvers.letsencrypt.acme.storage=acme.json
      - --certificatesresolvers.letsencrypt.acme.email=/var/mail/root
      - --certificatesresolvers.letsencrypt.acme.httpchallenge
      - --certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=http
      - --providers.docker
      - --providers.docker.watch=true
      - --providers.docker.exposedbydefault=false
    container_name: traefik
    image: traefik:2.3
    networks:
      default: null
    ports:
      - target: 80
        published: "80"
        protocol: tcp
      - target: 443
        published: "443"
        protocol: tcp
    restart: always
    volumes:
      - type: bind
        source: /home/ubuntu/matomo/acme.json
        target: /acme.json
        bind:
          create_host_path: true
      - type: bind
        source: /var/run/docker.sock
        target: /var/run/docker.sock
        bind:
          create_host_path: true
networks:
  default:
    name: matomo_default
volumes:
  db:
    name: matomo_db
  geoip-updater:
    name: matomo_geoip-updater
  matomo:
    name: matomo_matomo

Logs

cron             | INFO [2024-02-22 12:00:55] 1460  Error: Error unserializing the following response from ?module=API&method=CoreAdminHome.archiveReports&idSite=9&period=week&date=2024-01-01&format=json&trigger=archivephp: 'PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /var/www/matomo/vendor/symfony/console/Symfony/Component/Console/Helper/DialogHelper.php on line 52 PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /var/www/matomo/vendor/symfony/console/Symfony/Component/Console/Helper/QuestionHelper.php on line 120 {"idarchives":[9619],"nb_visits":1}'
cron             | INFO [2024-02-22 12:00:55] 1460  Error: Error unserializing the following response from ?module=API&method=CoreAdminHome.archiveReports&idSite=9&period=month&date=2024-01-01&format=json&trigger=archivephp: 'PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /var/www/matomo/vendor/symfony/console/Symfony/Component/Console/Helper/DialogHelper.php on line 52 PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /var/www/matomo/vendor/symfony/console/Symfony/Component/Console/Helper/QuestionHelper.php on line 120 {"idarchives":[49387],"nb_visits":13}'
cron             | INFO [2024-02-22 12:00:55] 1460  Error: Error unserializing the following response from ?module=API&method=CoreAdminHome.archiveReports&idSite=9&period=year&date=2024-01-01&format=json&trigger=archivephp: 'PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /var/www/matomo/vendor/symfony/console/Symfony/Component/Console/Helper/DialogHelper.php on line 52 PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /var/www/matomo/vendor/symfony/console/Symfony/Component/Console/Helper/QuestionHelper.php on line 120 {"idarchives":[63583],"nb_visits":18}'
cron             | ERROR [2024-02-22 12:00:55] 1460  258 total errors during this script execution, please investigate and try and fix these errors.
cron             | ERROR [2024-02-22 12:00:55] 1460  Uncaught exception: /var/www/matomo/core/CronArchive.php(631): 258 total errors during this script execution, please investigate and try and fix these errors. [Query: , CLI mode: 1]
cron             |
cron             |
cron             |
cron             |   [Exception]
cron             |   258 total errors during this script execution, please investigate and try and fix these errors.
cron             |
cron             |
cron             |
cron             | core:archive [--url="..."] [--skip-idsites[="..."]] [--skip-all-segments] [--force-idsites[="..."]] [--skip-segments-today] [--force-periods[="..."]] [--force-date-last-n[="..."]] [--force-date-range[="..."]] [--force-idsegments="..."] [--concurrent-requests-per-website[="..."]] [--concurrent-archivers[="..."]] [--max-websites-to-process="..."] [--max-archives-to-process="..."] [--disable-scheduled-tasks] [--accept-invalid-ssl-certificate] [--php-cli-options[="..."]] [--force-all-websites] [--force-report[="..."]]
cron             |
cron             |

Additional info

Seems to be related with a PHP deprecation? From Logs: 'PHP Deprecated: Using ${var} in strings is deprecated, use {$var} instead in

rafaelmaeuer commented 8 months ago

@crazy-max any ideas or help on this one?

crazy-max commented 8 months ago

Sorry I'm not using matomo anymore so can't help right now. I labeled this issue if community can give some help.

rafaelmaeuer commented 8 months ago

Ok - understand. It seems to be an issue in symfony and should be resolved in matomo v5: https://forum.matomo.org/t/deprecated-warning-in-archiver-for-php8-2/52852, so it might be worth upgrading this repo to v5?

rafaelmaeuer commented 8 months ago

If I provide a PR would you be able to merge it? Or does upgrading to v5 require more changes than the usual increase of version on dockerfile?

rafaelmaeuer commented 8 months ago

I forked this repo and re-published my own version on dockerhub updated to v5.0.2 -> issue is fixed: https://github.com/rafaelmaeuer/docker-matomo/ or https://hub.docker.com/r/rafaelmaeuer/matomo

benr77 commented 5 months ago

@rafaelmaeuer Just to let you know that your fork is now definitely in use by us. I don't know if @crazy-max has plans to do any more work on this repo. If you are both happy to do so it might be worth putting a note on this repo and sending people to the new one. Anyway, thank you to you both for your efforts.