{
  "manifest_version": "1.0.0",
  "template": {
    "id": "8d8972ba-ebbe-4b40-bdd5-a059fdf05bbb",
    "slug": "keycloak-26-identity-and-sso-server",
    "name": "Keycloak 26 Identity and SSO Server",
    "description": "Single sign-on, OAuth2/OIDC and SAML for your apps, backed by Postgres.",
    "url": "https://railway.com/deploy/keycloak-26-identity-and-sso-server",
    "upstream": {
      "repo_url": "https://github.com/baranberkay96/keycloak-railway"
    }
  },
  "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": "Keycloak",
      "source": {
        "repo": "https://github.com/baranberkay96/keycloak-railway"
      },
      "needs_volume": false,
      "http": true
    }
  ],
  "required_inputs": [
    {
      "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": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Allow Postgres to cleanly shut down.",
      "secret": false,
      "strategy": "default",
      "default": "60"
    },
    {
      "key": "PORT",
      "service": "Keycloak",
      "description": "Port Keycloak's HTTP listener uses; Railway routes the public domain and its healthcheck here.",
      "secret": false,
      "strategy": "default",
      "default": "8080"
    },
    {
      "key": "KC_DB",
      "service": "Keycloak",
      "description": "Database vendor. Build-time option, baked into the optimized image; keep it postgres.",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "KC_CACHE",
      "service": "Keycloak",
      "description": "local = single-node caches (one replica). Set ispn before raising replicas so nodes form a JGroups cluster via the database (jdbc-ping).",
      "secret": false,
      "strategy": "default",
      "default": "local"
    },
    {
      "key": "KC_HOSTNAME",
      "service": "Keycloak",
      "description": "Public base URL used in tokens (issuer) and redirects. Change it when you add a custom domain.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "JVM_MAX_CPUS",
      "service": "Keycloak",
      "description": "CPU count reported to the JVM (sizes GC and HTTP thread pools). Lowered automatically if the container has a smaller CPU quota.",
      "secret": false,
      "strategy": "default",
      "default": "4"
    },
    {
      "key": "KC_HTTP_HOST",
      "service": "Keycloak",
      "description": "Bind address. :: is dual-stack (IPv4 and IPv6), so private-network callers reach Keycloak in every Railway environment.",
      "secret": false,
      "strategy": "default",
      "default": "::"
    },
    {
      "key": "KC_HTTP_PORT",
      "service": "Keycloak",
      "description": "HTTP port, kept equal to PORT.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "KC_LOG_LEVEL",
      "service": "Keycloak",
      "description": "Root log level (e.g. info, debug, or info,org.keycloak.events:debug).",
      "secret": false,
      "strategy": "default",
      "default": "info"
    },
    {
      "key": "KC_DB_PASSWORD",
      "service": "Keycloak",
      "description": "Postgres password (generated on the Postgres service).",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "KC_DB_URL_HOST",
      "service": "Keycloak",
      "description": "Postgres host on the private network.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "KC_DB_URL_PORT",
      "service": "Keycloak",
      "description": "Postgres port.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "KC_DB_USERNAME",
      "service": "Keycloak",
      "description": "Postgres user.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "DB_WAIT_SECONDS",
      "service": "Keycloak",
      "description": "How long the entrypoint waits for Postgres to accept connections before starting Keycloak (0 = do not wait).",
      "secret": false,
      "strategy": "default",
      "default": "600"
    },
    {
      "key": "JVM_HEAP_MAX_MB",
      "service": "Keycloak",
      "description": "Upper bound for the JVM heap in MB. The entrypoint uses the smaller of this, 70% of the container memory limit, and the limit minus 384 MB.",
      "secret": false,
      "strategy": "default",
      "default": "1024"
    },
    {
      "key": "KC_HTTP_ENABLED",
      "service": "Keycloak",
      "description": "Plain HTTP listener behind Railway's TLS-terminating edge.",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "JVM_HEAP_PERCENT",
      "service": "Keycloak",
      "description": "Share of the container memory limit the heap may use (Keycloak's own default ratio), capped by JVM_HEAP_MAX_MB.",
      "secret": false,
      "strategy": "default",
      "default": "70"
    },
    {
      "key": "KC_PROXY_HEADERS",
      "service": "Keycloak",
      "description": "Trust X-Forwarded-* headers from Railway's edge proxy, which terminates TLS.",
      "secret": false,
      "strategy": "default",
      "default": "xforwarded"
    },
    {
      "key": "KEYCLOAK_VERSION",
      "service": "Keycloak",
      "description": "quay.io/keycloak/keycloak tag the image is built from (build argument). Change it to upgrade; back up Postgres first.",
      "secret": true,
      "strategy": "default",
      "default": "26.8.1"
    },
    {
      "key": "KC_DB_URL_DATABASE",
      "service": "Keycloak",
      "description": "Postgres database name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "KC_DB_POOL_MAX_SIZE",
      "service": "Keycloak",
      "description": "Maximum database connections per Keycloak replica (upstream default 100; Postgres allows 100 in total).",
      "secret": false,
      "strategy": "default",
      "default": "20"
    },
    {
      "key": "KC_BOOTSTRAP_ADMIN_PASSWORD",
      "service": "Keycloak",
      "description": "Password of that temporary admin (generated). Sign in with it, create a permanent admin, then delete the temporary one.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "KC_BOOTSTRAP_ADMIN_USERNAME",
      "service": "Keycloak",
      "description": "Username of the temporary admin created in the master realm on first start. Changing it later has no effect.",
      "secret": false,
      "strategy": "default",
      "default": "admin"
    },
    {
      "key": "KC_HOSTNAME_BACKCHANNEL_DYNAMIC",
      "service": "Keycloak",
      "description": "Lets apps in this project call Keycloak over the private network (http://keycloak.railway.internal:8080) for token, JWKS and introspection requests.",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Keycloak",
      "description": "Time between SIGTERM and SIGKILL on redeploys so Keycloak can shut down cleanly.",
      "secret": false,
      "strategy": "default",
      "default": "30"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "keycloak-26-identity-and-sso-server"
      }
    },
    "cli": "railway deploy --template keycloak-26-identity-and-sso-server",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "8d8972ba-ebbe-4b40-bdd5-a059fdf05bbb",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "0a42649f-cad3-5530-93c8-511ad7f2e25c": {
                  "icon": "https://devicons.railway.app/i/postgresql.svg",
                  "name": "Postgres",
                  "deploy": {
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": true,
                      "description": "Location where the database will be initialized.",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": true,
                      "description": "Railway Private Domain Name.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": true,
                      "description": "Port to connect to Postgres.",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": true,
                      "description": "Required variable for Data panel.",
                      "defaultValue": "${{ POSTGRES_USER }}"
                    },
                    "PGDATABASE": {
                      "isOptional": true,
                      "description": "Required variable for the data panel.",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": true,
                      "description": "Required variable for Data panel.",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": true,
                      "description": "Default database created when image is started.",
                      "defaultValue": "railway"
                    },
                    "DATABASE_URL": {
                      "isOptional": true,
                      "description": "URL to connect to Postgres database.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": true,
                      "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": true,
                      "description": "Password to connect to DB.",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": true,
                      "description": "Allow Postgres to cleanly shut down.",
                      "defaultValue": "60"
                    }
                  },
                  "networking": {
                    "tcpProxies": {},
                    "serviceDomains": {}
                  },
                  "volumeMounts": {
                    "d1ddccad-2485-5168-aa94-8f1eacda781b": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                },
                "f072b99a-8e39-53da-b170-5d41d43dd981": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/keycloak.svg",
                  "name": "Keycloak",
                  "build": {
                    "builder": "DOCKERFILE"
                  },
                  "deploy": {
                    "healthcheckPath": "/health/ready",
                    "restartPolicyType": "ALWAYS",
                    "healthcheckTimeout": 900
                  },
                  "source": {
                    "repo": "baranberkay96/keycloak-railway",
                    "branch": "main",
                    "rootDirectory": "/services/keycloak"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": true,
                      "description": "Port Keycloak's HTTP listener uses; Railway routes the public domain and its healthcheck here.",
                      "defaultValue": "8080"
                    },
                    "KC_DB": {
                      "isOptional": true,
                      "description": "Database vendor. Build-time option, baked into the optimized image; keep it postgres.",
                      "defaultValue": "postgres"
                    },
                    "KC_CACHE": {
                      "isOptional": true,
                      "description": "local = single-node caches (one replica). Set ispn before raising replicas so nodes form a JGroups cluster via the database (jdbc-ping).",
                      "defaultValue": "local"
                    },
                    "KC_HOSTNAME": {
                      "isOptional": true,
                      "description": "Public base URL used in tokens (issuer) and redirects. Change it when you add a custom domain.",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "JVM_MAX_CPUS": {
                      "isOptional": true,
                      "description": "CPU count reported to the JVM (sizes GC and HTTP thread pools). Lowered automatically if the container has a smaller CPU quota.",
                      "defaultValue": "4"
                    },
                    "KC_HTTP_HOST": {
                      "isOptional": true,
                      "description": "Bind address. :: is dual-stack (IPv4 and IPv6), so private-network callers reach Keycloak in every Railway environment.",
                      "defaultValue": "::"
                    },
                    "KC_HTTP_PORT": {
                      "isOptional": true,
                      "description": "HTTP port, kept equal to PORT.",
                      "defaultValue": "${{PORT}}"
                    },
                    "KC_LOG_LEVEL": {
                      "isOptional": true,
                      "description": "Root log level (e.g. info, debug, or info,org.keycloak.events:debug).",
                      "defaultValue": "info"
                    },
                    "KC_DB_PASSWORD": {
                      "isOptional": true,
                      "description": "Postgres password (generated on the Postgres service).",
                      "defaultValue": "${{Postgres.PGPASSWORD}}"
                    },
                    "KC_DB_URL_HOST": {
                      "isOptional": true,
                      "description": "Postgres host on the private network.",
                      "defaultValue": "${{Postgres.PGHOST}}"
                    },
                    "KC_DB_URL_PORT": {
                      "isOptional": true,
                      "description": "Postgres port.",
                      "defaultValue": "${{Postgres.PGPORT}}"
                    },
                    "KC_DB_USERNAME": {
                      "isOptional": true,
                      "description": "Postgres user.",
                      "defaultValue": "${{Postgres.PGUSER}}"
                    },
                    "DB_WAIT_SECONDS": {
                      "isOptional": true,
                      "description": "How long the entrypoint waits for Postgres to accept connections before starting Keycloak (0 = do not wait).",
                      "defaultValue": "600"
                    },
                    "JVM_HEAP_MAX_MB": {
                      "isOptional": true,
                      "description": "Upper bound for the JVM heap in MB. The entrypoint uses the smaller of this, 70% of the container memory limit, and the limit minus 384 MB.",
                      "defaultValue": "1024"
                    },
                    "KC_HTTP_ENABLED": {
                      "isOptional": true,
                      "description": "Plain HTTP listener behind Railway's TLS-terminating edge.",
                      "defaultValue": "true"
                    },
                    "JVM_HEAP_PERCENT": {
                      "isOptional": true,
                      "description": "Share of the container memory limit the heap may use (Keycloak's own default ratio), capped by JVM_HEAP_MAX_MB.",
                      "defaultValue": "70"
                    },
                    "KC_PROXY_HEADERS": {
                      "isOptional": true,
                      "description": "Trust X-Forwarded-* headers from Railway's edge proxy, which terminates TLS.",
                      "defaultValue": "xforwarded"
                    },
                    "KEYCLOAK_VERSION": {
                      "isOptional": true,
                      "description": "quay.io/keycloak/keycloak tag the image is built from (build argument). Change it to upgrade; back up Postgres first.",
                      "defaultValue": "26.8.1"
                    },
                    "KC_DB_URL_DATABASE": {
                      "isOptional": true,
                      "description": "Postgres database name.",
                      "defaultValue": "${{Postgres.PGDATABASE}}"
                    },
                    "KC_DB_POOL_MAX_SIZE": {
                      "isOptional": true,
                      "description": "Maximum database connections per Keycloak replica (upstream default 100; Postgres allows 100 in total).",
                      "defaultValue": "20"
                    },
                    "KC_BOOTSTRAP_ADMIN_PASSWORD": {
                      "isOptional": true,
                      "description": "Password of that temporary admin (generated). Sign in with it, create a permanent admin, then delete the temporary one.",
                      "defaultValue": "{{KC_BOOTSTRAP_ADMIN_PASSWORD}}"
                    },
                    "KC_BOOTSTRAP_ADMIN_USERNAME": {
                      "isOptional": true,
                      "description": "Username of the temporary admin created in the master realm on first start. Changing it later has no effect.",
                      "defaultValue": "admin"
                    },
                    "KC_HOSTNAME_BACKCHANNEL_DYNAMIC": {
                      "isOptional": true,
                      "description": "Lets apps in this project call Keycloak over the private network (http://keycloak.railway.internal:8080) for token, JWKS and introspection requests.",
                      "defaultValue": "true"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": true,
                      "description": "Time between SIGTERM and SIGKILL on redeploys so Keycloak can shut down cleanly.",
                      "defaultValue": "30"
                    }
                  },
                  "networking": {
                    "tcpProxies": {},
                    "serviceDomains": {
                      "<hasDomain>:8080": {
                        "port": 8080
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "Keycloak",
      "method": "GET",
      "path": "/health/ready",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 2,
    "needs_volume": true
  },
  "generated_at": "2026-10-19T22:14:48.327Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-10-19T21:49:00.987Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_bf6009344ee445ee92e4",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "healthcheck",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 203,
    "typical_build_seconds": 94,
    "typical_start_seconds": 30,
    "slowest_service": "Keycloak"
  }
}
