services:
  db:
    image: mariadb
    command: --max-allowed-packet=64MB
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_PASSWORD=password
      - MYSQL_DATABASE=matomo
      - MYSQL_USER=matomo
    volumes:
      - db:/var/lib/mysql

  app:
    image: matomo:latest
    restart: always
    depends_on:
      - db
    environment:
      - MATOMO_DATABASE_HOST=db
      - MATOMO_DATABASE_ADAPTER=mysql
      - MATOMO_DATABASE_TABLES_PREFIX=matomo_
      - MATOMO_DATABASE_USERNAME=matomo
      - MATOMO_DATABASE_PASSWORD=password
      - MATOMO_DATABASE_DBNAME=matomo
      - PHP_MEMORY_LIMIT=2048M
    volumes:
      # - ./config:/var/www/html/config:rw
      # - ./logs:/var/www/html/logs
      - matomo:/var/www/html
    ports:
      - 9800:80

volumes:
  db:
  matomo:
