{
  "manifest_version": "1.0.0",
  "template": {
    "id": "43699c1c-9bd6-41f6-b382-6e867585a9e9",
    "slug": "imessage-agent-template",
    "name": "iMessage Agent Template",
    "description": "Deploy a personal AI agent to iMessage using Photon",
    "url": "https://railway.com/deploy/imessage-agent-template",
    "upstream": {
      "repo_url": "https://github.com/photon-hq/railway-imessage-template"
    }
  },
  "services": [
    {
      "name": "railway-imessage-template",
      "source": {
        "repo": "https://github.com/photon-hq/railway-imessage-template"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/data",
      "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": "NODE_ENV",
      "service": "railway-imessage-template",
      "description": "Runs the application in production mode.",
      "secret": false,
      "strategy": "default",
      "default": "production"
    },
    {
      "key": "CODEX_HOME",
      "service": "railway-imessage-template",
      "description": "Persistent directory for Codex authentication and sessions.",
      "secret": false,
      "strategy": "default",
      "default": "/var/data/codex"
    },
    {
      "key": "DATABASE_URL",
      "service": "railway-imessage-template",
      "description": "Internal connection URL for the included PostgreSQL service.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "CODEX_AUTH_MODE",
      "service": "railway-imessage-template",
      "description": "Selects the authentication method used by Codex.",
      "secret": false,
      "strategy": "default",
      "default": "chatgpt"
    },
    {
      "key": "APP_ENCRYPTION_KEY",
      "service": "railway-imessage-template",
      "description": "Automatically generated key for encrypting stored credentials.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "AGENT_WORKSPACE_ROOT",
      "service": "railway-imessage-template",
      "description": "Persistent directory used for agent workspaces.",
      "secret": false,
      "strategy": "default",
      "default": "/var/data/workspaces"
    },
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "Directory where PostgreSQL stores persistent database files.",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "Postgres",
      "description": "Internal Railway hostname for PostgreSQL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "Postgres",
      "description": "Internal PostgreSQL connection port.",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "Postgres",
      "description": "PostgreSQL connection username.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "Postgres",
      "description": "PostgreSQL database name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "Postgres",
      "description": "Password used by PostgreSQL clients.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Database created when PostgreSQL initializes.",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "DATABASE_URL",
      "service": "Postgres",
      "description": "Complete internal PostgreSQL connection URL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "PostgreSQL administrator username.",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "SSL_CERT_DAYS",
      "service": "Postgres",
      "description": "Validity period for the generated PostgreSQL SSL certificate.",
      "secret": false,
      "strategy": "default",
      "default": "820"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Automatically generated PostgreSQL administrator password.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Grace period for connections during redeployment.",
      "secret": false,
      "strategy": "default",
      "default": "60"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "imessage-agent-template"
      }
    },
    "cli": "railway deploy --template imessage-agent-template",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "43699c1c-9bd6-41f6-b382-6e867585a9e9",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "2e684b48-5efc-4280-9e57-f3268a41b7c0": {
                  "icon": null,
                  "name": "railway-imessage-template",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "repo": "https://github.com/photon-hq/railway-imessage-template",
                    "rootDirectory": null
                  },
                  "variables": {
                    "NODE_ENV": {
                      "isOptional": false,
                      "description": "Runs the application in production mode.",
                      "defaultValue": "production"
                    },
                    "CODEX_HOME": {
                      "isOptional": false,
                      "description": "Persistent directory for Codex authentication and sessions.",
                      "defaultValue": "/var/data/codex"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Internal connection URL for the included PostgreSQL service.",
                      "defaultValue": "${{Postgres.DATABASE_URL}}"
                    },
                    "CODEX_AUTH_MODE": {
                      "isOptional": false,
                      "description": "Selects the authentication method used by Codex.",
                      "defaultValue": "chatgpt"
                    },
                    "APP_ENCRYPTION_KEY": {
                      "isOptional": false,
                      "description": "Automatically generated key for encrypting stored credentials.",
                      "defaultValue": "{{APP_ENCRYPTION_KEY}}"
                    },
                    "AGENT_WORKSPACE_ROOT": {
                      "isOptional": false,
                      "description": "Persistent directory used for agent workspaces.",
                      "defaultValue": "/var/data/workspaces"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:8080": {
                        "port": 8080
                      }
                    }
                  },
                  "volumeMounts": {
                    "2e684b48-5efc-4280-9e57-f3268a41b7c0": {
                      "mountPath": "/var/data"
                    }
                  }
                },
                "bd969537-afc0-4e24-95eb-010ee82de970": {
                  "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": "Directory where PostgreSQL stores persistent database files.",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Internal Railway hostname for PostgreSQL.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "Internal PostgreSQL connection port.",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "PostgreSQL connection username.",
                      "defaultValue": "${{POSTGRES_USER}}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "PostgreSQL database name.",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "Password used by PostgreSQL clients.",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Database created when PostgreSQL initializes.",
                      "defaultValue": "railway"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Complete internal PostgreSQL connection URL.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "PostgreSQL administrator username.",
                      "defaultValue": "postgres"
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": false,
                      "description": "Validity period for the generated PostgreSQL SSL certificate.",
                      "defaultValue": "820"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Automatically generated PostgreSQL administrator password.",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Grace period for connections during redeployment.",
                      "defaultValue": "60"
                    }
                  },
                  "volumeMounts": {
                    "bd969537-afc0-4e24-95eb-010ee82de970": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "resources": {
    "expected_services": 2,
    "needs_volume": true
  },
  "generated_at": "2026-09-20T10:14:37.339Z",
  "generator_version": "0.1.0",
  "status": "degraded",
  "validated_at": "2026-09-19T15:38:46.465Z",
  "success_rate_30d": 0.5,
  "validation": {
    "last_run_id": "run_76efc719bbfd46b7a802",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": false,
        "detail": "1 service(s) crashed within 30s"
      }
    ],
    "typical_ready_seconds": 158,
    "typical_build_seconds": 131,
    "typical_start_seconds": 10,
    "slowest_service": "railway-imessage-template"
  }
}
