Commit graph

21 commits

Author SHA1 Message Date
Mikael Hugo
ce1c475bcc Commit current workspace state 2026-05-13 01:58:23 +02:00
Mikael Hugo
f40632b297 sf snapshot: uncommitted changes after 2133m inactivity 2026-05-13 01:30:33 +02:00
Mikael Hugo
1758b2465e fix: guard secret_key_base config by RELEASE_NAME
Each release only requires its own secret key:
- centralcloud_my  needs MY_SECRET_KEY_BASE
- centralcloud_staff needs OPS_SECRET_KEY_BASE

RELEASE_NAME is set automatically by Elixir release scripts at startup.
Fixes startup crash when staff release ran without MY_SECRET_KEY_BASE.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-11 13:57:07 +02:00
Mikael Hugo
a4ca979cc2 fix: make server/migrate scripts app-agnostic
Detect the app binary by trying centralcloud_staff then centralcloud_my.
Fixes CrashLoopBackOff when centralcloud-staff image ran /app/bin/server
which was hardcoded to exec ./centralcloud_my (not found in staff image).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-11 13:52:44 +02:00
Mikael Hugo
1af4dd8dda fix: Dockerfile builds both centralcloud_staff and centralcloud_my
- Fix broken reference to apps/centralcloud_ops (renamed to centralcloud_staff)
- Add multi-target Dockerfile: --target my and --target staff
- Both releases now built from one build stage (shared layer cache)
- Add OPS_ENGINE_URL config in runtime.exs for staff → engine API calls

  docker build --target staff -t .../centralcloud-staff:VERSION .
  docker build --target my    -t .../centralcloud-my:VERSION .

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-11 13:34:05 +02:00
Mikael Hugo
1c7d922cce docs: update README and AGENTS.md after centralcloud_staff rename
- README: correct app names (centralcloud_staff not centralcloud_ops)
- README: add ROUTER_AGENT_URL/KEY env vars, nix develop quick start
- README: clarify staff UI vs backend engine distinction

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-11 13:19:30 +02:00
Mikael Hugo
9f486f36d0 refactor: rename centralcloud_ops → centralcloud_staff in portal
The portal umbrella now has unambiguous app names:
- centralcloud_staff: staff-facing UI (ops.centralcloud.com)
- centralcloud_my:    customer-facing UI (my.centralcloud.com)
- centralcloud_core:  shared library

The infra/apps/centralcloud_ops backend engine retains its name.
Config keys, session cookies, releases all updated accordingly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-11 13:06:21 +02:00
Mikael Hugo
454e9b83ba fix: use cached erlang in devShell (avoid full recompile)
Drop the headless override — standard beamPackages.erlang (OTP 28.5)
is already in binary cache, so nix develop resolves instantly.
Elixir 1.20.0-rc.4 still built from source (takes ~2min first time).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-11 11:59:04 +02:00
Mikael Hugo
0ed09d5fb5 chore: bump centralcloud_core elixir ~> 1.20
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-11 11:23:32 +02:00
Mikael Hugo
a3622f29ef feat: elixir 1.20-rc4 flake, AI ops chat (ChatLive + RouterAgent)
- flake.nix: custom elixir_1_20_rc4 derivation via overrideAttrs on
  beamPackages.elixir_1_19 with headless OTP 28; nixos-25.11 pinned
- mix.exs (ops + my): elixir ~> 1.20
- Dockerfile: note 1.19.5 stays until hexpm publishes 1.20 stable image
- New: ChatLive — full-screen AI ops chat with SSE streaming, scroll hook,
  suggestion buttons, typing indicator, clear history
- New: RouterAgent — streams OpenAI-compatible SSE from router-agent svc;
  configurable URL + API key via env; sends {:chunk,t}/:stream_done msgs to LiveView
- Router: add live /chat route under auth pipeline
- Layouts: AI Chat nav link + ScrollBottom JS hook inline
- Application: Finch pool started for RouterAgent HTTP client
- Priv/static: phoenix.min.js + phoenix_live_view.min.js bundled
- Config: ROUTER_AGENT_URL / ROUTER_AGENT_API_KEY in dev.exs + runtime.exs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-11 11:23:14 +02:00
Mikael Hugo
1342a4ab2a chore: pin nixpkgs to nixos-25.11 and add centralcloud cache config
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-10 23:16:14 +02:00
Mikael Hugo
f84f59e0df feat: build out centralcloud_ops staff portal with Grafana OnCall backend
- Add CentralcloudCore.OnCall API client (alert groups, schedules, users,
  escalation chains) — talks to Grafana OnCall HTTP API v1
- Add centralcloud_ops application, endpoint, router, layouts
- Add RequireStaff auth plug, SessionController, HealthController
- Add DashboardLive: firing/acked alerts with ack/resolve actions, auto-refresh
- Add IncidentsLive: filterable incident list by status
- Add IncidentLive: incident detail with ack/resolve/silence actions
- Add OnCallLive: schedule cards showing who is currently on-call
- Add StakeholdersLive: HostBill client search + service view + comms panel
- Wire ONCALL_URL / ONCALL_API_TOKEN env vars in config and runtime.exs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-10 22:54:33 +02:00
Mikael Hugo
37777ca54b fix: disable Swoosh hackney in prod — no email sending yet
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-09 20:52:00 +02:00
Mikael Hugo
29e4f25e15 fix: runtime.exs OPS_SECRET_KEY_BASE optional, release.ex handles missing ecto_repos
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-09 20:49:09 +02:00
Mikael Hugo
9e0b43ea90 feat: add health endpoint, release config, and Dockerfile for k8s deployment
- GET /api/health — JSON probe endpoint (no auth)
- CentralcloudMy.Release — Ecto migrate/rollback for init container
- rel/overlays/bin/{server,migrate} scripts for the OTP release
- mix.exs releases: centralcloud_my targeting core + my apps
- Dockerfile: umbrella-aware multi-stage build on hexpm/elixir:1.19.5-erlang-28

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-09 20:45:22 +02:00
Mikael Hugo
e321459364 chore: add _build/ and deps/ to .gitignore
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-09 20:25:22 +02:00
Mikael Hugo
97b99c3fe3 fix: use Bandit adapter via config — Phoenix boots on port 4001
- Add adapter: Bandit.PhoenixAdapter to config.exs and dev.exs
- Phoenix reads adapter from app config, not from use macro option
- Verified: Bandit 1.11.0 starts successfully on 0.0.0.0:4001

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-09 20:25:18 +02:00
Mikael Hugo
453a6deead feat: Elixir 1.20-rc4/OTP28, wire Phoenix endpoints, router, LiveViews, auth plug
- flake.nix: Elixir 1.20.0-rc.4 via pkgs.path (reproducible, no hardcoded store paths)
- RequireAuth plug (session-based, redirects to /login)
- SessionController: login form, logout, OIDC callback stub
- DashboardLive, ReplicationLive, BillingLive, SupportLive (skeleton)
- Layouts: dark UI, nav, flash messages
- All compile clean on 1.20-rc4 with zero warnings

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-09 20:20:19 +02:00
Mikael Hugo
afcbba3fc7 chore: upgrade to Elixir 1.19.5 / OTP 28, add Gleam to dev shell
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-09 20:01:38 +02:00
Mikael Hugo
35f29f42e3 feat: add flake.nix, .envrc, fix config (runtime.exs), deps compile clean
- flake.nix: Elixir 1.18.4 / OTP 27 / Node 22 dev shell
- .envrc: use flake
- config/config.exs: move fetch_env! to runtime.exs (compile-time safe)
- config/runtime.exs: all secrets loaded at runtime via env vars
- mix.lock: generated after mix deps.get
- All 3 apps compile cleanly

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-09 19:55:48 +02:00
Mikael Hugo
009d644a15 feat: scaffold centralcloud Elixir umbrella (my. + ops. + core)
- Umbrella root with apps/centralcloud_{my,ops,core}
- centralcloud_core: HostBill Admin API client, DR Portal API client
- centralcloud_my: Phoenix LiveView app for my.centralcloud.com
- centralcloud_ops: Phoenix app for ops.centralcloud.com
- Shared config: Authentik OIDC, HostBill, DR Portal endpoints
- README with quick start and required env vars

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-09 19:49:01 +02:00