{
  "manifest_version": "1.0.0",
  "template": {
    "id": "a617d269-1e2c-4273-a804-1a0d71f7a4ab",
    "slug": "postgres-ha-1",
    "name": "postgres-ha",
    "description": "Postgres HA template build (Patroni + etcd + HAProxy)",
    "url": "https://railway.com/deploy/postgres-ha-1"
  },
  "status": "unvalidated",
  "validated_at": null,
  "success_rate_30d": null,
  "services": [
    {
      "name": "Postgres",
      "source": {
        "image": "ghcr.io/onepush-dev/postgres-ha-router:18.6@sha256:7a01696b8161be78693b957469d63976a796c8d1e721f0c9aca48736743bce98"
      },
      "needs_volume": false,
      "tcp_ports": [
        5432
      ],
      "http": false
    },
    {
      "name": "pg-3",
      "source": {
        "image": "ghcr.io/onepush-dev/postgres-ha-node:18.6@sha256:31e91770e734468e2da836067da77c2d5505425c4e96779fee07c79f69f2f585"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    },
    {
      "name": "pg-2",
      "source": {
        "image": "ghcr.io/onepush-dev/postgres-ha-node:18.6@sha256:31e91770e734468e2da836067da77c2d5505425c4e96779fee07c79f69f2f585"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    },
    {
      "name": "pg-1",
      "source": {
        "image": "ghcr.io/onepush-dev/postgres-ha-node:18.6@sha256:31e91770e734468e2da836067da77c2d5505425c4e96779fee07c79f69f2f585"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "PORT",
      "service": "Postgres",
      "description": "HTTP healthcheck port (8080).",
      "secret": false,
      "strategy": "default",
      "default": "8080"
    },
    {
      "key": "PGHOST",
      "service": "Postgres",
      "description": "Router private domain (read/write and health).",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "Postgres",
      "description": "Primary (read/write) port on the router (5432).",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "Postgres",
      "description": "App user; references pg-1.PATRONI_SUPERUSER_USERNAME.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "Postgres",
      "description": "App database; references pg-1.PGDATABASE.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "Postgres",
      "description": "App password; references pg-1.PATRONI_SUPERUSER_PASSWORD.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "NODE_1_HOST",
      "service": "Postgres",
      "description": "Private domain of pg-1 for HAProxy backends.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "NODE_2_HOST",
      "service": "Postgres",
      "description": "Private domain of pg-2 for HAProxy backends.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "NODE_3_HOST",
      "service": "Postgres",
      "description": "Private domain of pg-3 for HAProxy backends.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Alias of PGDATABASE.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "DATABASE_URL",
      "service": "Postgres",
      "description": "Private URL to the primary via the router.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "Alias of PGUSER.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPORT_READONLY",
      "service": "Postgres",
      "description": "Read-only port on the router (5433).",
      "secret": false,
      "strategy": "default",
      "default": "5433"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Same as PGPASSWORD for clients that expect POSTGRES_* names.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "DATABASE_PUBLIC_URL",
      "service": "Postgres",
      "description": "Public URL via the Railway TCP proxy (sslmode=require).",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "DATABASE_URL_READONLY",
      "service": "Postgres",
      "description": "Private URL to replicas via the router (port 5433).",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PORT",
      "service": "pg-3",
      "description": "Patroni REST API port (8008).",
      "secret": false,
      "strategy": "default",
      "default": "8008"
    },
    {
      "key": "PGDATABASE",
      "service": "pg-3",
      "description": "References pg-1 default database.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGHA_NODES",
      "service": "pg-3",
      "description": "References pg-1 node list.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_SCOPE",
      "service": "pg-3",
      "description": "References pg-1 cluster scope.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PG_SHARED_BUFFERS",
      "service": "pg-3",
      "description": "References pg-1 shared_buffers.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "pg-3",
      "description": "References pg-1.PATRONI_SUPERUSER_PASSWORD.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_RESTAPI_PASSWORD",
      "service": "pg-3",
      "description": "References pg-1 REST API password.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_RESTAPI_USERNAME",
      "service": "pg-3",
      "description": "References pg-1 REST API user.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_SUPERUSER_PASSWORD",
      "service": "pg-3",
      "description": "References pg-1 so every node shares the same superuser password.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_SUPERUSER_USERNAME",
      "service": "pg-3",
      "description": "References pg-1 superuser name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_REPLICATION_PASSWORD",
      "service": "pg-3",
      "description": "References pg-1 replication password.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_REPLICATION_USERNAME",
      "service": "pg-3",
      "description": "References pg-1 replication user.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "pg-3",
      "description": "Seconds to drain before SIGKILL on redeploy (30).",
      "secret": false,
      "strategy": "default",
      "default": "30"
    },
    {
      "key": "PORT",
      "service": "pg-2",
      "description": "Patroni REST API port (8008).",
      "secret": false,
      "strategy": "default",
      "default": "8008"
    },
    {
      "key": "PGDATABASE",
      "service": "pg-2",
      "description": "References pg-1 default database.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGHA_NODES",
      "service": "pg-2",
      "description": "References pg-1 node list.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_SCOPE",
      "service": "pg-2",
      "description": "References pg-1 cluster scope.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PG_SHARED_BUFFERS",
      "service": "pg-2",
      "description": "References pg-1 shared_buffers.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "pg-2",
      "description": "References pg-1.PATRONI_SUPERUSER_PASSWORD.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_RESTAPI_PASSWORD",
      "service": "pg-2",
      "description": "References pg-1 REST API password.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_RESTAPI_USERNAME",
      "service": "pg-2",
      "description": "References pg-1 REST API user.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_SUPERUSER_PASSWORD",
      "service": "pg-2",
      "description": "References pg-1 so every node shares the same superuser password.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_SUPERUSER_USERNAME",
      "service": "pg-2",
      "description": "References pg-1 superuser name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_REPLICATION_PASSWORD",
      "service": "pg-2",
      "description": "References pg-1 replication password.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_REPLICATION_USERNAME",
      "service": "pg-2",
      "description": "References pg-1 replication user.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "pg-2",
      "description": "Seconds to drain before SIGKILL on redeploy (30).",
      "secret": false,
      "strategy": "default",
      "default": "30"
    },
    {
      "key": "PORT",
      "service": "pg-1",
      "description": "Patroni REST API port (8008).",
      "secret": false,
      "strategy": "default",
      "default": "8008"
    },
    {
      "key": "PGDATABASE",
      "service": "pg-1",
      "description": "Default database created on bootstrap (railway).",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "PGHA_NODES",
      "service": "pg-1",
      "description": "Comma-separated private domains of all three nodes; built from RAILWAY_PRIVATE_DOMAIN refs.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PATRONI_SCOPE",
      "service": "pg-1",
      "description": "Patroni cluster name shared by all nodes (pg-ha).",
      "secret": false,
      "strategy": "default",
      "default": "pg-ha"
    },
    {
      "key": "PG_SHARED_BUFFERS",
      "service": "pg-1",
      "description": "PostgreSQL shared_buffers (256MB default).",
      "secret": false,
      "strategy": "default",
      "default": "256MB"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "pg-1",
      "description": "Alias of the superuser password; references PATRONI_SUPERUSER_PASSWORD.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_RESTAPI_PASSWORD",
      "service": "pg-1",
      "description": "Password for the Patroni REST API. Generate with ${{secret(32)}} in the template editor.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "PATRONI_RESTAPI_USERNAME",
      "service": "pg-1",
      "description": "Patroni REST API user (patroni).",
      "secret": false,
      "strategy": "default",
      "default": "patroni"
    },
    {
      "key": "PATRONI_SUPERUSER_PASSWORD",
      "service": "pg-1",
      "description": "Postgres superuser password. Canonical secret for the cluster; generate with ${{secret(32)}} in the template editor.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "PATRONI_SUPERUSER_USERNAME",
      "service": "pg-1",
      "description": "Postgres superuser name (postgres).",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "PATRONI_REPLICATION_PASSWORD",
      "service": "pg-1",
      "description": "Password for the streaming replication user. Generate with ${{secret(32)}} in the template editor.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "PATRONI_REPLICATION_USERNAME",
      "service": "pg-1",
      "description": "Streaming replication user (replicator).",
      "secret": false,
      "strategy": "default",
      "default": "replicator"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "pg-1",
      "description": "Seconds to drain before SIGKILL on redeploy (30).",
      "secret": false,
      "strategy": "default",
      "default": "30"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "postgres-ha-1"
      }
    },
    "cli": "railway deploy --template postgres-ha-1",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "a617d269-1e2c-4273-a804-1a0d71f7a4ab",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "18848a54-731d-421e-b83c-fe888d8bd153": {
                  "icon": null,
                  "name": "Postgres",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "/health",
                    "restartPolicyType": "ALWAYS",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/onepush-dev/postgres-ha-router:18.6@sha256:7a01696b8161be78693b957469d63976a796c8d1e721f0c9aca48736743bce98"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "HTTP healthcheck port (8080).",
                      "defaultValue": "8080"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Router private domain (read/write and health).",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "Primary (read/write) port on the router (5432).",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "App user; references pg-1.PATRONI_SUPERUSER_USERNAME.",
                      "defaultValue": "${{pg-1.PATRONI_SUPERUSER_USERNAME}}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "App database; references pg-1.PGDATABASE.",
                      "defaultValue": "${{pg-1.PGDATABASE}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "App password; references pg-1.PATRONI_SUPERUSER_PASSWORD.",
                      "defaultValue": "${{pg-1.PATRONI_SUPERUSER_PASSWORD}}"
                    },
                    "NODE_1_HOST": {
                      "isOptional": false,
                      "description": "Private domain of pg-1 for HAProxy backends.",
                      "defaultValue": "${{pg-1.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "NODE_2_HOST": {
                      "isOptional": false,
                      "description": "Private domain of pg-2 for HAProxy backends.",
                      "defaultValue": "${{pg-2.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "NODE_3_HOST": {
                      "isOptional": false,
                      "description": "Private domain of pg-3 for HAProxy backends.",
                      "defaultValue": "${{pg-3.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Alias of PGDATABASE.",
                      "defaultValue": "${{PGDATABASE}}"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Private URL to the primary via the router.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{PGPASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Alias of PGUSER.",
                      "defaultValue": "${{PGUSER}}"
                    },
                    "PGPORT_READONLY": {
                      "isOptional": false,
                      "description": "Read-only port on the router (5433).",
                      "defaultValue": "5433"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Same as PGPASSWORD for clients that expect POSTGRES_* names.",
                      "defaultValue": "${{pg-1.PATRONI_SUPERUSER_PASSWORD}}"
                    },
                    "DATABASE_PUBLIC_URL": {
                      "isOptional": false,
                      "description": "Public URL via the Railway TCP proxy (sslmode=require).",
                      "defaultValue": "postgresql://${{PGUSER}}:${{PGPASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{PGDATABASE}}"
                    },
                    "DATABASE_URL_READONLY": {
                      "isOptional": false,
                      "description": "Private URL to replicas via the router (port 5433).",
                      "defaultValue": "postgresql://${{PGUSER}}:${{PGPASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5433/${{PGDATABASE}}"
                    }
                  },
                  "networking": {
                    "tcpProxies": {
                      "5432": {}
                    }
                  }
                },
                "44b3bb26-081c-493a-8bab-816abd25ca53": {
                  "icon": null,
                  "name": "pg-3",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "",
                    "restartPolicyType": "ALWAYS",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/onepush-dev/postgres-ha-node:18.6@sha256:31e91770e734468e2da836067da77c2d5505425c4e96779fee07c79f69f2f585"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Patroni REST API port (8008).",
                      "defaultValue": "8008"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "References pg-1 default database.",
                      "defaultValue": "${{pg-1.PGDATABASE}}"
                    },
                    "PGHA_NODES": {
                      "isOptional": false,
                      "description": "References pg-1 node list.",
                      "defaultValue": "${{pg-1.PGHA_NODES}}"
                    },
                    "PATRONI_SCOPE": {
                      "isOptional": false,
                      "description": "References pg-1 cluster scope.",
                      "defaultValue": "${{pg-1.PATRONI_SCOPE}}"
                    },
                    "PG_SHARED_BUFFERS": {
                      "isOptional": false,
                      "description": "References pg-1 shared_buffers.",
                      "defaultValue": "${{pg-1.PG_SHARED_BUFFERS}}"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "References pg-1.PATRONI_SUPERUSER_PASSWORD.",
                      "defaultValue": "${{pg-1.PATRONI_SUPERUSER_PASSWORD}}"
                    },
                    "PATRONI_RESTAPI_PASSWORD": {
                      "isOptional": false,
                      "description": "References pg-1 REST API password.",
                      "defaultValue": "${{pg-1.PATRONI_RESTAPI_PASSWORD}}"
                    },
                    "PATRONI_RESTAPI_USERNAME": {
                      "isOptional": false,
                      "description": "References pg-1 REST API user.",
                      "defaultValue": "${{pg-1.PATRONI_RESTAPI_USERNAME}}"
                    },
                    "PATRONI_SUPERUSER_PASSWORD": {
                      "isOptional": false,
                      "description": "References pg-1 so every node shares the same superuser password.",
                      "defaultValue": "${{pg-1.PATRONI_SUPERUSER_PASSWORD}}"
                    },
                    "PATRONI_SUPERUSER_USERNAME": {
                      "isOptional": false,
                      "description": "References pg-1 superuser name.",
                      "defaultValue": "${{pg-1.PATRONI_SUPERUSER_USERNAME}}"
                    },
                    "PATRONI_REPLICATION_PASSWORD": {
                      "isOptional": false,
                      "description": "References pg-1 replication password.",
                      "defaultValue": "${{pg-1.PATRONI_REPLICATION_PASSWORD}}"
                    },
                    "PATRONI_REPLICATION_USERNAME": {
                      "isOptional": false,
                      "description": "References pg-1 replication user.",
                      "defaultValue": "${{pg-1.PATRONI_REPLICATION_USERNAME}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Seconds to drain before SIGKILL on redeploy (30).",
                      "defaultValue": "30"
                    }
                  },
                  "volumeMounts": {
                    "44b3bb26-081c-493a-8bab-816abd25ca53": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                },
                "535059c7-c1a0-4189-a0b3-bad4c93c0851": {
                  "icon": null,
                  "name": "pg-2",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "",
                    "restartPolicyType": "ALWAYS",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/onepush-dev/postgres-ha-node:18.6@sha256:31e91770e734468e2da836067da77c2d5505425c4e96779fee07c79f69f2f585"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Patroni REST API port (8008).",
                      "defaultValue": "8008"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "References pg-1 default database.",
                      "defaultValue": "${{pg-1.PGDATABASE}}"
                    },
                    "PGHA_NODES": {
                      "isOptional": false,
                      "description": "References pg-1 node list.",
                      "defaultValue": "${{pg-1.PGHA_NODES}}"
                    },
                    "PATRONI_SCOPE": {
                      "isOptional": false,
                      "description": "References pg-1 cluster scope.",
                      "defaultValue": "${{pg-1.PATRONI_SCOPE}}"
                    },
                    "PG_SHARED_BUFFERS": {
                      "isOptional": false,
                      "description": "References pg-1 shared_buffers.",
                      "defaultValue": "${{pg-1.PG_SHARED_BUFFERS}}"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "References pg-1.PATRONI_SUPERUSER_PASSWORD.",
                      "defaultValue": "${{pg-1.PATRONI_SUPERUSER_PASSWORD}}"
                    },
                    "PATRONI_RESTAPI_PASSWORD": {
                      "isOptional": false,
                      "description": "References pg-1 REST API password.",
                      "defaultValue": "${{pg-1.PATRONI_RESTAPI_PASSWORD}}"
                    },
                    "PATRONI_RESTAPI_USERNAME": {
                      "isOptional": false,
                      "description": "References pg-1 REST API user.",
                      "defaultValue": "${{pg-1.PATRONI_RESTAPI_USERNAME}}"
                    },
                    "PATRONI_SUPERUSER_PASSWORD": {
                      "isOptional": false,
                      "description": "References pg-1 so every node shares the same superuser password.",
                      "defaultValue": "${{pg-1.PATRONI_SUPERUSER_PASSWORD}}"
                    },
                    "PATRONI_SUPERUSER_USERNAME": {
                      "isOptional": false,
                      "description": "References pg-1 superuser name.",
                      "defaultValue": "${{pg-1.PATRONI_SUPERUSER_USERNAME}}"
                    },
                    "PATRONI_REPLICATION_PASSWORD": {
                      "isOptional": false,
                      "description": "References pg-1 replication password.",
                      "defaultValue": "${{pg-1.PATRONI_REPLICATION_PASSWORD}}"
                    },
                    "PATRONI_REPLICATION_USERNAME": {
                      "isOptional": false,
                      "description": "References pg-1 replication user.",
                      "defaultValue": "${{pg-1.PATRONI_REPLICATION_USERNAME}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Seconds to drain before SIGKILL on redeploy (30).",
                      "defaultValue": "30"
                    }
                  },
                  "volumeMounts": {
                    "535059c7-c1a0-4189-a0b3-bad4c93c0851": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                },
                "db350aa0-3799-4b58-8b73-fac3b319ccba": {
                  "icon": null,
                  "name": "pg-1",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "",
                    "restartPolicyType": "ALWAYS",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/onepush-dev/postgres-ha-node:18.6@sha256:31e91770e734468e2da836067da77c2d5505425c4e96779fee07c79f69f2f585"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Patroni REST API port (8008).",
                      "defaultValue": "8008"
                    },
                    "PGDATABASE": {
                      "isOptional": true,
                      "description": "Default database created on bootstrap (railway).",
                      "defaultValue": "railway"
                    },
                    "PGHA_NODES": {
                      "isOptional": false,
                      "description": "Comma-separated private domains of all three nodes; built from RAILWAY_PRIVATE_DOMAIN refs.",
                      "defaultValue": "${{pg-1.RAILWAY_PRIVATE_DOMAIN}},${{pg-2.RAILWAY_PRIVATE_DOMAIN}},${{pg-3.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PATRONI_SCOPE": {
                      "isOptional": true,
                      "description": "Patroni cluster name shared by all nodes (pg-ha).",
                      "defaultValue": "pg-ha"
                    },
                    "PG_SHARED_BUFFERS": {
                      "isOptional": true,
                      "description": "PostgreSQL shared_buffers (256MB default).",
                      "defaultValue": "256MB"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Alias of the superuser password; references PATRONI_SUPERUSER_PASSWORD.",
                      "defaultValue": "${{PATRONI_SUPERUSER_PASSWORD}}"
                    },
                    "PATRONI_RESTAPI_PASSWORD": {
                      "isOptional": false,
                      "description": "Password for the Patroni REST API. Generate with ${{secret(32)}} in the template editor.",
                      "defaultValue": "{{PATRONI_RESTAPI_PASSWORD}}"
                    },
                    "PATRONI_RESTAPI_USERNAME": {
                      "isOptional": false,
                      "description": "Patroni REST API user (patroni).",
                      "defaultValue": "patroni"
                    },
                    "PATRONI_SUPERUSER_PASSWORD": {
                      "isOptional": false,
                      "description": "Postgres superuser password. Canonical secret for the cluster; generate with ${{secret(32)}} in the template editor.",
                      "defaultValue": "{{PATRONI_SUPERUSER_PASSWORD}}"
                    },
                    "PATRONI_SUPERUSER_USERNAME": {
                      "isOptional": false,
                      "description": "Postgres superuser name (postgres).",
                      "defaultValue": "postgres"
                    },
                    "PATRONI_REPLICATION_PASSWORD": {
                      "isOptional": false,
                      "description": "Password for the streaming replication user. Generate with ${{secret(32)}} in the template editor.",
                      "defaultValue": "{{PATRONI_REPLICATION_PASSWORD}}"
                    },
                    "PATRONI_REPLICATION_USERNAME": {
                      "isOptional": false,
                      "description": "Streaming replication user (replicator).",
                      "defaultValue": "replicator"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": true,
                      "description": "Seconds to drain before SIGKILL on redeploy (30).",
                      "defaultValue": "30"
                    }
                  },
                  "volumeMounts": {
                    "db350aa0-3799-4b58-8b73-fac3b319ccba": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 4,
    "needs_volume": true
  },
  "generated_at": "2026-10-27T10:14:46.328Z",
  "generator_version": "0.1.0"
}
