{
  "manifest_version": "1.0.0",
  "template": {
    "id": "03a37b76-f2a4-4ca2-a973-246df43851d9",
    "slug": "matomo-analytics-mariadb",
    "name": "Matomo Analytics + MariaDB",
    "description": "Privacy-friendly analytics with MariaDB and persistent volumes.",
    "url": "https://railway.com/deploy/matomo-analytics-mariadb",
    "upstream": {
      "image": "matomo:5.8.0-apache"
    }
  },
  "services": [
    {
      "name": "mariadb",
      "source": {
        "image": "mariadb:11"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/mysql",
      "http": false
    },
    {
      "name": "matomo",
      "source": {
        "image": "matomo:5.8.0-apache"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/www/html",
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "MARIADB_USER",
      "service": "mariadb",
      "description": "MariaDB application user Matomo uses to connect to the database.",
      "secret": false,
      "strategy": "default",
      "default": "matomo"
    },
    {
      "key": "MARIADB_DATABASE",
      "service": "mariadb",
      "description": "MariaDB database created for Matomo analytics data.",
      "secret": false,
      "strategy": "default",
      "default": "matomo"
    },
    {
      "key": "MARIADB_PASSWORD",
      "service": "mariadb",
      "description": "Generated password for the Matomo MariaDB application user.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "MARIADB_ROOT_PASSWORD",
      "service": "mariadb",
      "description": "Generated MariaDB root password for administrative access.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "PORT",
      "service": "matomo",
      "description": "Railway HTTP proxy port for the Matomo service.",
      "secret": false,
      "strategy": "default",
      "default": "80"
    },
    {
      "key": "PHP_MEMORY_LIMIT",
      "service": "matomo",
      "description": "PHP memory limit for Matomo.",
      "secret": false,
      "strategy": "default",
      "default": "256M"
    },
    {
      "key": "MATOMO_DATABASE_HOST",
      "service": "matomo",
      "description": "Private hostname for the MariaDB service on Railway.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "MATOMO_DATABASE_DBNAME",
      "service": "matomo",
      "description": "MariaDB database Matomo stores analytics data in.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "MATOMO_DATABASE_ADAPTER",
      "service": "matomo",
      "description": "Database adapter Matomo should use.",
      "secret": false,
      "strategy": "default",
      "default": "mysql"
    },
    {
      "key": "MATOMO_DATABASE_PASSWORD",
      "service": "matomo",
      "description": "Password for the Matomo MariaDB application user.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "MATOMO_DATABASE_USERNAME",
      "service": "matomo",
      "description": "MariaDB user Matomo uses for application queries.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "MATOMO_DATABASE_TABLES_PREFIX",
      "service": "matomo",
      "description": "Prefix Matomo adds to database table names.",
      "secret": false,
      "strategy": "default",
      "default": "matomo_"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "matomo-analytics-mariadb"
      }
    },
    "cli": "railway deploy --template matomo-analytics-mariadb",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "03a37b76-f2a4-4ca2-a973-246df43851d9",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "3aab97fc-26bc-4f92-b826-ea9012014953": {
                  "icon": "https://cdn.jsdelivr.net/gh/selfhst/icons/svg/mariadb.svg",
                  "name": "mariadb",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "mariadb:11"
                  },
                  "variables": {
                    "MARIADB_USER": {
                      "isOptional": false,
                      "description": "MariaDB application user Matomo uses to connect to the database.",
                      "defaultValue": "matomo"
                    },
                    "MARIADB_DATABASE": {
                      "isOptional": false,
                      "description": "MariaDB database created for Matomo analytics data.",
                      "defaultValue": "matomo"
                    },
                    "MARIADB_PASSWORD": {
                      "isOptional": false,
                      "description": "Generated password for the Matomo MariaDB application user.",
                      "defaultValue": "{{MARIADB_PASSWORD}}"
                    },
                    "MARIADB_ROOT_PASSWORD": {
                      "isOptional": false,
                      "description": "Generated MariaDB root password for administrative access.",
                      "defaultValue": "{{MARIADB_ROOT_PASSWORD}}"
                    }
                  },
                  "volumeMounts": {
                    "3aab97fc-26bc-4f92-b826-ea9012014953": {
                      "mountPath": "/var/lib/mysql"
                    }
                  }
                },
                "e6caee7b-3d47-4a8f-8bc6-9d4540e945fb": {
                  "icon": "https://cdn.jsdelivr.net/gh/selfhst/icons/svg/matomo.svg",
                  "name": "matomo",
                  "deploy": {
                    "startCommand": "/bin/sh -c \"a2dismod mpm_event || true; a2dismod mpm_worker || true; a2enmod mpm_prefork || true; exec /entrypoint.sh apache2-foreground\"",
                    "healthcheckPath": "/",
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "matomo:5.8.0-apache"
                  },
                  "variables": {
                    "PORT": {
                      "description": "Railway HTTP proxy port for the Matomo service.",
                      "defaultValue": "80"
                    },
                    "PHP_MEMORY_LIMIT": {
                      "description": "PHP memory limit for Matomo.",
                      "defaultValue": "256M"
                    },
                    "MATOMO_DATABASE_HOST": {
                      "description": "Private hostname for the MariaDB service on Railway.",
                      "defaultValue": "${{ mariadb.RAILWAY_PRIVATE_DOMAIN }}"
                    },
                    "MATOMO_DATABASE_DBNAME": {
                      "description": "MariaDB database Matomo stores analytics data in.",
                      "defaultValue": "${{ mariadb.MARIADB_DATABASE }}"
                    },
                    "MATOMO_DATABASE_ADAPTER": {
                      "description": "Database adapter Matomo should use.",
                      "defaultValue": "mysql"
                    },
                    "MATOMO_DATABASE_PASSWORD": {
                      "description": "Password for the Matomo MariaDB application user.",
                      "defaultValue": "${{ mariadb.MARIADB_PASSWORD }}"
                    },
                    "MATOMO_DATABASE_USERNAME": {
                      "description": "MariaDB user Matomo uses for application queries.",
                      "defaultValue": "${{ mariadb.MARIADB_USER }}"
                    },
                    "MATOMO_DATABASE_TABLES_PREFIX": {
                      "description": "Prefix Matomo adds to database table names.",
                      "defaultValue": "matomo_"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>": {}
                    }
                  },
                  "volumeMounts": {
                    "e6caee7b-3d47-4a8f-8bc6-9d4540e945fb": {
                      "mountPath": "/var/www/html"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "matomo",
      "method": "GET",
      "path": "/",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 2,
    "needs_volume": true
  },
  "generated_at": "2026-09-10T16:14:52.212Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-09T07:04:42.721Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_26ea0f7b6c234ad8bc78",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "healthcheck",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 68,
    "typical_build_seconds": 0,
    "typical_start_seconds": 11,
    "slowest_service": "matomo"
  }
}
