# Matomo Analytics Setup This repository contains the Docker configuration for running Matomo Analytics in production. ## Prerequisites - Docker - Docker Compose - At least 2GB of RAM - 20GB+ storage space ## Setup Instructions 1. Configure environment variables: - Edit `.env` file and set secure passwords for: - MYSQL_ROOT_PASSWORD - MYSQL_PASSWORD 2. Start the containers: ```bash docker compose up -d ``` 3. Access Matomo: - Open http://localhost:8080 - Follow the installation wizard - Use these database settings: - Server: db - Login: matomo - Password: (value of MYSQL_PASSWORD from .env) - Database Name: matomo ## Production Configuration ### Security - Change default admin password - Enable 2FA for admin accounts - Configure trusted hosts in config.ini.php - Set up SSL/TLS termination via reverse proxy ### Performance - Database is configured with: - max-allowed-packet: 64MB - PHP memory limit: 512MB - Adjust these values in docker-compose.yml if needed ### Maintenance - Backup volumes regularly: - matomo_db: Database data - matomo_data: Matomo files - matomo_config: Configuration - Monitor container health: ```bash docker compose ps docker compose logs ``` ### Updating 1. Pull new images: ```bash docker compose pull ``` 2. Restart containers: ```bash docker compose down docker compose up -d ``` ## Troubleshooting ### Database Connection Issues - Verify database credentials in .env - Check database container logs: ```bash docker compose logs db ``` ### Performance Issues - Monitor resource usage: ```bash docker stats ``` - Adjust PHP memory limit if needed - Consider enabling caching ### Container Health Both containers have health checks configured: - Database: Checks MySQL connection - Matomo: Checks HTTP response Monitor health status: ```bash docker compose ps