{
  "manifest_version": "1.0.0",
  "template": {
    "id": "fc5fa824-af0f-40f4-b03a-ceccd0b07498",
    "slug": "mysql-pitr",
    "name": "MySQL PITR",
    "description": "Point-in-time recovery via binlog archiving for MySQL, standalone or HA",
    "url": "https://railway.com/deploy/mysql-pitr",
    "upstream": {
      "image": "ghcr.io/railwayapp-templates/mysql-ha/mysql:8.4"
    }
  },
  "services": [
    {
      "name": "MySQL",
      "source": {
        "image": "ghcr.io/railwayapp-templates/mysql-ha/mysql:8.4"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/mysql",
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "MYSQLHOST",
      "service": "MySQL",
      "description": "Railway Private Domain Name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "MYSQLPORT",
      "service": "MySQL",
      "description": "MySQL port.",
      "secret": false,
      "strategy": "default",
      "default": "3306"
    },
    {
      "key": "MYSQLUSER",
      "service": "MySQL",
      "description": "MySQL user, used for the Data panel.",
      "secret": false,
      "strategy": "default",
      "default": "root"
    },
    {
      "key": "MYSQL_URL",
      "service": "MySQL",
      "description": "URL to connect to MySQL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "MYSQLDATABASE",
      "service": "MySQL",
      "description": "Default database, used for Data panel.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "MYSQLPASSWORD",
      "service": "MySQL",
      "description": "Root password, used for Data panel.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "MYSQL_DATABASE",
      "service": "MySQL",
      "description": "Database to be created on image startup.",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "BINLOG_ARCHIVE_KEY",
      "service": "MySQL",
      "description": "Provide a value for BINLOG_ARCHIVE_KEY.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "BINLOG_ARCHIVE_PATH",
      "service": "MySQL",
      "description": "Provide a value for BINLOG_ARCHIVE_PATH.",
      "secret": false,
      "strategy": "default",
      "default": "/binlog"
    },
    {
      "key": "MYSQL_ROOT_PASSWORD",
      "service": "MySQL",
      "description": "Root password for MySQL DB.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "BINLOG_ARCHIVE_BUCKET",
      "service": "MySQL",
      "description": "Provide a value for BINLOG_ARCHIVE_BUCKET.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "BINLOG_ARCHIVE_REGION",
      "service": "MySQL",
      "description": "Provide a value for BINLOG_ARCHIVE_REGION.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "BINLOG_ARCHIVE_SECRET",
      "service": "MySQL",
      "description": "Provide a value for BINLOG_ARCHIVE_SECRET.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "BINLOG_ARCHIVE_ENDPOINT",
      "service": "MySQL",
      "description": "Provide a value for BINLOG_ARCHIVE_ENDPOINT.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "mysql-pitr"
      }
    },
    "cli": "railway deploy --template mysql-pitr",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "fc5fa824-af0f-40f4-b03a-ceccd0b07498",
            "serializedConfig": {
              "buckets": {
                "mysql-pitr-binlog": {
                  "name": "MySQL-PITR",
                  "parentServiceId": "MySQL"
                }
              },
              "services": {
                "mysql-pitr-root": {
                  "icon": "https://devicons.railway.app/i/mysql.svg",
                  "name": "MySQL",
                  "build": {},
                  "deploy": {
                    "healthcheckPath": null,
                    "requiredMountPath": "/var/lib/mysql"
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/mysql-ha/mysql:8.4",
                    "preserveExisting": false
                  },
                  "variables": {
                    "MYSQLHOST": {
                      "isOptional": false,
                      "description": "Railway Private Domain Name.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}",
                      "preserveExisting": true
                    },
                    "MYSQLPORT": {
                      "isOptional": false,
                      "description": "MySQL port.",
                      "defaultValue": "3306",
                      "preserveExisting": true
                    },
                    "MYSQLUSER": {
                      "isOptional": false,
                      "description": "MySQL user, used for the Data panel.",
                      "defaultValue": "root",
                      "preserveExisting": true
                    },
                    "MYSQL_URL": {
                      "isOptional": false,
                      "description": "URL to connect to MySQL.",
                      "defaultValue": "mysql://${{ MYSQLUSER }}:${{ MYSQL_ROOT_PASSWORD }}@${{ RAILWAY_PRIVATE_DOMAIN }}:3306/${{ MYSQL_DATABASE }}",
                      "preserveExisting": true
                    },
                    "MYSQLDATABASE": {
                      "isOptional": false,
                      "description": "Default database, used for Data panel.",
                      "defaultValue": "${{ MYSQL_DATABASE }}",
                      "preserveExisting": true
                    },
                    "MYSQLPASSWORD": {
                      "isOptional": false,
                      "description": "Root password, used for Data panel.",
                      "defaultValue": "${{ MYSQL_ROOT_PASSWORD }}",
                      "preserveExisting": true
                    },
                    "MYSQL_DATABASE": {
                      "isOptional": false,
                      "description": "Database to be created on image startup.",
                      "defaultValue": "railway",
                      "preserveExisting": true
                    },
                    "BINLOG_ARCHIVE_KEY": {
                      "defaultValue": "${{MySQL-PITR.ACCESS_KEY_ID}}"
                    },
                    "BINLOG_ARCHIVE_PATH": {
                      "defaultValue": "/binlog"
                    },
                    "MYSQL_ROOT_PASSWORD": {
                      "isOptional": false,
                      "description": "Root password for MySQL DB.",
                      "defaultValue": "{{MYSQL_ROOT_PASSWORD}}",
                      "preserveExisting": true
                    },
                    "BINLOG_ARCHIVE_BUCKET": {
                      "defaultValue": "${{MySQL-PITR.BUCKET}}"
                    },
                    "BINLOG_ARCHIVE_REGION": {
                      "defaultValue": "${{MySQL-PITR.REGION}}"
                    },
                    "BINLOG_ARCHIVE_SECRET": {
                      "defaultValue": "${{MySQL-PITR.SECRET_ACCESS_KEY}}"
                    },
                    "BINLOG_ARCHIVE_ENDPOINT": {
                      "defaultValue": "${{MySQL-PITR.ENDPOINT}}"
                    }
                  },
                  "networking": {},
                  "clusterRole": "root",
                  "volumeMounts": {
                    "mysql-pitr-volume": {
                      "mountPath": "/var/lib/mysql"
                    }
                  },
                  "haTemplateCode": "mysql-ha",
                  "haConversionConfig": {
                    "edge": {
                      "label": "Reverse Proxies",
                      "options": [
                        1,
                        2
                      ],
                      "nodeLabel": "HAProxy",
                      "description": "HAProxy instances routing writes to the primary",
                      "defaultValue": 2
                    },
                    "replica": {
                      "label": "MySQL Replicas",
                      "options": [
                        2,
                        4,
                        6,
                        8
                      ],
                      "nodeLabel": "MySQL",
                      "description": "Requires odd count for quorum",
                      "defaultValue": 2
                    },
                    "internal": null,
                    "description": "This will convert your MySQL instance to an HA cluster with Group Replication failover and HAProxy routing to the primary.",
                    "supportedImageMajorVersions": [
                      8,
                      9
                    ]
                  },
                  "adoptionImageEligibility": {
                    "label": "Point-in-time recovery",
                    "repositories": [
                      "ghcr.io/railwayapp-templates/mysql-ha/mysql",
                      "ghcr.io/railwayapp-templates/mysql-ha/mysql-wrapper"
                    ],
                    "requireImageEntrypoint": true
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 1,
    "needs_volume": true
  },
  "generated_at": "2026-09-10T10:14:45.332Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-04T14:19:39.709Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_da17f217f2914da68397",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 73,
    "typical_build_seconds": 0,
    "typical_start_seconds": 20,
    "slowest_service": "MySQL"
  }
}
