{
  "manifest_version": "1.0.0",
  "template": {
    "id": "6ab7bfa5-49cc-4ca7-b91a-ec83fca143e8",
    "slug": "agent-control-dev",
    "name": "Agent Control Dev",
    "description": "Deploy Agent Control server - guardrails, API, and UI",
    "url": "https://railway.com/deploy/agent-control-dev",
    "upstream": {
      "image": "galileoai/agent-control-server:latest"
    }
  },
  "services": [
    {
      "name": "server",
      "source": {
        "image": "galileoai/agent-control-server:latest"
      },
      "needs_volume": false,
      "http": true
    },
    {
      "name": "postgres",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "AGENT_CONTROL_HOST",
      "service": "server",
      "description": "0.0.0.0\", \"Server bind address.",
      "secret": false,
      "strategy": "default",
      "default": "0.0.0.0"
    },
    {
      "key": "AGENT_CONTROL_PORT",
      "service": "server",
      "description": "Server listen port. Uses Railway-assigned PORT for external routing.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "AGENT_CONTROL_DB_URL",
      "service": "server",
      "description": "PostgreSQL connection URL with psycopg driver. References the managed postgres service.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "AGENT_CONTROL_API_KEYS",
      "service": "server",
      "description": "Auto-generated API key for runtime and read access. Save this value for SDK and API clients.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "AGENT_CONTROL_CORS_ORIGINS",
      "service": "server",
      "description": "Allowed CORS origins for the bundled dashboard served from the server public domain.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "AGENT_CONTROL_ADMIN_API_KEYS",
      "service": "server",
      "description": "Auto-generated admin API key for control-plane mutations and UI login. Save this value.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "AGENT_CONTROL_SESSION_SECRET",
      "service": "server",
      "description": "Secret for session encryption. Auto-generated; do not change after first deploy.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "AGENT_CONTROL_API_KEY_ENABLED",
      "service": "server",
      "description": "Enable API key authentication. Should remain enabled in production.",
      "secret": true,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "PGDATA",
      "service": "postgres",
      "description": "Filesystem path where PostgreSQL stores its data files.",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "postgres",
      "description": "PostgreSQL server hostname on the private network.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "postgres",
      "description": "PostgreSQL server port.",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "postgres",
      "description": "PostgreSQL username used in connection strings.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "postgres",
      "description": "PostgreSQL database name used in connection strings.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "postgres",
      "description": "PostgreSQL password used in connection strings.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "postgres",
      "description": "Default database name created on initialization.",
      "secret": false,
      "strategy": "default",
      "default": "agent_control"
    },
    {
      "key": "DATABASE_URL",
      "service": "postgres",
      "description": "Internal PostgreSQL connection URL for service-to-service communication.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "postgres",
      "description": "PostgreSQL username.",
      "secret": false,
      "strategy": "default",
      "default": "agent_control"
    },
    {
      "key": "SSL_CERT_DAYS",
      "service": "postgres",
      "description": "Number of days until the auto-generated SSL certificate expires.",
      "secret": false,
      "strategy": "default",
      "default": "820"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "postgres",
      "description": "Auto-generated PostgreSQL password.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "postgres",
      "description": "Seconds to wait before stopping the previous deployment during a rollout.",
      "secret": false,
      "strategy": "default",
      "default": "60"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "agent-control-dev"
      }
    },
    "cli": "railway deploy --template agent-control-dev",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "6ab7bfa5-49cc-4ca7-b91a-ec83fca143e8",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "6fa5b1d2-d165-4b6d-bbab-2a6981d1b96d": {
                  "icon": "https://agentcontrol.dev/assets/agent-control-wordmark-white-CW5q1ZRx.svg",
                  "name": "server",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "/health",
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "galileoai/agent-control-server:latest"
                  },
                  "variables": {
                    "GALILEO_API_KEY": {
                      "isOptional": true,
                      "description": "Optional Galileo API key for the Luna-2 AI evaluator.",
                      "defaultValue": ""
                    },
                    "AGENT_CONTROL_HOST": {
                      "isOptional": true,
                      "description": "0.0.0.0\", \"Server bind address.",
                      "defaultValue": "0.0.0.0"
                    },
                    "AGENT_CONTROL_PORT": {
                      "isOptional": false,
                      "description": "Server listen port. Uses Railway-assigned PORT for external routing.",
                      "defaultValue": "${{PORT}}"
                    },
                    "AGENT_CONTROL_DB_URL": {
                      "isOptional": false,
                      "description": "PostgreSQL connection URL with psycopg driver. References the managed postgres service.",
                      "defaultValue": "postgresql+psycopg://${{postgres.PGUSER}}:${{postgres.POSTGRES_PASSWORD}}@${{postgres.RAILWAY_PRIVATE_DOMAIN}}:5432/${{postgres.PGDATABASE}}"
                    },
                    "AGENT_CONTROL_API_KEYS": {
                      "isOptional": false,
                      "description": "Auto-generated API key for runtime and read access. Save this value for SDK and API clients.",
                      "defaultValue": "{{AGENT_CONTROL_API_KEYS}}"
                    },
                    "AGENT_CONTROL_CORS_ORIGINS": {
                      "isOptional": false,
                      "description": "Allowed CORS origins for the bundled dashboard served from the server public domain.",
                      "defaultValue": "https://${{server.RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "AGENT_CONTROL_ADMIN_API_KEYS": {
                      "isOptional": false,
                      "description": "Auto-generated admin API key for control-plane mutations and UI login. Save this value.",
                      "defaultValue": "{{AGENT_CONTROL_ADMIN_API_KEYS}}"
                    },
                    "AGENT_CONTROL_SESSION_SECRET": {
                      "isOptional": false,
                      "description": "Secret for session encryption. Auto-generated; do not change after first deploy.",
                      "defaultValue": "{{AGENT_CONTROL_SESSION_SECRET}}"
                    },
                    "AGENT_CONTROL_API_KEY_ENABLED": {
                      "isOptional": true,
                      "description": "Enable API key authentication. Should remain enabled in production.",
                      "defaultValue": "true"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>": {}
                    }
                  }
                },
                "e0a04293-6cfe-4ee6-a796-6d8f5bd72089": {
                  "icon": "https://devicons.railway.app/i/postgresql.svg",
                  "name": "postgres",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "Filesystem path where PostgreSQL stores its data files.",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "PostgreSQL server hostname on the private network.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "PostgreSQL server port.",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "PostgreSQL username used in connection strings.",
                      "defaultValue": "${{POSTGRES_USER}}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "PostgreSQL database name used in connection strings.",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "PostgreSQL password used in connection strings.",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Default database name created on initialization.",
                      "defaultValue": "agent_control"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Internal PostgreSQL connection URL for service-to-service communication.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "PostgreSQL username.",
                      "defaultValue": "agent_control"
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": false,
                      "description": "Number of days until the auto-generated SSL certificate expires.",
                      "defaultValue": "820"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Auto-generated PostgreSQL password.",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Seconds to wait before stopping the previous deployment during a rollout.",
                      "defaultValue": "60"
                    }
                  },
                  "volumeMounts": {
                    "e0a04293-6cfe-4ee6-a796-6d8f5bd72089": {
                      "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": {
    "healthcheck": {
      "service": "server",
      "method": "GET",
      "path": "/health",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 2,
    "needs_volume": true
  },
  "generated_at": "2026-09-10T16:14:52.212Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-05T05:59:27.959Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_b350553b09c14b928b34",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "healthcheck",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 132,
    "typical_build_seconds": 0,
    "typical_start_seconds": 10,
    "slowest_service": "server"
  }
}
