{
  "manifest_version": "1.0.0",
  "template": {
    "id": "8f265e09-d5bf-4aea-b1fc-192bfb730de5",
    "slug": "2JIsM0",
    "name": "ZeroSync + Postgres",
    "description": "Rocicorp's ZeroSync engine for local-first apps",
    "url": "https://railway.com/deploy/2JIsM0",
    "upstream": {
      "image": "rocicorp/zero:0.15.2025021402"
    }
  },
  "services": [
    {
      "name": "ZeroSync",
      "source": {
        "image": "rocicorp/zero:0.15.2025021402"
      },
      "needs_volume": true,
      "volume_mount_path": "/zero-data",
      "http": true
    },
    {
      "name": "Postgres",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ssl:16"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "tcp_ports": [
        5432
      ],
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "ZERO_PORT",
      "service": "ZeroSync",
      "description": "The main port for client connections.",
      "secret": false,
      "strategy": "default",
      "default": "4848"
    },
    {
      "key": "ZERO_CVR_DB",
      "service": "ZeroSync",
      "description": "A separate Postgres database used to store CVRs.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PG_DATABSE_URL",
      "service": "ZeroSync",
      "description": "Postgres connection URL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "ZERO_CHANGE_DB",
      "service": "ZeroSync",
      "description": "Another Postgres database used to store a replication log.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "ZERO_LOG_LEVEL",
      "service": "ZeroSync",
      "description": "Sets the logging level for the application.",
      "secret": false,
      "strategy": "default",
      "default": "info"
    },
    {
      "key": "ZERO_LOG_FORMAT",
      "service": "ZeroSync",
      "description": "Sets the log output format.",
      "secret": false,
      "strategy": "default",
      "default": "text"
    },
    {
      "key": "ZERO_PUBLIC_URL",
      "service": "ZeroSync",
      "description": "URL to be used with the Zero client.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "ZERO_UPSTREAM_DB",
      "service": "ZeroSync",
      "description": "The \"upstream\" authoritative Postgres database.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "ZERO_REPLICA_FILE",
      "service": "ZeroSync",
      "description": "File path to the SQLite replica that zero-cache maintains.",
      "secret": false,
      "strategy": "default",
      "default": "/zero-data/zstart_replica.db"
    },
    {
      "key": "ZERO_CVR_MAX_CONNS",
      "service": "ZeroSync",
      "description": "The maximum number of connections to open to the CVR database.",
      "secret": false,
      "strategy": "default",
      "default": "30"
    },
    {
      "key": "ZERO_CHANGE_MAX_CONNS",
      "service": "ZeroSync",
      "description": "The maximum number of connections to open to the change database.",
      "secret": false,
      "strategy": "default",
      "default": "1"
    },
    {
      "key": "ZERO_NUM_SYNC_WORKERS",
      "service": "ZeroSync",
      "description": "The number of processes to use for view syncing.",
      "secret": false,
      "strategy": "default",
      "default": "20"
    },
    {
      "key": "ZERO_UPSTREAM_MAX_CONNS",
      "service": "ZeroSync",
      "description": "The maximum number of connections to open to the upstream database for committing mutations.",
      "secret": false,
      "strategy": "default",
      "default": "20"
    },
    {
      "key": "ZERO_CHANGE_STREAMER_PORT",
      "service": "ZeroSync",
      "description": "The port on which the change-streamer runs.",
      "secret": false,
      "strategy": "default",
      "default": "4849"
    },
    {
      "key": "ZERO_HEARTBEAT_MONITOR_PORT",
      "service": "ZeroSync",
      "description": "The port on which the heartbeat monitor listens for health checks.",
      "secret": false,
      "strategy": "default",
      "default": "4850"
    },
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "Location where the database will be initialized",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "Postgres",
      "description": "Railway Private Domain Name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "Postgres",
      "description": "Port to connect to Postgres.",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "Postgres",
      "description": "Required variable for Data panel",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "Postgres",
      "description": "Required variable for the data panel.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "Postgres",
      "description": "Required variable for Data panel",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Default database created when image is started.",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "DATABASE_URL",
      "service": "Postgres",
      "description": "URL to connect to Postgres database.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "User to connect to Postgres DB",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "SSL_CERT_DAYS",
      "service": "Postgres",
      "description": "SSL certificate expiry in days.",
      "secret": false,
      "strategy": "default",
      "default": "820"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Password to connect to DB",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "DATABASE_PUBLIC_URL",
      "service": "Postgres",
      "description": "Public URL to connect to Postgres database, used by the Data panel.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "2JIsM0"
      }
    },
    "cli": "railway deploy --template 2JIsM0",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "8f265e09-d5bf-4aea-b1fc-192bfb730de5",
            "serializedConfig": {
              "services": {
                "0139cd69-db7e-4520-bd22-f63ca89644ac": {
                  "icon": "https://iili.io/2pbxEhu.png",
                  "name": "ZeroSync",
                  "source": {
                    "image": "rocicorp/zero:0.15.2025021402"
                  },
                  "variables": {
                    "ZERO_PORT": {
                      "isOptional": false,
                      "description": "The main port for client connections.",
                      "defaultValue": "4848"
                    },
                    "ZERO_CVR_DB": {
                      "isOptional": false,
                      "description": "A separate Postgres database used to store CVRs.",
                      "defaultValue": "${{ZeroSync.PG_DATABSE_URL}}_cvr"
                    },
                    "ZERO_AUTH_JWK": {
                      "isOptional": true,
                      "description": "A public key in JWK format used to verify JWTs. Only one of ZERO_AUTH_JWK, ZERO_AUTH_JWKS_URL and ZERO_AUTH_SECRET may be set.",
                      "defaultValue": ""
                    },
                    "PG_DATABSE_URL": {
                      "isOptional": false,
                      "description": "Postgres connection URL.",
                      "defaultValue": "${{Postgres.DATABASE_URL}}"
                    },
                    "ZERO_CHANGE_DB": {
                      "isOptional": false,
                      "description": "Another Postgres database used to store a replication log.",
                      "defaultValue": "${{ZeroSync.PG_DATABSE_URL}}_cdb"
                    },
                    "ZERO_LOG_LEVEL": {
                      "isOptional": true,
                      "description": "Sets the logging level for the application.",
                      "defaultValue": "info"
                    },
                    "ZERO_LOG_FORMAT": {
                      "isOptional": true,
                      "description": "Sets the log output format.",
                      "defaultValue": "text"
                    },
                    "ZERO_PUBLIC_URL": {
                      "description": "URL to be used with the Zero client.",
                      "defaultValue": "${{RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "ZERO_AUTH_SECRET": {
                      "isOptional": true,
                      "description": "A symmetric key used to verify JWTs. Only one of ZERO_AUTH_JWK, ZERO_AUTH_JWKS_URL and ZERO_AUTH_SECRET may be set.",
                      "defaultValue": ""
                    },
                    "ZERO_UPSTREAM_DB": {
                      "isOptional": false,
                      "description": "The \"upstream\" authoritative Postgres database.",
                      "defaultValue": "${{ZeroSync.PG_DATABSE_URL}}"
                    },
                    "ZERO_REPLICA_FILE": {
                      "isOptional": false,
                      "description": "File path to the SQLite replica that zero-cache maintains.",
                      "defaultValue": "/zero-data/zstart_replica.db"
                    },
                    "ZERO_AUTH_JWKS_URL": {
                      "isOptional": true,
                      "description": "A URL that returns a JWK set used to verify JWTs. Only one of ZERO_AUTH_JWK, ZERO_AUTH_JWKS_URL and ZERO_AUTH_SECRET may be set.",
                      "defaultValue": ""
                    },
                    "ZERO_CVR_MAX_CONNS": {
                      "isOptional": true,
                      "description": "The maximum number of connections to open to the CVR database.",
                      "defaultValue": "30"
                    },
                    "ZERO_CHANGE_MAX_CONNS": {
                      "isOptional": true,
                      "description": "The maximum number of connections to open to the change database.",
                      "defaultValue": "1"
                    },
                    "ZERO_NUM_SYNC_WORKERS": {
                      "isOptional": false,
                      "description": "The number of processes to use for view syncing.",
                      "defaultValue": "20"
                    },
                    "ZERO_UPSTREAM_MAX_CONNS": {
                      "isOptional": true,
                      "description": "The maximum number of connections to open to the upstream database for committing mutations.",
                      "defaultValue": "20"
                    },
                    "ZERO_LOG_TRACE_COLLECTOR": {
                      "isOptional": true,
                      "description": "The URL of the trace collector to which to send trace data. Traces are sent over HTTP.",
                      "defaultValue": ""
                    },
                    "ZERO_CHANGE_STREAMER_PORT": {
                      "isOptional": false,
                      "description": "The port on which the change-streamer runs.",
                      "defaultValue": "4849"
                    },
                    "ZERO_HEARTBEAT_MONITOR_PORT": {
                      "isOptional": false,
                      "description": "The port on which the heartbeat monitor listens for health checks.",
                      "defaultValue": "4850"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>": {}
                    }
                  },
                  "volumeMounts": {
                    "0139cd69-db7e-4520-bd22-f63ca89644ac": {
                      "mountPath": "/zero-data"
                    }
                  }
                },
                "277f5f5b-66c3-4454-b897-57779df56c84": {
                  "icon": "https://devicons.railway.app/i/postgresql.svg",
                  "name": "Postgres",
                  "build": {},
                  "deploy": {
                    "startCommand": "bash -c '   docker-entrypoint.sh postgres    -c wal_level=logical   -c max_wal_senders=10    -c max_replication_slots=5    -c hot_standby=on    -c hot_standby_feedback=on '"
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ssl:16"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "Location where the database will be initialized",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Railway Private Domain Name.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "Port to connect to Postgres.",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "Required variable for Data panel",
                      "defaultValue": "${{ POSTGRES_USER }}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "Required variable for the data panel.",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "Required variable for Data panel",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Default database created when image is started.",
                      "defaultValue": "railway"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "URL to connect to Postgres database.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "User to connect to Postgres DB",
                      "defaultValue": "postgres"
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": true,
                      "description": "SSL certificate expiry in days.",
                      "defaultValue": "820"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Password to connect to DB",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "DATABASE_PUBLIC_URL": {
                      "description": "Public URL to connect to Postgres database, used by the Data panel.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{PGDATABASE}}"
                    }
                  },
                  "networking": {
                    "tcpProxies": {
                      "5432": {}
                    },
                    "serviceDomains": {}
                  },
                  "volumeMounts": {
                    "277f5f5b-66c3-4454-b897-57779df56c84": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  },
                  "haTemplateCode": "postgres-ha",
                  "haConversionConfig": {
                    "edge": {
                      "label": "Reverse Proxy",
                      "options": [
                        2,
                        3,
                        4,
                        5
                      ],
                      "nodeLabel": "HAProxy",
                      "description": "Routes traffic to the primary",
                      "defaultValue": 3
                    },
                    "replica": {
                      "label": "Replicas",
                      "options": [
                        2,
                        3,
                        4,
                        5,
                        6,
                        7
                      ],
                      "nodeLabel": "Postgres",
                      "description": "Streaming replicas for automatic failover",
                      "defaultValue": 2
                    },
                    "internal": {
                      "label": "Coordinator Nodes",
                      "options": [
                        3,
                        5,
                        7,
                        9
                      ],
                      "nodeLabel": "etcd",
                      "defaultValue": 3
                    },
                    "description": "This will convert your Postgres database to an HA cluster with Patroni failover and etcd consensus."
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 2,
    "needs_volume": true
  },
  "generated_at": "2026-09-21T16:15:12.787Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-21T09:23:45.551Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_fdf5ecf5376245b7a5fd",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 124,
    "typical_build_seconds": 0,
    "typical_start_seconds": 10,
    "slowest_service": "ZeroSync"
  }
}
