{
  "manifest_version": "1.0.0",
  "template": {
    "id": "3d47e741-794a-4553-bc84-38cd931890c3",
    "slug": "timescaledb-replica-postgresql",
    "name": "🚀 TimescaleDB HA (Primary + Replica)",
    "description": "🚀 TimescaleDB HA: Primary + Replica with Pgpool Load Balancer",
    "url": "https://railway.com/deploy/timescaledb-replica-postgresql"
  },
  "services": [
    {
      "name": "timescale-proxy",
      "source": {
        "repo": "https://github.com/icueth/railsway-timescaledb-replica"
      },
      "needs_volume": false,
      "tcp_ports": [
        5432
      ],
      "http": false
    },
    {
      "name": "timescale-primary",
      "source": {
        "repo": "https://github.com/icueth/railsway-timescaledb-replica"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    },
    {
      "name": "timescale-replica",
      "source": {
        "repo": "https://github.com/icueth/railsway-timescaledb-replica"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "TZ",
      "service": "timescale-proxy",
      "description": "Provide a value for TZ.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "NODE_ROLE",
      "service": "timescale-proxy",
      "description": "Provide a value for NODE_ROLE.",
      "secret": false,
      "strategy": "default",
      "default": "PROXY"
    },
    {
      "key": "POSTGRES_DB",
      "service": "timescale-proxy",
      "description": "Provide a value for POSTGRES_DB.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PRIMARY_HOST",
      "service": "timescale-proxy",
      "description": "Provide a value for PRIMARY_HOST.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "REPLICA_HOST",
      "service": "timescale-proxy",
      "description": "Provide a value for REPLICA_HOST.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "timescale-proxy",
      "description": "Provide a value for POSTGRES_USER.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "TS_TUNE_CORES",
      "service": "timescale-proxy",
      "description": "Provide a value for TS_TUNE_CORES.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "TS_TUNE_MEMORY",
      "service": "timescale-proxy",
      "description": "Provide a value for TS_TUNE_MEMORY.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "timescale-proxy",
      "description": "Provide a value for POSTGRES_PASSWORD.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PUBLIC_CONNECTION_URL",
      "service": "timescale-proxy",
      "description": "Provide a value for PUBLIC_CONNECTION_URL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PRIVATE_CONNECTION_URL",
      "service": "timescale-proxy",
      "description": "Provide a value for PRIVATE_CONNECTION_URL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "TZ",
      "service": "timescale-primary",
      "description": "Provide a value for TZ.",
      "secret": false,
      "strategy": "default",
      "default": "Asia/Bangkok"
    },
    {
      "key": "PGDATA",
      "service": "timescale-primary",
      "description": "Provide a value for PGDATA.",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "NODE_ROLE",
      "service": "timescale-primary",
      "description": "Provide a value for NODE_ROLE.",
      "secret": false,
      "strategy": "default",
      "default": "PRIMARY"
    },
    {
      "key": "POSTGRES_DB",
      "service": "timescale-primary",
      "description": "Provide a value for POSTGRES_DB.",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "PRIMARY_HOST",
      "service": "timescale-primary",
      "description": "Provide a value for PRIMARY_HOST.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "timescale-primary",
      "description": "Provide a value for POSTGRES_USER.",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "TS_TUNE_CORES",
      "service": "timescale-primary",
      "description": "Provide a value for TS_TUNE_CORES.",
      "secret": false,
      "strategy": "default",
      "default": "2"
    },
    {
      "key": "TS_TUNE_MEMORY",
      "service": "timescale-primary",
      "description": "Provide a value for TS_TUNE_MEMORY.",
      "secret": false,
      "strategy": "default",
      "default": "2GB"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "timescale-primary",
      "description": "Provide a value for POSTGRES_PASSWORD.",
      "secret": true,
      "strategy": "default",
      "default": "youestrongpassword"
    },
    {
      "key": "TZ",
      "service": "timescale-replica",
      "description": "Provide a value for TZ.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATA",
      "service": "timescale-replica",
      "description": "Provide a value for PGDATA.",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "NODE_ROLE",
      "service": "timescale-replica",
      "description": "Provide a value for NODE_ROLE.",
      "secret": false,
      "strategy": "default",
      "default": "REPLICA"
    },
    {
      "key": "POSTGRES_DB",
      "service": "timescale-replica",
      "description": "Provide a value for POSTGRES_DB.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PRIMARY_HOST",
      "service": "timescale-replica",
      "description": "Provide a value for PRIMARY_HOST.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "timescale-replica",
      "description": "Provide a value for POSTGRES_USER.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "TS_TUNE_CORES",
      "service": "timescale-replica",
      "description": "Provide a value for TS_TUNE_CORES.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "TS_TUNE_MEMORY",
      "service": "timescale-replica",
      "description": "Provide a value for TS_TUNE_MEMORY.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "timescale-replica",
      "description": "Provide a value for POSTGRES_PASSWORD.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "timescaledb-replica-postgresql"
      }
    },
    "cli": "railway deploy --template timescaledb-replica-postgresql",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "3d47e741-794a-4553-bc84-38cd931890c3",
            "serializedConfig": {
              "services": {
                "44f3b97d-1305-4437-9517-2313307ec89f": {
                  "icon": "https://devicons.railway.app/i/timescale-light.svg",
                  "name": "timescale-proxy",
                  "source": {
                    "repo": "icueth/railsway-timescaledb-replica",
                    "branch": null,
                    "rootDirectory": "/proxy"
                  },
                  "variables": {
                    "TZ": {
                      "defaultValue": "${{timescale-primary.TZ}}"
                    },
                    "NODE_ROLE": {
                      "defaultValue": "PROXY"
                    },
                    "POSTGRES_DB": {
                      "defaultValue": "${{timescale-primary.POSTGRES_DB}}"
                    },
                    "PRIMARY_HOST": {
                      "defaultValue": "${{timescale-primary.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "REPLICA_HOST": {
                      "defaultValue": "${{timescale-replica.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "POSTGRES_USER": {
                      "defaultValue": "${{timescale-primary.POSTGRES_USER}}"
                    },
                    "TS_TUNE_CORES": {
                      "defaultValue": "${{timescale-primary.TS_TUNE_CORES}}"
                    },
                    "TS_TUNE_MEMORY": {
                      "defaultValue": "${{timescale-primary.TS_TUNE_MEMORY}}"
                    },
                    "POSTGRES_PASSWORD": {
                      "defaultValue": "${{timescale-primary.POSTGRES_PASSWORD}}"
                    },
                    "PUBLIC_CONNECTION_URL": {
                      "description": "",
                      "defaultValue": "postgresql://${{timescale-primary.POSTGRES_USER}}:${{timescale-primary.POSTGRES_PASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{timescale-primary.POSTGRES_DB}}"
                    },
                    "PRIVATE_CONNECTION_URL": {
                      "defaultValue": "postgresql://${{timescale-primary.POSTGRES_USER}}:${{timescale-primary.POSTGRES_PASSWORD}}@${{timescale-proxy.RAILWAY_PRIVATE_DOMAIN}}:5432/${{timescale-primary.POSTGRES_DB}}"
                    }
                  },
                  "networking": {
                    "tcpProxies": {
                      "5432": {}
                    }
                  }
                },
                "60c5642a-4fd1-4a86-924a-4baadb0c4685": {
                  "icon": "https://devicons.railway.app/i/timescale-light.svg",
                  "name": "timescale-primary",
                  "source": {
                    "repo": "icueth/railsway-timescaledb-replica",
                    "branch": null,
                    "rootDirectory": null
                  },
                  "variables": {
                    "TZ": {
                      "defaultValue": "Asia/Bangkok"
                    },
                    "PGDATA": {
                      "isOptional": false,
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "NODE_ROLE": {
                      "defaultValue": "PRIMARY"
                    },
                    "POSTGRES_DB": {
                      "defaultValue": "postgres"
                    },
                    "PRIMARY_HOST": {
                      "defaultValue": "${{timescale-primary.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "POSTGRES_USER": {
                      "defaultValue": "postgres"
                    },
                    "TS_TUNE_CORES": {
                      "defaultValue": "2"
                    },
                    "TS_TUNE_MEMORY": {
                      "defaultValue": "2GB"
                    },
                    "POSTGRES_PASSWORD": {
                      "defaultValue": "youestrongpassword"
                    }
                  },
                  "volumeMounts": {
                    "60c5642a-4fd1-4a86-924a-4baadb0c4685": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                },
                "f99fa5dd-7cac-4af6-bc8b-e10edbc3d55f": {
                  "icon": "https://devicons.railway.app/i/timescale-light.svg",
                  "name": "timescale-replica",
                  "source": {
                    "repo": "icueth/railsway-timescaledb-replica",
                    "branch": null,
                    "rootDirectory": null
                  },
                  "variables": {
                    "TZ": {
                      "description": "",
                      "defaultValue": "${{timescale-primary.TZ}}"
                    },
                    "PGDATA": {
                      "isOptional": false,
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "NODE_ROLE": {
                      "defaultValue": "REPLICA"
                    },
                    "POSTGRES_DB": {
                      "description": "",
                      "defaultValue": "${{timescale-primary.POSTGRES_DB}}"
                    },
                    "PRIMARY_HOST": {
                      "defaultValue": "${{timescale-primary.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "POSTGRES_USER": {
                      "description": "",
                      "defaultValue": "${{timescale-primary.POSTGRES_USER}}"
                    },
                    "TS_TUNE_CORES": {
                      "description": "",
                      "defaultValue": "${{timescale-primary.TS_TUNE_CORES}}"
                    },
                    "TS_TUNE_MEMORY": {
                      "description": "",
                      "defaultValue": "${{timescale-primary.TS_TUNE_MEMORY}}"
                    },
                    "POSTGRES_PASSWORD": {
                      "defaultValue": "${{timescale-primary.POSTGRES_PASSWORD}}"
                    }
                  },
                  "volumeMounts": {
                    "f99fa5dd-7cac-4af6-bc8b-e10edbc3d55f": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 3,
    "needs_volume": true
  },
  "generated_at": "2026-09-21T22:14:44.200Z",
  "generator_version": "0.1.0",
  "status": "degraded",
  "validated_at": "2026-09-20T21:47:36.949Z",
  "success_rate_30d": 0,
  "validation": {
    "last_run_id": "run_f346087ac36e41bf9805",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": false,
        "detail": "BUILDING,FAILED,FAILED"
      }
    ]
  }
}
