{
  "manifest_version": "1.0.0",
  "template": {
    "id": "476395a8-6d20-41c9-aa4b-d525681175fc",
    "slug": "onedev-shell-runners",
    "name": "OneDev Shell Runners",
    "description": "OneDev with trusted Railway shell runners and optional autoscaling.",
    "url": "https://railway.com/deploy/onedev-shell-runners",
    "upstream": {
      "repo_url": "https://github.com/monotykamary/railway-template-onedev-shell-runners"
    }
  },
  "services": [
    {
      "name": "Postgres",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    },
    {
      "name": "Shell Runner",
      "source": {
        "repo": "https://github.com/monotykamary/railway-template-onedev-shell-runners"
      },
      "needs_volume": false,
      "http": false
    },
    {
      "name": "Runner Autoscaler",
      "source": {
        "repo": "https://github.com/monotykamary/railway-template-onedev-shell-runners"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "http": false
    },
    {
      "name": "OneDev",
      "source": {
        "repo": "https://github.com/monotykamary/railway-template-onedev-shell-runners"
      },
      "needs_volume": true,
      "volume_mount_path": "/opt/onedev",
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "PostgreSQL data directory.",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "Postgres",
      "description": "Private PostgreSQL hostname.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "Postgres",
      "description": "PostgreSQL port.",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "Postgres",
      "description": "PostgreSQL user.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "Postgres",
      "description": "PostgreSQL database.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "Postgres",
      "description": "PostgreSQL password.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Database created at initialization.",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "DATABASE_URL",
      "service": "Postgres",
      "description": "Private PostgreSQL URL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "PostgreSQL superuser.",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "SSL_CERT_DAYS",
      "service": "Postgres",
      "description": "Generated TLS certificate lifetime.",
      "secret": false,
      "strategy": "default",
      "default": "820"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Generated PostgreSQL password.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "DATABASE_PUBLIC_URL",
      "service": "Postgres",
      "description": "Public PostgreSQL URL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Graceful deployment drain period.",
      "secret": false,
      "strategy": "default",
      "default": "60"
    },
    {
      "key": "AUTOSCALER_URL",
      "service": "Shell Runner",
      "description": "Private runner-token lease endpoint.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "RUNNER_LEASE_SECRET",
      "service": "Shell Runner",
      "description": "Lease endpoint authentication reference.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PORT",
      "service": "Runner Autoscaler",
      "description": "Autoscaler HTTP port.",
      "secret": false,
      "strategy": "default",
      "default": "3000"
    },
    {
      "key": "ONEDEV_URL",
      "service": "Runner Autoscaler",
      "description": "Private OneDev API URL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "STATE_FILE",
      "service": "Runner Autoscaler",
      "description": "Persistent token-lease state file.",
      "secret": false,
      "strategy": "default",
      "default": "/data/state.json"
    },
    {
      "key": "LEASE_TTL_MS",
      "service": "Runner Autoscaler",
      "description": "Pending runner-token lease lifetime.",
      "secret": false,
      "strategy": "default",
      "default": "300000"
    },
    {
      "key": "MAX_REPLICAS",
      "service": "Runner Autoscaler",
      "description": "Maximum runner replicas.",
      "secret": false,
      "strategy": "default",
      "default": "5"
    },
    {
      "key": "MIN_REPLICAS",
      "service": "Runner Autoscaler",
      "description": "Minimum warm runner replicas; Railway requires at least one.",
      "secret": false,
      "strategy": "default",
      "default": "1"
    },
    {
      "key": "EXECUTOR_NAME",
      "service": "Runner Autoscaler",
      "description": "Automatically configured OneDev executor name.",
      "secret": false,
      "strategy": "default",
      "default": "railway-shell"
    },
    {
      "key": "ONEDEV_AGENT_URL",
      "service": "Runner Autoscaler",
      "description": "Private URL supplied to OneDev agents.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POLL_INTERVAL_MS",
      "service": "Runner Autoscaler",
      "description": "OneDev queue polling interval in milliseconds.",
      "secret": false,
      "strategy": "default",
      "default": "5000"
    },
    {
      "key": "ONEDEV_ADMIN_USER",
      "service": "Runner Autoscaler",
      "description": "OneDev administrator account used for bootstrap.",
      "secret": false,
      "strategy": "default",
      "default": "admin"
    },
    {
      "key": "RUNNER_LEASE_SECRET",
      "service": "Runner Autoscaler",
      "description": "Generated secret authenticating runner lease requests.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "SCALE_DOWN_DELAY_MS",
      "service": "Runner Autoscaler",
      "description": "Idle cooldown before returning to the minimum.",
      "secret": false,
      "strategy": "default",
      "default": "60000"
    },
    {
      "key": "ONEDEV_ADMIN_PASSWORD",
      "service": "Runner Autoscaler",
      "description": "OneDev administrator credential used only by the autoscaler.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "RAILWAY_RUNNER_SERVICE_ID",
      "service": "Runner Autoscaler",
      "description": "Dynamic Railway runner service identifier.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PORT",
      "service": "OneDev",
      "description": "Railway routing and health-check target for OneDev HTTP.",
      "secret": false,
      "strategy": "default",
      "default": "6610"
    },
    {
      "key": "initial_user",
      "service": "OneDev",
      "description": "Initial administrator username.",
      "secret": false,
      "strategy": "default",
      "default": "admin"
    },
    {
      "key": "initial_email",
      "service": "OneDev",
      "description": "Initial administrator email; change after first login.",
      "secret": false,
      "strategy": "default",
      "default": "admin@example.com"
    },
    {
      "key": "initial_password",
      "service": "OneDev",
      "description": "Generated initial administrator password.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "hibernate_dialect",
      "service": "OneDev",
      "description": "OneDev PostgreSQL dialect.",
      "secret": false,
      "strategy": "default",
      "default": "io.onedev.server.persistence.PostgreSQLDialect"
    },
    {
      "key": "initial_server_url",
      "service": "OneDev",
      "description": "Canonical public OneDev URL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "hibernate_connection_url",
      "service": "OneDev",
      "description": "Private PostgreSQL JDBC URL.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "hibernate_connection_password",
      "service": "OneDev",
      "description": "PostgreSQL password reference.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "hibernate_connection_username",
      "service": "OneDev",
      "description": "PostgreSQL user reference.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "hibernate_connection_driver_class",
      "service": "OneDev",
      "description": "PostgreSQL JDBC driver.",
      "secret": false,
      "strategy": "default",
      "default": "org.postgresql.Driver"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "onedev-shell-runners"
      }
    },
    "cli": "railway deploy --template onedev-shell-runners",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "476395a8-6d20-41c9-aa4b-d525681175fc",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "02b323dc-3692-462d-a286-a10969a74195": {
                  "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": "PostgreSQL data directory.",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Private PostgreSQL hostname.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "PostgreSQL port.",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "PostgreSQL user.",
                      "defaultValue": "${{POSTGRES_USER}}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "PostgreSQL database.",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "PostgreSQL password.",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Database created at initialization.",
                      "defaultValue": "railway"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Private PostgreSQL URL.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "PostgreSQL superuser.",
                      "defaultValue": "postgres"
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": false,
                      "description": "Generated TLS certificate lifetime.",
                      "defaultValue": "820"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Generated PostgreSQL password.",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "DATABASE_PUBLIC_URL": {
                      "isOptional": false,
                      "description": "Public PostgreSQL URL.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{PGDATABASE}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Graceful deployment drain period.",
                      "defaultValue": "60"
                    }
                  },
                  "volumeMounts": {
                    "02b323dc-3692-462d-a286-a10969a74195": {
                      "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."
                  }
                },
                "449453d5-52c9-4270-b634-21438c7d422a": {
                  "icon": "https://raw.githubusercontent.com/monotykamary/railway-template-onedev-shell-runners/main/assets/onedev.png",
                  "name": "Shell Runner",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 3
                  },
                  "source": {
                    "repo": "https://github.com/monotykamary/railway-template-onedev-shell-runners",
                    "commitSha": "5b50f0c42b7fd970cf1cbd6b1b5abecee9c9cdfa",
                    "rootDirectory": "/runner"
                  },
                  "variables": {
                    "AUTOSCALER_URL": {
                      "isOptional": false,
                      "description": "Private runner-token lease endpoint.",
                      "defaultValue": "http://${{Runner Autoscaler.RAILWAY_PRIVATE_DOMAIN}}:3000"
                    },
                    "RUNNER_LEASE_SECRET": {
                      "isOptional": false,
                      "description": "Lease endpoint authentication reference.",
                      "defaultValue": "${{Runner Autoscaler.RUNNER_LEASE_SECRET}}"
                    }
                  }
                },
                "d782a04f-e0a1-44d6-b21c-bf6157c35c33": {
                  "icon": "https://raw.githubusercontent.com/monotykamary/railway-template-onedev-shell-runners/main/assets/onedev.png",
                  "name": "Runner Autoscaler",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "/health",
                    "restartPolicyType": "ON_FAILURE",
                    "healthcheckTimeout": 300,
                    "restartPolicyMaxRetries": 3
                  },
                  "source": {
                    "repo": "https://github.com/monotykamary/railway-template-onedev-shell-runners",
                    "commitSha": "5b50f0c42b7fd970cf1cbd6b1b5abecee9c9cdfa",
                    "rootDirectory": "/autoscaler"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Autoscaler HTTP port.",
                      "defaultValue": "3000"
                    },
                    "ONEDEV_URL": {
                      "isOptional": false,
                      "description": "Private OneDev API URL.",
                      "defaultValue": "http://${{OneDev.RAILWAY_PRIVATE_DOMAIN}}:6610"
                    },
                    "STATE_FILE": {
                      "isOptional": false,
                      "description": "Persistent token-lease state file.",
                      "defaultValue": "/data/state.json"
                    },
                    "LEASE_TTL_MS": {
                      "isOptional": false,
                      "description": "Pending runner-token lease lifetime.",
                      "defaultValue": "300000"
                    },
                    "MAX_REPLICAS": {
                      "isOptional": false,
                      "description": "Maximum runner replicas.",
                      "defaultValue": "5"
                    },
                    "MIN_REPLICAS": {
                      "isOptional": false,
                      "description": "Minimum warm runner replicas; Railway requires at least one.",
                      "defaultValue": "1"
                    },
                    "EXECUTOR_NAME": {
                      "isOptional": false,
                      "description": "Automatically configured OneDev executor name.",
                      "defaultValue": "railway-shell"
                    },
                    "RAILWAY_TOKEN": {
                      "isOptional": true,
                      "description": "Optional environment-scoped Railway project token enabling replica autoscaling."
                    },
                    "ONEDEV_AGENT_URL": {
                      "isOptional": false,
                      "description": "Private URL supplied to OneDev agents.",
                      "defaultValue": "http://${{OneDev.RAILWAY_PRIVATE_DOMAIN}}:6610"
                    },
                    "POLL_INTERVAL_MS": {
                      "isOptional": false,
                      "description": "OneDev queue polling interval in milliseconds.",
                      "defaultValue": "5000"
                    },
                    "ONEDEV_ADMIN_USER": {
                      "isOptional": false,
                      "description": "OneDev administrator account used for bootstrap.",
                      "defaultValue": "admin"
                    },
                    "RUNNER_LEASE_SECRET": {
                      "isOptional": false,
                      "description": "Generated secret authenticating runner lease requests.",
                      "defaultValue": "{{RUNNER_LEASE_SECRET}}"
                    },
                    "SCALE_DOWN_DELAY_MS": {
                      "isOptional": false,
                      "description": "Idle cooldown before returning to the minimum.",
                      "defaultValue": "60000"
                    },
                    "ONEDEV_ADMIN_PASSWORD": {
                      "isOptional": false,
                      "description": "OneDev administrator credential used only by the autoscaler.",
                      "defaultValue": "${{OneDev.initial_password}}"
                    },
                    "RAILWAY_RUNNER_SERVICE_ID": {
                      "isOptional": false,
                      "description": "Dynamic Railway runner service identifier.",
                      "defaultValue": "${{Shell Runner.RAILWAY_SERVICE_ID}}"
                    }
                  },
                  "volumeMounts": {
                    "d782a04f-e0a1-44d6-b21c-bf6157c35c33": {
                      "mountPath": "/data"
                    }
                  }
                },
                "db201897-0e7d-4694-b693-255996370e73": {
                  "icon": "https://raw.githubusercontent.com/monotykamary/railway-template-onedev-shell-runners/main/assets/onedev.png",
                  "name": "OneDev",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "/",
                    "restartPolicyType": "ON_FAILURE",
                    "healthcheckTimeout": 600,
                    "restartPolicyMaxRetries": 3
                  },
                  "source": {
                    "repo": "https://github.com/monotykamary/railway-template-onedev-shell-runners",
                    "commitSha": "5b50f0c42b7fd970cf1cbd6b1b5abecee9c9cdfa",
                    "rootDirectory": null
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Railway routing and health-check target for OneDev HTTP.",
                      "defaultValue": "6610"
                    },
                    "initial_user": {
                      "isOptional": false,
                      "description": "Initial administrator username.",
                      "defaultValue": "admin"
                    },
                    "initial_email": {
                      "isOptional": false,
                      "description": "Initial administrator email; change after first login.",
                      "defaultValue": "admin@example.com"
                    },
                    "initial_password": {
                      "isOptional": false,
                      "description": "Generated initial administrator password.",
                      "defaultValue": "{{initial_password}}"
                    },
                    "hibernate_dialect": {
                      "isOptional": false,
                      "description": "OneDev PostgreSQL dialect.",
                      "defaultValue": "io.onedev.server.persistence.PostgreSQLDialect"
                    },
                    "initial_server_url": {
                      "isOptional": false,
                      "description": "Canonical public OneDev URL.",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "hibernate_connection_url": {
                      "isOptional": false,
                      "description": "Private PostgreSQL JDBC URL.",
                      "defaultValue": "jdbc:postgresql://${{Postgres.PGHOST}}:${{Postgres.PGPORT}}/${{Postgres.PGDATABASE}}"
                    },
                    "hibernate_connection_password": {
                      "isOptional": false,
                      "description": "PostgreSQL password reference.",
                      "defaultValue": "${{Postgres.PGPASSWORD}}"
                    },
                    "hibernate_connection_username": {
                      "isOptional": false,
                      "description": "PostgreSQL user reference.",
                      "defaultValue": "${{Postgres.PGUSER}}"
                    },
                    "hibernate_connection_driver_class": {
                      "isOptional": false,
                      "description": "PostgreSQL JDBC driver.",
                      "defaultValue": "org.postgresql.Driver"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:6610": {
                        "port": 6610
                      }
                    }
                  },
                  "volumeMounts": {
                    "db201897-0e7d-4694-b693-255996370e73": {
                      "mountPath": "/opt/onedev"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "OneDev",
      "method": "GET",
      "path": "/",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 4,
    "needs_volume": true
  },
  "generated_at": "2026-09-10T22:14:43.398Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-08T23:35:06.794Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_c966a61ac1b745539106",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "healthcheck",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 235,
    "typical_build_seconds": 192,
    "typical_start_seconds": 20,
    "slowest_service": "Shell Runner"
  }
}
