OIDC providers and stack-init¶
Part of Upgrading an existing stack.
Walk this rung with the v0.21b1 skill release —
its generator produces the rung's end state. The stack being upgraded names
the release that generated it in its own [tool.soliplex-template] manifest —
use that one when climbing from an older shape.
This rung changes no releases: soliplex, haiku.rag-slim and the web client
stay where rung 6 left them. It changes how the stack decides whether to
require sign-in, and adds a setup step that runs before up. What changes:
- the backend never runs with
--no-auth-mode: with noauth_systemsinbackend/environment/oidc/config.yamlit runs without authentication anyway, and the first provider turns authentication on - the placeholder
keycloakprovider and thekeycloak/directory go away; the skill'sscripts/oidc_providers.pyadds and removes real providers - nginx includes fragments from
nginx/conf.d/, one of which names the provider the/ingester/gate signs in with - the
/ingester/gate is in every stack, not only in stacks with a provider - a
stack-initservice brings the Soliplex databases to their current schema and runs the setup steps instack-init/init.d/: one makes Soliplex's no-auth user an admin while the stack has no provider, which--no-auth-modeused to do implicitly; another adds theadmin_usersentry that admits the room provisioner
Where a step differs, it says which kind of stack it means:
- a stack without a provider runs the backend with
--no-auth-mode, and itsoidc/config.yamlholds only the placeholderkeycloakentry - a stack with a provider runs the backend without
--no-auth-mode, and itsoidc/config.yamlholds the provider(s) it signs in with
Skip the steps that do not apply. Each names what the current template has; compare against a stack the rung's release generates.
-
Stop the stack with
docker compose down, and back up the Postgres databases (see Before you start). -
Add the nginx fragment directory. Copy
nginx/conf.d/README.mdfrom the reference stack, so the directory exists in git. Then, indocker-compose.yml, mount it into thenginxservice, after themime.typesbind: -
Include the fragments in both nginx servers. In
nginx/nginx.conf, after theproxy_cookie_path / /;line in eachserverblock (the HTTP one on9000and the HTTPS one on9443):# Stack fragments: every '*.conf' under the stack's 'nginx/conf.d/' # (mounted read-only at /etc/nginx/conf.d/), included by both # servers. Skill scripts add and remove them, e.g. a route for an # added service. The variable below names the provider the # '/ingester/' gate signs in with: none until 'oidc_providers.py' # adds one and writes it into 'conf.d/signin-provider.conf'. set $soliplex_signin_provider ""; include /etc/nginx/conf.d/*.conf; -
Gate
/ingester/in every stack.Compare
nginx/nginx.confwith the reference stack's; the gate's parts are:- the
map $http_sec_fetch_mode $soliplex_navigateblock, before the firstserver - in each server, the
location @ingester_signinandlocation = /_authz_checkblocks - in each server's
location /ingester/, theauth_request,auth_request_setanderror_page 401 = @ingester_signinlines, and theX-Soliplex-Userheader
In a stack without a provider, add them all, as the reference has them. In a stack with a provider, they are already there: change each
@ingester_signinto the reference's, which redirects to the provider$soliplex_signin_providernames (not a fixed id such askeycloak) and answerssignin_unavailablewhen none is set. - the
-
Stop passing
--no-auth-mode. Indocker-compose.yml, delete the--no-auth-modeline from thebackendservice'scommand(in a stack without a provider; a stack with one has no such line), and replace the# Temporary: run with '--no-auth-mode'comment above it with the reference's. -
In a stack without a provider, remove the placeholder provider. Run the skill's
oidc_providers.pyfrom the stack directory; it leavesauth_systems: []inbackend/environment/oidc/config.yaml:Delete the
keycloak/directory too. -
In a stack with a provider, name the one
/ingester/signs in with: the id its old@ingester_signinredirected to. Run the skill'soidc_providers.pyfrom the stack directory; it writesnginx/conf.d/signin-provider.conf:Delete the
keycloak/directory if the stack has one. -
Add the
stack-initservice. Copy thestack-init/directory from the reference stack. Indocker-compose.yml, add the service aftersoliplex-provisioner; it reusessoliplex-dev's build, secrets and environment through their YAML anchors:# Prepares the stack before it first serves anyone, and again after a part # is added: brings the Soliplex databases to their current schema, then # runs every step in 'stack-init/init.d/' (see stack-init/README.md). # Every step is safe to re-run. Run it before 'docker compose up': # # docker compose run --rm --quiet-build stack-init # # The 'soliplex-dev' image, secrets and environment (YAML aliases), so the # steps reach the databases as the backend does. stack-init: profiles: ["init"] build: *soliplex_dev_build env_file: ".env" user: "${PUID:-1000}:${PGID:-1000}" command: ["sh", "/stack-init/run.sh"] depends_on: postgres: condition: service_healthy secrets: *soliplex_dev_secrets environment: *backend_environment volumes: - ./backend/environment:/environment/ - ./src:/app/src:ro - ./stack-init:/stack-init:ro -
Run
stack-init, then start.In a stack without a provider,
--no-auth-modealready made the no-auth user an admin, sostack-initreports that fact. In a stack with a provider, it does not add the no-auth user as an admin.In both, it admits the room provisioner, unless rung 6's step 12 already did: it reports either way.
-
Then open
/ingester/through nginx. In a stack without a provider, the dashboard opens with no sign-in.In a stack with a provider, it redirects to that provider's sign-in, and admits an admin after it.
Commit.