{
  "manifest_version": "1.0.0",
  "template": {
    "id": "fcd51be5-5962-4d36-863e-71f2685e8bbf",
    "slug": "tidb-cluster",
    "name": "TiDB Cluster",
    "description": "A MySQL-compatible distributed SQL database, deploy in 1-click 🚀",
    "url": "https://railway.com/deploy/tidb-cluster"
  },
  "services": [
    {
      "name": "pd",
      "source": {
        "image": "pingcap/pd:v8.5.8"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "http": false
    },
    {
      "name": "tidb",
      "source": {
        "image": "pingcap/tidb:v8.5.8"
      },
      "needs_volume": false,
      "tcp_ports": [
        4000
      ],
      "http": false
    },
    {
      "name": "tikv",
      "source": {
        "image": "pingcap/tikv:v8.5.8"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "PORT",
      "service": "pd",
      "description": "Railway service port for PD client traffic",
      "secret": false,
      "strategy": "default",
      "default": "2379"
    },
    {
      "key": "RAILWAY_RUN_UID",
      "service": "pd",
      "description": "Railway volumes are mounted as root",
      "secret": false,
      "strategy": "default",
      "default": "0"
    },
    {
      "key": "PORT",
      "service": "tidb",
      "description": "MySQL-compatible SQL port",
      "secret": false,
      "strategy": "default",
      "default": "4000"
    },
    {
      "key": "PD_HOST",
      "service": "tidb",
      "description": "Private hostname of the PD service",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PORT",
      "service": "tikv",
      "description": "TiKV service port",
      "secret": false,
      "strategy": "default",
      "default": "20160"
    },
    {
      "key": "PD_HOST",
      "service": "tikv",
      "description": "Private hostname of the PD service",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "RAILWAY_RUN_UID",
      "service": "tikv",
      "description": "Allow TiKV to write to Railway volume",
      "secret": false,
      "strategy": "default",
      "default": "0"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "tidb-cluster"
      }
    },
    "cli": "railway deploy --template tidb-cluster",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "fcd51be5-5962-4d36-863e-71f2685e8bbf",
            "serializedConfig": {
              "services": {
                "27c2ba64-3069-4f79-a9a4-82fb7ab5fc10": {
                  "name": "pd",
                  "deploy": {
                    "startCommand": "pd-server \\   --name=pd \\   --data-dir=/data/pd \\   --client-urls=http://0.0.0.0:2379 \\   --advertise-client-urls=http://${RAILWAY_PRIVATE_DOMAIN}:2379 \\   --peer-urls=http://0.0.0.0:2380 \\   --advertise-peer-urls=http://${RAILWAY_PRIVATE_DOMAIN}:2380 \\   --initial-cluster=pd=http://${RAILWAY_PRIVATE_DOMAIN}:2380"
                  },
                  "source": {
                    "image": "pingcap/pd:v8.5.8"
                  },
                  "variables": {
                    "PORT": {
                      "description": "Railway service port for PD client traffic",
                      "defaultValue": "2379"
                    },
                    "RAILWAY_RUN_UID": {
                      "description": "Railway volumes are mounted as root",
                      "defaultValue": "0"
                    }
                  },
                  "volumeMounts": {
                    "27c2ba64-3069-4f79-a9a4-82fb7ab5fc10": {
                      "mountPath": "/data"
                    }
                  }
                },
                "aadf5cbb-22b4-4706-bd27-cd6d67a3b8e9": {
                  "icon": "https://raw.githubusercontent.com/pingcap/tidb/refs/heads/master/docs/tidb-logo.png",
                  "name": "tidb",
                  "deploy": {
                    "startCommand": "tidb-server \\   --store=tikv \\   --path=${pd.RAILWAY_PRIVATE_DOMAIN}:2379 \\   --host=0.0.0.0 \\   --advertise-address=${RAILWAY_PRIVATE_DOMAIN} \\   --port=4000 \\   --status=10080"
                  },
                  "source": {
                    "image": "pingcap/tidb:v8.5.8"
                  },
                  "variables": {
                    "PORT": {
                      "description": "MySQL-compatible SQL port",
                      "defaultValue": "4000"
                    },
                    "PD_HOST": {
                      "description": "Private hostname of the PD service",
                      "defaultValue": "${{pd.RAILWAY_PRIVATE_DOMAIN}}"
                    }
                  },
                  "networking": {
                    "tcpProxies": {
                      "4000": {}
                    }
                  }
                },
                "ed3409a2-a177-43b5-929c-41faee026f77": {
                  "icon": "https://github.com/tikv/tikv/raw/master/images/tikv-logo.png",
                  "name": "tikv",
                  "deploy": {
                    "startCommand": "tikv-server \\   --addr=0.0.0.0:20160 \\   --advertise-addr=${RAILWAY_PRIVATE_DOMAIN}:20160 \\   --status-addr=0.0.0.0:20180 \\   --advertise-status-addr=${RAILWAY_PRIVATE_DOMAIN}:20180 \\   --pd=${pd.RAILWAY_PRIVATE_DOMAIN}:2379 \\   --data-dir=/data/tikv"
                  },
                  "source": {
                    "image": "pingcap/tikv:v8.5.8"
                  },
                  "variables": {
                    "PORT": {
                      "description": "TiKV service port",
                      "defaultValue": "20160"
                    },
                    "PD_HOST": {
                      "description": "Private hostname of the PD service",
                      "defaultValue": "${{pd.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "RAILWAY_RUN_UID": {
                      "description": "Allow TiKV to write to Railway volume",
                      "defaultValue": "0"
                    }
                  },
                  "volumeMounts": {
                    "ed3409a2-a177-43b5-929c-41faee026f77": {
                      "mountPath": "/data"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 3,
    "needs_volume": true
  },
  "generated_at": "2026-09-20T10:14:37.339Z",
  "generator_version": "0.1.0",
  "status": "degraded",
  "validated_at": "2026-09-19T12:32:53.530Z",
  "success_rate_30d": 0,
  "validation": {
    "last_run_id": "run_b72b885e316b410fa08c",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": false,
        "detail": "FAILED,DEPLOYING,DEPLOYING"
      }
    ]
  }
}
