{
  "manifest_version": "1.0.0",
  "template": {
    "id": "0d92f4e7-c8ac-45f9-a9e2-976c6edc3701",
    "slug": "postgres-ha-patroni",
    "name": "Postgres HA | Highly Available Cluster",
    "description": "Self-host PostgreSQL HA with 0 downtime, auto failover using Patroni & etcd",
    "url": "https://railway.com/deploy/postgres-ha-patroni",
    "upstream": {
      "image": "ghcr.io/railwayapp-templates/postgres-ha/haproxy:3.2"
    }
  },
  "services": [
    {
      "name": "etcd-3",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ha/etcd:3.6.6"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/etcd",
      "http": false
    },
    {
      "name": "Haproxy",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ha/haproxy:3.2"
      },
      "needs_volume": false,
      "http": true
    },
    {
      "name": "postgres-2",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ha/postgres-patroni:17"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    },
    {
      "name": "etcd-2",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ha/etcd:3.6.6"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/etcd",
      "http": false
    },
    {
      "name": "postgres-1",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ha/postgres-patroni:17"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    },
    {
      "name": "postgres-3",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ha/postgres-patroni:17"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    },
    {
      "name": "etcd-1",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ha/etcd:3.6.6"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/etcd",
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "ETCD_NAME",
      "service": "etcd-3",
      "description": "Unique etcd node name",
      "secret": false,
      "strategy": "default",
      "default": "etcd-3"
    },
    {
      "key": "ETCD_INITIAL_CLUSTER",
      "service": "etcd-3",
      "description": "All etcd peer URLs",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "ETCD_LISTEN_PEER_URLS",
      "service": "etcd-3",
      "description": "Peer listen address",
      "secret": false,
      "strategy": "default",
      "default": "http://0.0.0.0:2380"
    },
    {
      "key": "ETCD_LISTEN_CLIENT_URLS",
      "service": "etcd-3",
      "description": "Client listen address",
      "secret": false,
      "strategy": "default",
      "default": "http://0.0.0.0:2379"
    },
    {
      "key": "ETCD_ADVERTISE_CLIENT_URLS",
      "service": "etcd-3",
      "description": "Advertised client URL",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "ETCD_INITIAL_ADVERTISE_PEER_URLS",
      "service": "etcd-3",
      "description": "This node's peer URL",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Haproxy",
      "description": "Health check database user",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "POSTGRES_NODES",
      "service": "Haproxy",
      "description": "Patroni node addresses",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "HAPROXY_MAX_CONN",
      "service": "Haproxy",
      "description": "Maximum concurrent connections",
      "secret": false,
      "strategy": "default",
      "default": "1000"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Haproxy",
      "description": "Health check database password",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "HAPROXY_CHECK_INTERVAL",
      "service": "Haproxy",
      "description": "Health check interval",
      "secret": false,
      "strategy": "default",
      "default": "3s"
    },
    {
      "key": "HAPROXY_TIMEOUT_CLIENT",
      "service": "Haproxy",
      "description": "Client idle timeout",
      "secret": false,
      "strategy": "default",
      "default": "30m"
    },
    {
      "key": "HAPROXY_TIMEOUT_SERVER",
      "service": "Haproxy",
      "description": "Server idle timeout",
      "secret": false,
      "strategy": "default",
      "default": "30m"
    },
    {
      "key": "HAPROXY_TIMEOUT_CONNECT",
      "service": "Haproxy",
      "description": "Connection timeout",
      "secret": false,
      "strategy": "default",
      "default": "10s"
    },
    {
      "key": "PGDATA",
      "service": "postgres-2",
      "description": "PG data directory (subdirectory of volume)",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PATRONI_TTL",
      "service": "postgres-2",
      "description": "Leader TTL in seconds",
      "secret": false,
      "strategy": "default",
      "default": "45"
    },
    {
      "key": "POSTGRES_DB",
      "service": "postgres-2",
      "description": "Default database name",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "PATRONI_NAME",
      "service": "postgres-2",
      "description": "Unique Patroni node name",
      "secret": false,
      "strategy": "default",
      "default": "postgres-2"
    },
    {
      "key": "PATRONI_SCOPE",
      "service": "postgres-2",
      "description": "Cluster name (must match all nodes)",
      "secret": false,
      "strategy": "default",
      "default": "railway-pg-ha"
    },
    {
      "key": "POSTGRES_USER",
      "service": "postgres-2",
      "description": "Application database user",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "PATRONI_ENABLED",
      "service": "postgres-2",
      "description": "Enable Patroni HA mode",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "PATRONI_LOOP_WAIT",
      "service": "postgres-2",
      "description": "Health check interval seconds",
      "secret": false,
      "strategy": "default",
      "default": "10"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "postgres-2",
      "description": "Shared application password",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_ETCD3_HOSTS",
      "service": "postgres-2",
      "description": "etcd endpoints",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PATRONI_RETRY_TIMEOUT",
      "service": "postgres-2",
      "description": "Retry timeout seconds",
      "secret": false,
      "strategy": "default",
      "default": "17"
    },
    {
      "key": "PATRONI_SUPERUSER_PASSWORD",
      "service": "postgres-2",
      "description": "Shared superuser password",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_SUPERUSER_USERNAME",
      "service": "postgres-2",
      "description": "PostgreSQL superuser name",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "PATRONI_POSTGRESQL_DATA_DIR",
      "service": "postgres-2",
      "description": "Patroni data directory",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PATRONI_REPLICATION_PASSWORD",
      "service": "postgres-2",
      "description": "Shared replication password",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_REPLICATION_USERNAME",
      "service": "postgres-2",
      "description": "Streaming replication user",
      "secret": false,
      "strategy": "default",
      "default": "replicator"
    },
    {
      "key": "ETCD_NAME",
      "service": "etcd-2",
      "description": "Unique etcd node name",
      "secret": false,
      "strategy": "default",
      "default": "etcd-2"
    },
    {
      "key": "ETCD_INITIAL_CLUSTER",
      "service": "etcd-2",
      "description": "All etcd peer URLs",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "ETCD_LISTEN_PEER_URLS",
      "service": "etcd-2",
      "description": "Peer listen address",
      "secret": false,
      "strategy": "default",
      "default": "http://0.0.0.0:2380"
    },
    {
      "key": "ETCD_LISTEN_CLIENT_URLS",
      "service": "etcd-2",
      "description": "Client listen address",
      "secret": false,
      "strategy": "default",
      "default": "http://0.0.0.0:2379"
    },
    {
      "key": "ETCD_ADVERTISE_CLIENT_URLS",
      "service": "etcd-2",
      "description": "Advertised client URL",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "ETCD_INITIAL_ADVERTISE_PEER_URLS",
      "service": "etcd-2",
      "description": "This node's peer URL",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGDATA",
      "service": "postgres-1",
      "description": "PG data directory (subdirectory of volume)",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PATRONI_TTL",
      "service": "postgres-1",
      "description": "Leader TTL in seconds",
      "secret": false,
      "strategy": "default",
      "default": "45"
    },
    {
      "key": "POSTGRES_DB",
      "service": "postgres-1",
      "description": "Default database name",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "PATRONI_NAME",
      "service": "postgres-1",
      "description": "Unique Patroni node name",
      "secret": false,
      "strategy": "default",
      "default": "postgres-1"
    },
    {
      "key": "PATRONI_SCOPE",
      "service": "postgres-1",
      "description": "Cluster name (must match all nodes)",
      "secret": false,
      "strategy": "default",
      "default": "railway-pg-ha"
    },
    {
      "key": "POSTGRES_USER",
      "service": "postgres-1",
      "description": "Application database user",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "PATRONI_ENABLED",
      "service": "postgres-1",
      "description": "Enable Patroni HA mode",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "PATRONI_LOOP_WAIT",
      "service": "postgres-1",
      "description": "Health check interval seconds",
      "secret": false,
      "strategy": "default",
      "default": "10"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "postgres-1",
      "description": "Application database password",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "PATRONI_ETCD3_HOSTS",
      "service": "postgres-1",
      "description": "etcd endpoints",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PATRONI_RETRY_TIMEOUT",
      "service": "postgres-1",
      "description": "Retry timeout seconds",
      "secret": false,
      "strategy": "default",
      "default": "17"
    },
    {
      "key": "PATRONI_SUPERUSER_PASSWORD",
      "service": "postgres-1",
      "description": "PostgreSQL superuser password",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "PATRONI_SUPERUSER_USERNAME",
      "service": "postgres-1",
      "description": "PostgreSQL superuser name",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "PATRONI_POSTGRESQL_DATA_DIR",
      "service": "postgres-1",
      "description": "Patroni data directory",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PATRONI_REPLICATION_PASSWORD",
      "service": "postgres-1",
      "description": "Streaming replication password",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "PATRONI_REPLICATION_USERNAME",
      "service": "postgres-1",
      "description": "Streaming replication user",
      "secret": false,
      "strategy": "default",
      "default": "replicator"
    },
    {
      "key": "PGDATA",
      "service": "postgres-3",
      "description": "PG data directory (subdirectory of volume)",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PATRONI_TTL",
      "service": "postgres-3",
      "description": "Leader TTL in seconds",
      "secret": false,
      "strategy": "default",
      "default": "45"
    },
    {
      "key": "POSTGRES_DB",
      "service": "postgres-3",
      "description": "Default database name",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "PATRONI_NAME",
      "service": "postgres-3",
      "description": "Unique Patroni node name",
      "secret": false,
      "strategy": "default",
      "default": "postgres-3"
    },
    {
      "key": "PATRONI_SCOPE",
      "service": "postgres-3",
      "description": "Cluster name (must match all nodes)",
      "secret": false,
      "strategy": "default",
      "default": "railway-pg-ha"
    },
    {
      "key": "POSTGRES_USER",
      "service": "postgres-3",
      "description": "Application database user",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "PATRONI_ENABLED",
      "service": "postgres-3",
      "description": "Enable Patroni HA mode",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "PATRONI_LOOP_WAIT",
      "service": "postgres-3",
      "description": "Health check interval seconds",
      "secret": false,
      "strategy": "default",
      "default": "10"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "postgres-3",
      "description": "Shared application password",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_ETCD3_HOSTS",
      "service": "postgres-3",
      "description": "etcd endpoints",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PATRONI_RETRY_TIMEOUT",
      "service": "postgres-3",
      "description": "Retry timeout seconds",
      "secret": false,
      "strategy": "default",
      "default": "17"
    },
    {
      "key": "PATRONI_SUPERUSER_PASSWORD",
      "service": "postgres-3",
      "description": "Shared superuser password",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_SUPERUSER_USERNAME",
      "service": "postgres-3",
      "description": "PostgreSQL superuser name",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "PATRONI_POSTGRESQL_DATA_DIR",
      "service": "postgres-3",
      "description": "Patroni data directory",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PATRONI_REPLICATION_PASSWORD",
      "service": "postgres-3",
      "description": "Shared replication password",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PATRONI_REPLICATION_USERNAME",
      "service": "postgres-3",
      "description": "Streaming replication user",
      "secret": false,
      "strategy": "default",
      "default": "replicator"
    },
    {
      "key": "ETCD_NAME",
      "service": "etcd-1",
      "description": "Unique etcd node name",
      "secret": false,
      "strategy": "default",
      "default": "etcd-1"
    },
    {
      "key": "ETCD_INITIAL_CLUSTER",
      "service": "etcd-1",
      "description": "All etcd peer URLs",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "ETCD_LISTEN_PEER_URLS",
      "service": "etcd-1",
      "description": "Peer listen address",
      "secret": false,
      "strategy": "default",
      "default": "http://0.0.0.0:2380"
    },
    {
      "key": "ETCD_LISTEN_CLIENT_URLS",
      "service": "etcd-1",
      "description": "Client listen address",
      "secret": false,
      "strategy": "default",
      "default": "http://0.0.0.0:2379"
    },
    {
      "key": "ETCD_ADVERTISE_CLIENT_URLS",
      "service": "etcd-1",
      "description": "Advertised client URL",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "ETCD_INITIAL_ADVERTISE_PEER_URLS",
      "service": "etcd-1",
      "description": "This node's peer URL",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "postgres-ha-patroni"
      }
    },
    "cli": "railway deploy --template postgres-ha-patroni",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "0d92f4e7-c8ac-45f9-a9e2-976c6edc3701",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "07ffa572-d855-4083-9b44-687d07d39e49": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/etcd.svg",
                  "name": "etcd-3",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ha/etcd:3.6.6"
                  },
                  "variables": {
                    "ETCD_NAME": {
                      "isOptional": false,
                      "description": "Unique etcd node name",
                      "defaultValue": "etcd-3"
                    },
                    "ETCD_INITIAL_CLUSTER": {
                      "isOptional": false,
                      "description": "All etcd peer URLs",
                      "defaultValue": "etcd-1=http://${{etcd-1.RAILWAY_PRIVATE_DOMAIN}}:2380,etcd-2=http://${{etcd-2.RAILWAY_PRIVATE_DOMAIN}}:2380,etcd-3=http://${{etcd-3.RAILWAY_PRIVATE_DOMAIN}}:2380"
                    },
                    "ETCD_LISTEN_PEER_URLS": {
                      "isOptional": false,
                      "description": "Peer listen address",
                      "defaultValue": "http://0.0.0.0:2380"
                    },
                    "ETCD_LISTEN_CLIENT_URLS": {
                      "isOptional": false,
                      "description": "Client listen address",
                      "defaultValue": "http://0.0.0.0:2379"
                    },
                    "ETCD_ADVERTISE_CLIENT_URLS": {
                      "isOptional": false,
                      "description": "Advertised client URL",
                      "defaultValue": "http://${{RAILWAY_PRIVATE_DOMAIN}}:2379"
                    },
                    "ETCD_INITIAL_ADVERTISE_PEER_URLS": {
                      "isOptional": false,
                      "description": "This node's peer URL",
                      "defaultValue": "http://${{RAILWAY_PRIVATE_DOMAIN}}:2380"
                    }
                  },
                  "volumeMounts": {
                    "07ffa572-d855-4083-9b44-687d07d39e49": {
                      "mountPath": "/var/lib/etcd"
                    }
                  }
                },
                "1d25cf6b-d291-4093-bd12-2bd80376d62f": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/haproxy.svg",
                  "name": "Haproxy",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ha/haproxy:3.2"
                  },
                  "variables": {
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Health check database user",
                      "defaultValue": "railway"
                    },
                    "POSTGRES_NODES": {
                      "isOptional": false,
                      "description": "Patroni node addresses",
                      "defaultValue": "${{postgres-1.RAILWAY_PRIVATE_DOMAIN}}:5432:8008,${{postgres-2.RAILWAY_PRIVATE_DOMAIN}}:5432:8008,${{postgres-3.RAILWAY_PRIVATE_DOMAIN}}:5432:8008"
                    },
                    "HAPROXY_MAX_CONN": {
                      "isOptional": false,
                      "description": "Maximum concurrent connections",
                      "defaultValue": "1000"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Health check database password",
                      "defaultValue": "${{postgres-1.POSTGRES_PASSWORD}}"
                    },
                    "HAPROXY_CHECK_INTERVAL": {
                      "isOptional": false,
                      "description": "Health check interval",
                      "defaultValue": "3s"
                    },
                    "HAPROXY_TIMEOUT_CLIENT": {
                      "isOptional": false,
                      "description": "Client idle timeout",
                      "defaultValue": "30m"
                    },
                    "HAPROXY_TIMEOUT_SERVER": {
                      "isOptional": false,
                      "description": "Server idle timeout",
                      "defaultValue": "30m"
                    },
                    "HAPROXY_TIMEOUT_CONNECT": {
                      "isOptional": false,
                      "description": "Connection timeout",
                      "defaultValue": "10s"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>": {}
                    }
                  }
                },
                "2e655ed6-b3c2-4de7-9c82-177aeb880722": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/postgres.svg",
                  "name": "postgres-2",
                  "deploy": {
                    "startCommand": "",
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ha/postgres-patroni:17"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "PG data directory (subdirectory of volume)",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PATRONI_TTL": {
                      "isOptional": false,
                      "description": "Leader TTL in seconds",
                      "defaultValue": "45"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Default database name",
                      "defaultValue": "railway"
                    },
                    "PATRONI_NAME": {
                      "isOptional": false,
                      "description": "Unique Patroni node name",
                      "defaultValue": "postgres-2"
                    },
                    "PATRONI_SCOPE": {
                      "isOptional": false,
                      "description": "Cluster name (must match all nodes)",
                      "defaultValue": "railway-pg-ha"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Application database user",
                      "defaultValue": "railway"
                    },
                    "PATRONI_ENABLED": {
                      "isOptional": false,
                      "description": "Enable Patroni HA mode",
                      "defaultValue": "true"
                    },
                    "PATRONI_LOOP_WAIT": {
                      "isOptional": false,
                      "description": "Health check interval seconds",
                      "defaultValue": "10"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Shared application password",
                      "defaultValue": "${{postgres-1.POSTGRES_PASSWORD}}"
                    },
                    "PATRONI_ETCD3_HOSTS": {
                      "isOptional": false,
                      "description": "etcd endpoints",
                      "defaultValue": "${{etcd-1.RAILWAY_PRIVATE_DOMAIN}}:2379,${{etcd-2.RAILWAY_PRIVATE_DOMAIN}}:2379,${{etcd-3.RAILWAY_PRIVATE_DOMAIN}}:2379"
                    },
                    "PATRONI_RETRY_TIMEOUT": {
                      "isOptional": false,
                      "description": "Retry timeout seconds",
                      "defaultValue": "17"
                    },
                    "PATRONI_SUPERUSER_PASSWORD": {
                      "isOptional": false,
                      "description": "Shared superuser password",
                      "defaultValue": "${{postgres-1.PATRONI_SUPERUSER_PASSWORD}}"
                    },
                    "PATRONI_SUPERUSER_USERNAME": {
                      "isOptional": false,
                      "description": "PostgreSQL superuser name",
                      "defaultValue": "postgres"
                    },
                    "PATRONI_POSTGRESQL_DATA_DIR": {
                      "isOptional": false,
                      "description": "Patroni data directory",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PATRONI_REPLICATION_PASSWORD": {
                      "isOptional": false,
                      "description": "Shared replication password",
                      "defaultValue": "${{postgres-1.PATRONI_REPLICATION_PASSWORD}}"
                    },
                    "PATRONI_REPLICATION_USERNAME": {
                      "isOptional": false,
                      "description": "Streaming replication user",
                      "defaultValue": "replicator"
                    }
                  },
                  "volumeMounts": {
                    "2e655ed6-b3c2-4de7-9c82-177aeb880722": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                },
                "7afe2aa7-71cd-41ea-9414-97786f964939": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/etcd.svg",
                  "name": "etcd-2",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ha/etcd:3.6.6"
                  },
                  "variables": {
                    "ETCD_NAME": {
                      "isOptional": false,
                      "description": "Unique etcd node name",
                      "defaultValue": "etcd-2"
                    },
                    "ETCD_INITIAL_CLUSTER": {
                      "isOptional": false,
                      "description": "All etcd peer URLs",
                      "defaultValue": "etcd-1=http://${{etcd-1.RAILWAY_PRIVATE_DOMAIN}}:2380,etcd-2=http://${{etcd-2.RAILWAY_PRIVATE_DOMAIN}}:2380,etcd-3=http://${{etcd-3.RAILWAY_PRIVATE_DOMAIN}}:2380"
                    },
                    "ETCD_LISTEN_PEER_URLS": {
                      "isOptional": false,
                      "description": "Peer listen address",
                      "defaultValue": "http://0.0.0.0:2380"
                    },
                    "ETCD_LISTEN_CLIENT_URLS": {
                      "isOptional": false,
                      "description": "Client listen address",
                      "defaultValue": "http://0.0.0.0:2379"
                    },
                    "ETCD_ADVERTISE_CLIENT_URLS": {
                      "isOptional": false,
                      "description": "Advertised client URL",
                      "defaultValue": "http://${{RAILWAY_PRIVATE_DOMAIN}}:2379"
                    },
                    "ETCD_INITIAL_ADVERTISE_PEER_URLS": {
                      "isOptional": false,
                      "description": "This node's peer URL",
                      "defaultValue": "http://${{RAILWAY_PRIVATE_DOMAIN}}:2380"
                    }
                  },
                  "volumeMounts": {
                    "7afe2aa7-71cd-41ea-9414-97786f964939": {
                      "mountPath": "/var/lib/etcd"
                    }
                  }
                },
                "9c07c074-0444-4c6d-9c70-853c6ff559a8": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/postgres.svg",
                  "name": "postgres-1",
                  "deploy": {
                    "startCommand": "",
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ha/postgres-patroni:17"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "PG data directory (subdirectory of volume)",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PATRONI_TTL": {
                      "isOptional": false,
                      "description": "Leader TTL in seconds",
                      "defaultValue": "45"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Default database name",
                      "defaultValue": "railway"
                    },
                    "PATRONI_NAME": {
                      "isOptional": false,
                      "description": "Unique Patroni node name",
                      "defaultValue": "postgres-1"
                    },
                    "PATRONI_SCOPE": {
                      "isOptional": false,
                      "description": "Cluster name (must match all nodes)",
                      "defaultValue": "railway-pg-ha"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Application database user",
                      "defaultValue": "railway"
                    },
                    "PATRONI_ENABLED": {
                      "isOptional": false,
                      "description": "Enable Patroni HA mode",
                      "defaultValue": "true"
                    },
                    "PATRONI_LOOP_WAIT": {
                      "isOptional": false,
                      "description": "Health check interval seconds",
                      "defaultValue": "10"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Application database password",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "PATRONI_ETCD3_HOSTS": {
                      "isOptional": false,
                      "description": "etcd endpoints",
                      "defaultValue": "${{etcd-1.RAILWAY_PRIVATE_DOMAIN}}:2379,${{etcd-2.RAILWAY_PRIVATE_DOMAIN}}:2379,${{etcd-3.RAILWAY_PRIVATE_DOMAIN}}:2379"
                    },
                    "PATRONI_RETRY_TIMEOUT": {
                      "isOptional": false,
                      "description": "Retry timeout seconds",
                      "defaultValue": "17"
                    },
                    "PATRONI_SUPERUSER_PASSWORD": {
                      "isOptional": false,
                      "description": "PostgreSQL superuser password",
                      "defaultValue": "{{PATRONI_SUPERUSER_PASSWORD}}"
                    },
                    "PATRONI_SUPERUSER_USERNAME": {
                      "isOptional": false,
                      "description": "PostgreSQL superuser name",
                      "defaultValue": "postgres"
                    },
                    "PATRONI_POSTGRESQL_DATA_DIR": {
                      "isOptional": false,
                      "description": "Patroni data directory",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PATRONI_REPLICATION_PASSWORD": {
                      "isOptional": false,
                      "description": "Streaming replication password",
                      "defaultValue": "{{PATRONI_REPLICATION_PASSWORD}}"
                    },
                    "PATRONI_REPLICATION_USERNAME": {
                      "isOptional": false,
                      "description": "Streaming replication user",
                      "defaultValue": "replicator"
                    }
                  },
                  "volumeMounts": {
                    "9c07c074-0444-4c6d-9c70-853c6ff559a8": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                },
                "bfab86fe-c6eb-43f8-b6bb-85795dcf6d8d": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/postgres.svg",
                  "name": "postgres-3",
                  "deploy": {
                    "startCommand": "",
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ha/postgres-patroni:17"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "PG data directory (subdirectory of volume)",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PATRONI_TTL": {
                      "isOptional": false,
                      "description": "Leader TTL in seconds",
                      "defaultValue": "45"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Default database name",
                      "defaultValue": "railway"
                    },
                    "PATRONI_NAME": {
                      "isOptional": false,
                      "description": "Unique Patroni node name",
                      "defaultValue": "postgres-3"
                    },
                    "PATRONI_SCOPE": {
                      "isOptional": false,
                      "description": "Cluster name (must match all nodes)",
                      "defaultValue": "railway-pg-ha"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Application database user",
                      "defaultValue": "railway"
                    },
                    "PATRONI_ENABLED": {
                      "isOptional": false,
                      "description": "Enable Patroni HA mode",
                      "defaultValue": "true"
                    },
                    "PATRONI_LOOP_WAIT": {
                      "isOptional": false,
                      "description": "Health check interval seconds",
                      "defaultValue": "10"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Shared application password",
                      "defaultValue": "${{postgres-1.POSTGRES_PASSWORD}}"
                    },
                    "PATRONI_ETCD3_HOSTS": {
                      "isOptional": false,
                      "description": "etcd endpoints",
                      "defaultValue": "${{etcd-1.RAILWAY_PRIVATE_DOMAIN}}:2379,${{etcd-2.RAILWAY_PRIVATE_DOMAIN}}:2379,${{etcd-3.RAILWAY_PRIVATE_DOMAIN}}:2379"
                    },
                    "PATRONI_RETRY_TIMEOUT": {
                      "isOptional": false,
                      "description": "Retry timeout seconds",
                      "defaultValue": "17"
                    },
                    "PATRONI_SUPERUSER_PASSWORD": {
                      "isOptional": false,
                      "description": "Shared superuser password",
                      "defaultValue": "${{postgres-1.PATRONI_SUPERUSER_PASSWORD}}"
                    },
                    "PATRONI_SUPERUSER_USERNAME": {
                      "isOptional": false,
                      "description": "PostgreSQL superuser name",
                      "defaultValue": "postgres"
                    },
                    "PATRONI_POSTGRESQL_DATA_DIR": {
                      "isOptional": false,
                      "description": "Patroni data directory",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PATRONI_REPLICATION_PASSWORD": {
                      "isOptional": false,
                      "description": "Shared replication password",
                      "defaultValue": "${{postgres-1.PATRONI_REPLICATION_PASSWORD}}"
                    },
                    "PATRONI_REPLICATION_USERNAME": {
                      "isOptional": false,
                      "description": "Streaming replication user",
                      "defaultValue": "replicator"
                    }
                  },
                  "volumeMounts": {
                    "bfab86fe-c6eb-43f8-b6bb-85795dcf6d8d": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                },
                "f6967045-2c8f-4bc1-bf15-6d81148a5c68": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/etcd.svg",
                  "name": "etcd-1",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ha/etcd:3.6.6"
                  },
                  "variables": {
                    "ETCD_NAME": {
                      "isOptional": false,
                      "description": "Unique etcd node name",
                      "defaultValue": "etcd-1"
                    },
                    "ETCD_INITIAL_CLUSTER": {
                      "isOptional": false,
                      "description": "All etcd peer URLs",
                      "defaultValue": "etcd-1=http://${{etcd-1.RAILWAY_PRIVATE_DOMAIN}}:2380,etcd-2=http://${{etcd-2.RAILWAY_PRIVATE_DOMAIN}}:2380,etcd-3=http://${{etcd-3.RAILWAY_PRIVATE_DOMAIN}}:2380"
                    },
                    "ETCD_LISTEN_PEER_URLS": {
                      "isOptional": false,
                      "description": "Peer listen address",
                      "defaultValue": "http://0.0.0.0:2380"
                    },
                    "ETCD_LISTEN_CLIENT_URLS": {
                      "isOptional": false,
                      "description": "Client listen address",
                      "defaultValue": "http://0.0.0.0:2379"
                    },
                    "ETCD_ADVERTISE_CLIENT_URLS": {
                      "isOptional": false,
                      "description": "Advertised client URL",
                      "defaultValue": "http://${{RAILWAY_PRIVATE_DOMAIN}}:2379"
                    },
                    "ETCD_INITIAL_ADVERTISE_PEER_URLS": {
                      "isOptional": false,
                      "description": "This node's peer URL",
                      "defaultValue": "http://${{RAILWAY_PRIVATE_DOMAIN}}:2380"
                    }
                  },
                  "volumeMounts": {
                    "f6967045-2c8f-4bc1-bf15-6d81148a5c68": {
                      "mountPath": "/var/lib/etcd"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 7,
    "needs_volume": true
  },
  "generated_at": "2026-09-12T22:14:39.841Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-11T12:42:13.279Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_a2b6592478ba4ae484b0",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 106,
    "typical_build_seconds": 0,
    "typical_start_seconds": 5,
    "slowest_service": "Haproxy"
  }
}
