services:
  matomo:
    image: matomo:5.1-apache
    restart: always
    environment:
      - MATOMO_DATABASE_HOST=${MATOMO_DATABASE_HOST}
      - MATOMO_DATABASE_DB=${MATOMO_DATABASE_DB}
      - MATOMO_DATABASE_USER=${MATOMO_DATABASE_USER}
      - MATOMO_DATABASE_PASSWORD=${MATOMO_DATABASE_PASSWORD}
    volumes:
      - matomo:/var/www/html
    depends_on:
      - db

  db:
    image: mariadb:10.11
    restart: always
    command: --max-allowed-packet=64MB
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - MYSQL_DATABASE=${MYSQL_DATABASE}
      - MYSQL_USER=${MYSQL_USER}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
    volumes:
      - db:/var/lib/mysql

volumes:
  matomo:
  db:
