{
  "manifest_version": "1.0.0",
  "template": {
    "id": "76316628-57be-404f-bcb3-450b1558970b",
    "slug": "keycloak",
    "name": "Keycloak Identity Management | Open-Source Alternative to Auth0",
    "description": "Self Host Keycloak: SSO, MFA, LDAP federation, OIDC on Railway",
    "url": "https://railway.com/deploy/keycloak",
    "upstream": {
      "image": "quay.io/keycloak/keycloak:latest"
    }
  },
  "status": "unvalidated",
  "validated_at": null,
  "success_rate_30d": null,
  "services": [
    {
      "name": "Keycloak",
      "source": {
        "image": "quay.io/keycloak/keycloak: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": "PORT",
      "service": "Keycloak",
      "description": "Railway routing port",
      "secret": false,
      "strategy": "default",
      "default": "8080"
    },
    {
      "key": "KC_DB",
      "service": "Keycloak",
      "description": "Database vendor selection",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "KC_DB_URL",
      "service": "Keycloak",
      "description": "JDBC connection string",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "KC_DB_PASSWORD",
      "service": "Keycloak",
      "description": "Database password",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "KC_DB_USERNAME",
      "service": "Keycloak",
      "description": "Database username",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "KC_HTTP_ENABLED",
      "service": "Keycloak",
      "description": "Enable HTTP listener",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "KC_PROXY_HEADERS",
      "service": "Keycloak",
      "description": "Trust reverse proxy headers",
      "secret": false,
      "strategy": "default",
      "default": "xforwarded"
    },
    {
      "key": "KC_HEALTH_ENABLED",
      "service": "Keycloak",
      "description": "Expose health check endpoints",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "KC_HOSTNAME_STRICT",
      "service": "Keycloak",
      "description": "Dynamic hostname from headers",
      "secret": false,
      "strategy": "default",
      "default": "false"
    },
    {
      "key": "KC_METRICS_ENABLED",
      "service": "Keycloak",
      "description": "Expose metrics endpoint",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "KC_BOOTSTRAP_ADMIN_PASSWORD",
      "service": "Keycloak",
      "description": "Initial admin password (bootstrap only)",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "KC_BOOTSTRAP_ADMIN_USERNAME",
      "service": "Keycloak",
      "description": "Initial admin username",
      "secret": false,
      "strategy": "ask_user"
    },
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "Postgres data storage directory",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "Postgres",
      "description": "Internal Postgres host address",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "Postgres",
      "description": "Postgres server listening port",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "Postgres",
      "description": "Default Postgres username",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "Postgres",
      "description": "Default database name",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "Postgres",
      "description": "Password for Postgres user",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Initial database created on startup",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "DATABASE_URL",
      "service": "Postgres",
      "description": "Internal Postgres connection string",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "Default database superuser name",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "SSL_CERT_DAYS",
      "service": "Postgres",
      "description": "Self-signed SSL certificate validity",
      "secret": false,
      "strategy": "default",
      "default": "820"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Postgres database user password",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "DATABASE_PUBLIC_URL",
      "service": "Postgres",
      "description": "Public Postgres connection string",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Graceful shutdown draining duration",
      "secret": false,
      "strategy": "default",
      "default": "60"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "keycloak"
      }
    },
    "cli": "railway deploy --template keycloak",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "76316628-57be-404f-bcb3-450b1558970b",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "44b331e8-34b6-45c2-bf6a-9abe0ebd76a0": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/keycloak.svg",
                  "name": "Keycloak",
                  "deploy": {
                    "startCommand": "/opt/keycloak/bin/kc.sh start",
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "quay.io/keycloak/keycloak:latest"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Railway routing port",
                      "defaultValue": "8080"
                    },
                    "KC_DB": {
                      "isOptional": false,
                      "description": "Database vendor selection",
                      "defaultValue": "postgres"
                    },
                    "KC_DB_URL": {
                      "isOptional": false,
                      "description": "JDBC connection string",
                      "defaultValue": "jdbc:postgresql://${{Postgres.PGHOST}}:${{Postgres.PGPORT}}/${{Postgres.PGDATABASE}}"
                    },
                    "KC_DB_PASSWORD": {
                      "isOptional": false,
                      "description": "Database password",
                      "defaultValue": "${{Postgres.PGPASSWORD}}"
                    },
                    "KC_DB_USERNAME": {
                      "isOptional": false,
                      "description": "Database username",
                      "defaultValue": "${{Postgres.PGUSER}}"
                    },
                    "KC_HTTP_ENABLED": {
                      "isOptional": false,
                      "description": "Enable HTTP listener",
                      "defaultValue": "true"
                    },
                    "KC_PROXY_HEADERS": {
                      "isOptional": false,
                      "description": "Trust reverse proxy headers",
                      "defaultValue": "xforwarded"
                    },
                    "KC_HEALTH_ENABLED": {
                      "isOptional": false,
                      "description": "Expose health check endpoints",
                      "defaultValue": "true"
                    },
                    "KC_HOSTNAME_STRICT": {
                      "isOptional": false,
                      "description": "Dynamic hostname from headers",
                      "defaultValue": "false"
                    },
                    "KC_METRICS_ENABLED": {
                      "isOptional": false,
                      "description": "Expose metrics endpoint",
                      "defaultValue": "true"
                    },
                    "KC_BOOTSTRAP_ADMIN_PASSWORD": {
                      "isOptional": false,
                      "description": "Initial admin password (bootstrap only)",
                      "defaultValue": "{{KC_BOOTSTRAP_ADMIN_PASSWORD}}"
                    },
                    "KC_BOOTSTRAP_ADMIN_USERNAME": {
                      "isOptional": false,
                      "description": "Initial admin username",
                      "defaultValue": "{{KC_BOOTSTRAP_ADMIN_USERNAME}}"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>": {}
                    }
                  }
                },
                "5d3f4ac4-b8ee-4b2a-bccc-d6b4d91bdc17": {
                  "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": "Postgres data storage directory",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Internal Postgres host address",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "Postgres server listening port",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "Default Postgres username",
                      "defaultValue": "${{POSTGRES_USER}}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "Default database name",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "Password for Postgres user",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Initial database created on startup",
                      "defaultValue": "railway"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Internal Postgres connection string",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Default database superuser name",
                      "defaultValue": "postgres"
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": false,
                      "description": "Self-signed SSL certificate validity",
                      "defaultValue": "820"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Postgres database user password",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "DATABASE_PUBLIC_URL": {
                      "isOptional": false,
                      "description": "Public Postgres connection string",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{PGDATABASE}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Graceful shutdown draining duration",
                      "defaultValue": "60"
                    }
                  },
                  "volumeMounts": {
                    "5d3f4ac4-b8ee-4b2a-bccc-d6b4d91bdc17": {
                      "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": {},
  "resources": {
    "expected_services": 2,
    "needs_volume": true
  },
  "generated_at": "2026-09-20T16:14:49.616Z",
  "generator_version": "0.1.0"
}
