Enable Keycloak auth in dev environment (docker-compose + terraform redirect URI) #164
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Feature
Lineage
Standalone — discovered during auth strategy spike (#159). Dev environment lacks auth parity with prod.
Repo
ldraney/landscaping-assistantUser Story
As a developer
I want the dev environment to authenticate via Keycloak identically to prod
So that auth bugs are caught before reaching production and the dev experience matches what users see
Context
The dev environment (
landscaping-dev.tail5b443a.ts.net) currently runs with graceful auth degradation —KEYCLOAK_URLis unset, so no login is required. This was fine during early development but now that auth is live in prod (OmniAuth + Auth Code + PKCE), dev should mirror it.The dev setup is: internet → k8s nginx reverse proxy → MacBook docker-compose (port 7143) → Rails on :3000. The nginx proxy already sets
X-Forwarded-Proto: httpssoassume_sslworks correctly.The Keycloak client (
landscaping-assistantin realmlandscaping) currently only has the prod redirect URI configured. Adding the dev URI enables the same client to serve both environments.File Targets
Files the agent should modify or create:
docker-compose.yml— addenv_file: .envdirective towebservice (see Implementation mechanism below).env.example— create with all Keycloak vars as placeholders (developer copies to.envand fills in secret)Files the agent should NOT touch:
config/database.yml— already correctapp/controllers/application_controller.rb— graceful degradation logic unchanged.gitignore— already ignores.env(verify, add if missing)Cross-repo (pal-e-services):
terraform/k3s.tfvars— add dev redirect URI tolandscaping-assistantclientterraform/k3s.tfvars.example— mirror the change (without secrets)Implementation Mechanism: env_file pattern
Use
env_file: .envin docker-compose (NOT inline${VAR}interpolation). This is the standard docker-compose secrets pattern:docker-compose.ymlweb service:.env.example(committed):.envis in.gitignore(add if missing)This approach:
.envfile = no auth = graceful degradation preserved)Feature Flag
none — this is infrastructure/environment config, not a user-facing feature
Acceptance Criteria
docker compose upstarts app with Keycloak auth enabled (when.envhas secret)https://landscaping-dev.tail5b443a.ts.netredirects to Keycloak loginhttps://landscaping-dev.tail5b443a.ts.net/auth/keycloak/callbackand sets session.envfile (or unsettingKEYCLOAK_URL) still allows auth-free local dev.envfile is gitignored (client secret never committed)terraform applysucceeds with updated client configTest Expectations
landscaping-dev.tail5b443a.ts.netdocker compose exec web bundle exec rspecConstraints
.envfile withenv_file:directiveterraform applyon infra host after mergearch:rails-app,arch:platform) are board categorization — no dedicated architecture notes required for this ticketChecklist
terraform applyrun on infra hostRelated
project-landscaping-assistant— project this affectsdocs/auth-strategy.md— definitive auth decision recordScope Review: NEEDS_REFINEMENT
Review note:
review-1383-2026-06-07Well-structured ticket with verified file targets and clear acceptance criteria. Three refinement items found:
arch-rails-appdoes not exist in pal-e-docs — create it for traceabilityarch-platformdoes not exist in pal-e-docs — create it for traceabilityenv_filedirective — ticket should clarify whether to addenv_file: .envor useenvironmententries with${KEYCLOAK_*}variable interpolation. Without this, the.envfile won't inject variables into the container environment automatically.Scope Review: APPROVED
Review note:
review-1383-2026-06-07-r2RE-REVIEW passed. All three issues from the previous review have been addressed:
Ticket is ready for implementation. No further action needed.
Validation: PASS
Tiers executed: Tier 1 (Local), Tier 3 (Production/Dev live)
Validation note:
validation-164-2026-06-077 checks: 7 PASS, 0 FAIL
All acceptance criteria verified:
required: false+ ENV guard)