{
  "manifest_version": "1.0.0",
  "template": {
    "id": "95e86ab3-ac34-47fe-ab10-3cf6f44573dd",
    "slug": "maxapi",
    "name": "MaxAPI",
    "description": "API Distribution System (New API Customized Version)",
    "url": "https://railway.com/deploy/maxapi",
    "upstream": {
      "image": "pochacco/max-api:latest"
    }
  },
  "services": [
    {
      "name": "MySQL",
      "source": {
        "image": "mysql:9.4"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/mysql",
      "tcp_ports": [
        3306
      ],
      "http": false
    },
    {
      "name": "Max API",
      "source": {
        "image": "pochacco/max-api:latest"
      },
      "needs_volume": false,
      "http": true
    },
    {
      "name": "Redis",
      "source": {
        "image": "redis:8.2.1"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "tcp_ports": [
        6379
      ],
      "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": "MYSQL_PUBLIC_URL",
      "service": "MySQL",
      "description": "URL to connect to MySQL DB, used for Data panel.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "MYSQL_ROOT_PASSWORD",
      "service": "MySQL",
      "description": "Root password for MySQL DB.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "TZ",
      "service": "Max API",
      "description": "Provide a value for TZ.",
      "secret": false,
      "strategy": "default",
      "default": "Asia/Shanghai"
    },
    {
      "key": "SQL_DSN",
      "service": "Max API",
      "description": "Provide a value for SQL_DSN.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "SESSION_SECRET",
      "service": "Max API",
      "description": "Provide a value for SESSION_SECRET.",
      "secret": true,
      "strategy": "default",
      "default": "OVHAP7Tdd786zoguUDrK9x38qesEPUYoRYGVN72kRy38U3HFAHXbn34Xa7Vqs4dC"
    },
    {
      "key": "REDIS_CONN_STRING",
      "service": "Max API",
      "description": "Provide a value for REDIS_CONN_STRING.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDISHOST",
      "service": "Redis",
      "description": "Provide a value for REDISHOST.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "REDISPORT",
      "service": "Redis",
      "description": "Provide a value for REDISPORT.",
      "secret": false,
      "strategy": "default",
      "default": "6379"
    },
    {
      "key": "REDISUSER",
      "service": "Redis",
      "description": "Provide a value for REDISUSER.",
      "secret": false,
      "strategy": "default",
      "default": "default"
    },
    {
      "key": "REDIS_URL",
      "service": "Redis",
      "description": "Connection string for connecting to redis using the private network",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDISPASSWORD",
      "service": "Redis",
      "description": "Provide a value for REDISPASSWORD.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDIS_PASSWORD",
      "service": "Redis",
      "description": "Provide a value for REDIS_PASSWORD.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "REDIS_PUBLIC_URL",
      "service": "Redis",
      "description": "Connection string for connecting to redis externally",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "maxapi"
      }
    },
    "cli": "railway deploy --template maxapi",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "95e86ab3-ac34-47fe-ab10-3cf6f44573dd",
            "serializedConfig": {
              "services": {
                "8c936c0f-9c89-4170-b8b4-08908bfeebaf": {
                  "icon": "https://devicons.railway.app/i/mysql.svg",
                  "name": "MySQL",
                  "build": {},
                  "deploy": {
                    "startCommand": "docker-entrypoint.sh mysqld --innodb-use-native-aio=0 --disable-log-bin --performance_schema=0 --innodb-buffer-pool-size=1G",
                    "healthcheckPath": null,
                    "requiredMountPath": "/var/lib/mysql"
                  },
                  "source": {
                    "image": "mysql:9.4"
                  },
                  "variables": {
                    "MYSQLHOST": {
                      "isOptional": false,
                      "description": "Railway Private Domain Name.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "MYSQLPORT": {
                      "isOptional": false,
                      "description": "MySQL port.",
                      "defaultValue": "3306"
                    },
                    "MYSQLUSER": {
                      "isOptional": false,
                      "description": "MySQL user, used for the Data panel.",
                      "defaultValue": "root"
                    },
                    "MYSQL_URL": {
                      "isOptional": false,
                      "description": "URL to connect to MySQL.",
                      "defaultValue": "mysql://${{ MYSQLUSER }}:${{ MYSQL_ROOT_PASSWORD }}@${{ RAILWAY_PRIVATE_DOMAIN }}:3306/${{ MYSQL_DATABASE }}"
                    },
                    "MYSQLDATABASE": {
                      "isOptional": false,
                      "description": "Default database, used for Data panel.",
                      "defaultValue": "${{ MYSQL_DATABASE }}"
                    },
                    "MYSQLPASSWORD": {
                      "isOptional": false,
                      "description": "Root password, used for Data panel.",
                      "defaultValue": "${{ MYSQL_ROOT_PASSWORD }}"
                    },
                    "MYSQL_DATABASE": {
                      "isOptional": false,
                      "description": "Database to be created on image startup.",
                      "defaultValue": "railway"
                    },
                    "MYSQL_PUBLIC_URL": {
                      "description": "URL to connect to MySQL DB, used for Data panel.",
                      "defaultValue": "mysql://${{ MYSQLUSER }}:${{ MYSQL_ROOT_PASSWORD }}@${{ RAILWAY_TCP_PROXY_DOMAIN }}:${{ RAILWAY_TCP_PROXY_PORT }}/${{ MYSQL_DATABASE }}"
                    },
                    "MYSQL_ROOT_PASSWORD": {
                      "isOptional": false,
                      "description": "Root password for MySQL DB.",
                      "defaultValue": "{{MYSQL_ROOT_PASSWORD}}"
                    }
                  },
                  "networking": {
                    "tcpProxies": {
                      "3306": {}
                    },
                    "serviceDomains": {}
                  },
                  "volumeMounts": {
                    "8c936c0f-9c89-4170-b8b4-08908bfeebaf": {
                      "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
                    ]
                  }
                },
                "a4ec75a8-3855-4436-9605-150db0d75642": {
                  "name": "Max API",
                  "source": {
                    "image": "pochacco/max-api:latest"
                  },
                  "variables": {
                    "TZ": {
                      "defaultValue": "Asia/Shanghai"
                    },
                    "SQL_DSN": {
                      "defaultValue": "${{MySQL.MYSQLUSER}}:${{MySQL.MYSQLPASSWORD}}@tcp(${{MySQL.MYSQLHOST}}:${{MySQL.MYSQLPORT}})/${{MySQL.MYSQLDATABASE}}"
                    },
                    "SESSION_SECRET": {
                      "defaultValue": "OVHAP7Tdd786zoguUDrK9x38qesEPUYoRYGVN72kRy38U3HFAHXbn34Xa7Vqs4dC"
                    },
                    "REDIS_CONN_STRING": {
                      "defaultValue": "${{Redis.REDIS_URL}}"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:8080": {
                        "port": 8080
                      }
                    }
                  }
                },
                "e0751195-fc30-4d73-9fb6-da4fbc2bde2d": {
                  "icon": "https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg",
                  "name": "Redis",
                  "deploy": {
                    "startCommand": "/bin/sh -c \"rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH\""
                  },
                  "source": {
                    "image": "redis:8.2.1"
                  },
                  "variables": {
                    "REDISHOST": {
                      "isOptional": false,
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "REDISPORT": {
                      "isOptional": false,
                      "defaultValue": "6379"
                    },
                    "REDISUSER": {
                      "isOptional": false,
                      "defaultValue": "default"
                    },
                    "REDIS_URL": {
                      "isOptional": false,
                      "description": "Connection string for connecting to redis using the private network",
                      "defaultValue": "redis://${{ REDISUSER }}:${{ REDIS_PASSWORD }}@${{ REDISHOST }}:${{ REDISPORT }}"
                    },
                    "REDISPASSWORD": {
                      "isOptional": false,
                      "defaultValue": "${{REDIS_PASSWORD}}"
                    },
                    "REDIS_PASSWORD": {
                      "isOptional": false,
                      "defaultValue": "{{REDIS_PASSWORD}}"
                    },
                    "REDIS_PUBLIC_URL": {
                      "description": "Connection string for connecting to redis externally",
                      "defaultValue": "redis://default:${{ REDIS_PASSWORD }}@${{ RAILWAY_TCP_PROXY_DOMAIN }}:${{ RAILWAY_TCP_PROXY_PORT }}"
                    }
                  },
                  "networking": {
                    "tcpProxies": {
                      "6379": {}
                    }
                  },
                  "volumeMounts": {
                    "e0751195-fc30-4d73-9fb6-da4fbc2bde2d": {
                      "mountPath": "/data"
                    }
                  },
                  "haTemplateCode": "redis-ha",
                  "haConversionConfig": {
                    "edge": {
                      "label": "Reverse Proxies",
                      "options": [
                        1,
                        2
                      ],
                      "nodeLabel": "HAProxy",
                      "description": "HAProxy instances routing writes to the primary",
                      "defaultValue": 2
                    },
                    "replica": {
                      "label": "Redis Replicas",
                      "options": [
                        2,
                        3,
                        4,
                        5
                      ],
                      "nodeLabel": "Redis",
                      "description": "Nodes running Redis + colocated Sentinel",
                      "defaultValue": 2
                    },
                    "internal": null,
                    "description": "This will convert your Redis instance to an HA cluster with Sentinel failover and HAProxy routing to the primary."
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 3,
    "needs_volume": true
  },
  "generated_at": "2026-09-10T10:14:45.332Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-08T19:37:43.889Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_97920104f0484b3eb73d",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 31,
    "typical_build_seconds": 0,
    "typical_start_seconds": 10,
    "slowest_service": "Max API"
  }
}
