{
  "manifest_version": "1.0.0",
  "template": {
    "id": "ce5a38f6-628c-4e00-80b3-9bc3e4635d61",
    "slug": "keycloak-1",
    "name": "Keycloak",
    "description": "Keycloak — enterprise identity and access management with SSO and SAML",
    "url": "https://railway.com/deploy/keycloak-1",
    "upstream": {
      "repo_url": "https://github.com/INAPP-Mobile/keycloak"
    }
  },
  "services": [
    {
      "name": "postgres",
      "source": {
        "image": "postgres:16-alpine"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql",
      "http": false
    },
    {
      "name": "keycloak",
      "source": {
        "repo": "https://github.com/INAPP-Mobile/keycloak"
      },
      "needs_volume": false,
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "PGDATA",
      "service": "postgres",
      "description": "PostgreSQL data directory. Must match the volume mount path configured in the postgres service settings (parent mount at /var/lib/postgresql).",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data"
    },
    {
      "key": "POSTGRES_DB",
      "service": "postgres",
      "description": "Default database Keycloak connects to on first run.",
      "secret": false,
      "strategy": "default",
      "default": "keycloak"
    },
    {
      "key": "POSTGRES_USER",
      "service": "postgres",
      "description": "PostgreSQL superuser name. Must match KC_DB_USERNAME on the Keycloak service.",
      "secret": false,
      "strategy": "default",
      "default": "keycloak"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "postgres",
      "description": "PostgreSQL superuser password. Must match KC_DB_PASSWORD on the Keycloak service. Change both at once if updating.",
      "secret": true,
      "strategy": "default",
      "default": "keycloak_pw_2026"
    },
    {
      "key": "KC_PROXY",
      "service": "keycloak",
      "description": "Proxy mode: edge (Railway terminates TLS), passthrough, or reencrypt.",
      "secret": false,
      "strategy": "default",
      "default": "edge"
    },
    {
      "key": "KC_DB_URL",
      "service": "keycloak",
      "description": "PostgreSQL JDBC URL. Points at the sibling postgres service on the Railway private network. Username and password are read separately from KC_DB_USERNAME and KC_DB_PASSWORD env vars (do NOT embed them in the URL).",
      "secret": false,
      "strategy": "default",
      "default": "jdbc:postgresql://postgres.railway.internal:5432/keycloak"
    },
    {
      "key": "KC_HOSTNAME",
      "service": "keycloak",
      "description": "Public URL Keycloak generates links with (Keycloak 26.x: KC_HOSTNAME). Defaults to https://<railway-domain>. Railway terminates TLS, so always include the https:// prefix.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "KC_LOG_LEVEL",
      "service": "keycloak",
      "description": "Log level: info, debug, trace, warn, error, or fatal.",
      "secret": false,
      "strategy": "default",
      "default": "info"
    },
    {
      "key": "KC_DB_PASSWORD",
      "service": "keycloak",
      "description": "PostgreSQL password. Must match POSTGRES_PASSWORD on the sibling postgres service. Change both at once if updating.",
      "secret": true,
      "strategy": "default",
      "default": "keycloak_pw_2026"
    },
    {
      "key": "KC_DB_USERNAME",
      "service": "keycloak",
      "description": "PostgreSQL username. Must match POSTGRES_USER on the sibling postgres service.",
      "secret": false,
      "strategy": "default",
      "default": "keycloak"
    },
    {
      "key": "KC_HTTP_ENABLED",
      "service": "keycloak",
      "description": "Enable plain HTTP listener. Required when KC_PROXY=edge so Keycloak can serve HTTP and rely on Railway for TLS termination.",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "KC_PROXY_HEADERS",
      "service": "keycloak",
      "description": "Proxy headers handling (Keycloak 26.x: KC_PROXY_HEADERS). Set to 'xforwarded' when behind a reverse proxy like Railway so Keycloak honors X-Forwarded-* headers (host, proto, port).",
      "secret": false,
      "strategy": "default",
      "default": "xforwarded"
    },
    {
      "key": "KC_BOOTSTRAP_ADMIN_PASSWORD",
      "service": "keycloak",
      "description": "Initial admin password (Keycloak 26.x: KC_BOOTSTRAP_ADMIN_PASSWORD). Auto-generated on first deploy. After the admin user is created, changing this has no effect — use the Admin UI to rotate.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "keycloak-1"
      }
    },
    "cli": "railway deploy --template keycloak-1",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "ce5a38f6-628c-4e00-80b3-9bc3e4635d61",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "abe7b8d5-bd05-4ac4-bb03-bcf615e31b65": {
                  "icon": null,
                  "name": "postgres",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "postgres:16-alpine"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "PostgreSQL data directory. Must match the volume mount path configured in the postgres service settings (parent mount at /var/lib/postgresql).",
                      "defaultValue": "/var/lib/postgresql/data"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Default database Keycloak connects to on first run.",
                      "defaultValue": "keycloak"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "PostgreSQL superuser name. Must match KC_DB_USERNAME on the Keycloak service.",
                      "defaultValue": "keycloak"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "PostgreSQL superuser password. Must match KC_DB_PASSWORD on the Keycloak service. Change both at once if updating.",
                      "defaultValue": "keycloak_pw_2026"
                    }
                  },
                  "volumeMounts": {
                    "abe7b8d5-bd05-4ac4-bb03-bcf615e31b65": {
                      "mountPath": "/var/lib/postgresql"
                    }
                  }
                },
                "fe9ff07c-4bc2-4593-945c-4b4a61544b8c": {
                  "icon": null,
                  "name": "keycloak",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "repo": "https://github.com/INAPP-Mobile/keycloak",
                    "rootDirectory": null
                  },
                  "variables": {
                    "KC_PROXY": {
                      "isOptional": false,
                      "description": "Proxy mode: edge (Railway terminates TLS), passthrough, or reencrypt.",
                      "defaultValue": "edge"
                    },
                    "KC_DB_URL": {
                      "isOptional": false,
                      "description": "PostgreSQL JDBC URL. Points at the sibling postgres service on the Railway private network. Username and password are read separately from KC_DB_USERNAME and KC_DB_PASSWORD env vars (do NOT embed them in the URL).",
                      "defaultValue": "jdbc:postgresql://postgres.railway.internal:5432/keycloak"
                    },
                    "KC_HOSTNAME": {
                      "isOptional": false,
                      "description": "Public URL Keycloak generates links with (Keycloak 26.x: KC_HOSTNAME). Defaults to https://<railway-domain>. Railway terminates TLS, so always include the https:// prefix.",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "KC_LOG_LEVEL": {
                      "isOptional": false,
                      "description": "Log level: info, debug, trace, warn, error, or fatal.",
                      "defaultValue": "info"
                    },
                    "KC_DB_PASSWORD": {
                      "isOptional": false,
                      "description": "PostgreSQL password. Must match POSTGRES_PASSWORD on the sibling postgres service. Change both at once if updating.",
                      "defaultValue": "keycloak_pw_2026"
                    },
                    "KC_DB_USERNAME": {
                      "isOptional": false,
                      "description": "PostgreSQL username. Must match POSTGRES_USER on the sibling postgres service.",
                      "defaultValue": "keycloak"
                    },
                    "KC_HTTP_ENABLED": {
                      "isOptional": false,
                      "description": "Enable plain HTTP listener. Required when KC_PROXY=edge so Keycloak can serve HTTP and rely on Railway for TLS termination.",
                      "defaultValue": "true"
                    },
                    "KC_PROXY_HEADERS": {
                      "isOptional": false,
                      "description": "Proxy headers handling (Keycloak 26.x: KC_PROXY_HEADERS). Set to 'xforwarded' when behind a reverse proxy like Railway so Keycloak honors X-Forwarded-* headers (host, proto, port).",
                      "defaultValue": "xforwarded"
                    },
                    "KC_BOOTSTRAP_ADMIN_PASSWORD": {
                      "isOptional": false,
                      "description": "Initial admin password (Keycloak 26.x: KC_BOOTSTRAP_ADMIN_PASSWORD). Auto-generated on first deploy. After the admin user is created, changing this has no effect — use the Admin UI to rotate.",
                      "defaultValue": "{{KC_BOOTSTRAP_ADMIN_PASSWORD}}"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>": {}
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {},
  "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-09T02:19:07.457Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_97791b21b9bc4b348af0",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 78,
    "typical_build_seconds": 20,
    "typical_start_seconds": 10,
    "slowest_service": "keycloak"
  }
}
