toga-ai 1.0.106 → 1.0.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,3 +4,4 @@
|
|
|
4
4
|
|-----|---------|-------|
|
|
5
5
|
| [API (api2 / TOGa API v2) Architecture](architecture.md) | `api2` is the backend powering the public **TOGa 2.0 API**. | api2/Controller/Index.php, api2/Component/Api/V2/V2.php, api2/Component/Api/Cxml/Cxml.php, api2/Component/Api/V2/Response/Response.php, api2/Config/ |
|
|
6
6
|
| [AWS CodePipeline Deployment via CodeConnections (GitHub → Elastic Beanstalk)](workflows/codepipeline-codeconnections-deploy.md) | 2.0 apps (`api2`, `_underscore`) are deployed through **AWS CodePipeline**. | |
|
|
7
|
+
| [New Environment Configuration & Provisioning (api2)](workflows/environment-configuration-and-provisioning.md) | What it takes for a 2.0 API environment (e.g. | api2/Config/<environment>.ini, api2/Controller/Index.php, dbchanges2/Core/2026-06-16a - DatabaseHosts for new QA QC stage demo environments.sql, _underscore/Route.php |
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: New Environment Configuration & Provisioning (api2)
|
|
3
|
+
framework: "2.0"
|
|
4
|
+
repo: api2
|
|
5
|
+
project: API
|
|
6
|
+
client: shared
|
|
7
|
+
type: workflow
|
|
8
|
+
status: active
|
|
9
|
+
updated: 2026-06-16
|
|
10
|
+
owners: ["jcardinal"]
|
|
11
|
+
files:
|
|
12
|
+
- api2/Config/<environment>.ini
|
|
13
|
+
- api2/Controller/Index.php
|
|
14
|
+
- dbchanges2/Core/2026-06-16a - DatabaseHosts for new QA QC stage demo environments.sql
|
|
15
|
+
- _underscore/Route.php
|
|
16
|
+
related: []
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Summary
|
|
20
|
+
What it takes for a 2.0 API environment (e.g. `qc-security`, `qa-task`, `stage`) to actually
|
|
21
|
+
serve requests. Three independent things must all be correct, or `/v2/...` calls fail — often
|
|
22
|
+
with a **misleading** error. This documents the config conventions, the `Core.DatabaseHosts`
|
|
23
|
+
data the framework needs, and the database seeding step, plus the diagnostic gotcha that masks
|
|
24
|
+
the real cause.
|
|
25
|
+
|
|
26
|
+
## Steps (to stand up a new environment)
|
|
27
|
+
|
|
28
|
+
1. **Create `api2/Config/<environment>.ini`.** Copy an existing all-in-one env file
|
|
29
|
+
(e.g. `qc-security.ini`) and change **only**:
|
|
30
|
+
- `[database]` and `[database1]` → `hostname` = the env's DB cluster endpoint.
|
|
31
|
+
- `[api]` → `_` and `worker` = the env's API/worker base URLs.
|
|
32
|
+
Leave everything else (cloud keys, fedex, netsuite, ups, calcom, etc.) as-is. Match the
|
|
33
|
+
file's existing **CRLF** line endings — a whole-file LF flip buries the real diff.
|
|
34
|
+
|
|
35
|
+
2. **Use the correct host naming convention** (load-bearing — see Gotchas):
|
|
36
|
+
- **DB host:** `<specific>.<family>.database.togahub.com` — e.g. `security.qc...`,
|
|
37
|
+
`task.qa...`. The specific name comes **first**, the family (`qa`/`qc`) second.
|
|
38
|
+
`stage`/`demo` are single-label: `stage.database.togahub.com`.
|
|
39
|
+
- **API/worker base:** `https://api.<dbprefix>.togahub.com/v2` and
|
|
40
|
+
`https://worker.<dbprefix>.togahub.com`, where `<dbprefix>` is the DB host minus
|
|
41
|
+
`.database` (e.g. DB `security.qc.database...` → `api.security.qc.togahub.com`).
|
|
42
|
+
|
|
43
|
+
3. **Register `Core.DatabaseHosts` rows** for the environment (via a `dbchanges2/Core`
|
|
44
|
+
migration). Non-prod environments are **all-in-one**: a single cluster holds `Core` +
|
|
45
|
+
every `Client_`/`Logs_`/`Archive_` DB. So insert **one row per database**, `regionId = NULL`,
|
|
46
|
+
with `hostCluster = hostWriter = hostReader` = the single endpoint. Resolve `environmentId`
|
|
47
|
+
by `Environments.slug` and `databaseId` from the Core's own `Databases` table so the migration
|
|
48
|
+
is portable across every Core; guard with `NOT EXISTS` for idempotency. (Production differs:
|
|
49
|
+
per-family clusters and per-region reader rows.)
|
|
50
|
+
|
|
51
|
+
4. **Seed the cluster.** A brand-new RDS cluster has only system schemas. `Core` and the client
|
|
52
|
+
DBs must be provisioned and the `dbchanges2` migrations applied before the app can connect.
|
|
53
|
+
Until then, every request throws on the first Core query.
|
|
54
|
+
|
|
55
|
+
## Systems involved
|
|
56
|
+
- **api2** — `Config/<env>.ini` (DB + API hosts); `Controller/Index.php::api()` registers `Core`
|
|
57
|
+
from `[database]` then dispatches by hostname.
|
|
58
|
+
- **_underscore** — boot/routing; reads `Core.Environments` + `Core.DatabaseHosts` to resolve
|
|
59
|
+
region-aware connections.
|
|
60
|
+
- **dbchanges2/Core** — the migration that populates `Core.DatabaseHosts` per environment.
|
|
61
|
+
- **Core DB** — `Environments`, `Databases`, `DatabaseHosts`, `Regions` drive resolution.
|
|
62
|
+
|
|
63
|
+
## Edge cases & escalation — diagnosing a broken environment
|
|
64
|
+
|
|
65
|
+
**Symptom:** a fatal like
|
|
66
|
+
`Uncaught Exception: Failed to determine how to render view for route '/v2/auth/api' ... Route.php:525`.
|
|
67
|
+
|
|
68
|
+
**This message is misleading — it is almost never about views.** `_Controller_Index::api()`
|
|
69
|
+
threw an `Exception` (e.g. the `Core` DB connection/query failed), and `_underscore/Route.php`'s
|
|
70
|
+
dispatch **catches `Exception`, silently rolls back, leaves the controller response unset**, then
|
|
71
|
+
falls through to its view-render path and throws the generic "Failed to determine how to render
|
|
72
|
+
view" error. The real exception is swallowed. When the same codebase works in `production` but
|
|
73
|
+
fails in a new environment, suspect **environment config / Core DB**, not the view layer.
|
|
74
|
+
|
|
75
|
+
Diagnostic order:
|
|
76
|
+
1. Compare the env's `[database] hostname` against the `<specific>.<family>.database.togahub.com`
|
|
77
|
+
convention — a reversed host (e.g. `qc.security...` instead of `security.qc...`) won't resolve.
|
|
78
|
+
Verify with `nslookup` / PHP `mysqli_connect`.
|
|
79
|
+
2. Connect to the resolved host and `SHOW DATABASES` — confirm `Core` actually exists (a fresh
|
|
80
|
+
cluster has only `information_schema/mysql/performance_schema/sys` → not seeded yet).
|
|
81
|
+
3. Confirm `Core.DatabaseHosts` has rows for this `environmentId` (Core Logs DB id is `11`).
|
|
82
|
+
|
|
83
|
+
## Change history
|
|
84
|
+
- 2026-06-16 — Documented after fixing `qc-security`: `[database] hostname` was reversed
|
|
85
|
+
(`qc.security...`), which threw on Core connect and surfaced as the Route.php:525 view fatal.
|
|
86
|
+
Added the `2026-06-16a` Core migration registering `DatabaseHosts` for the stage/demo/qa-*/qc-*
|
|
87
|
+
all-in-one environments, and created the matching `Config/*.ini` files. (jcardinal)
|
|
88
|
+
|
|
89
|
+
## Related docs
|
|
90
|
+
- `2.0/apps/api2/architecture.md` — host dispatch, transaction/logging boundary.
|
|
91
|
+
- `2.0/apps/_underscore/architecture.md` — environment→host table, DB resolution, boot sequence.
|
|
92
|
+
- `2.0/apps/api2/workflows/codepipeline-codeconnections-deploy.md` — deploy pipeline.
|
package/knowledge/INDEX.md
CHANGED
|
@@ -16,7 +16,7 @@ _Auto-generated by `knowledge.js index`. Do not hand-edit._
|
|
|
16
16
|
|
|
17
17
|
- **_underscore** (_Underscore) _(framework core)_ — 7 doc(s) → [2.0/apps/_underscore/INDEX.md](2.0/apps/_underscore/INDEX.md)
|
|
18
18
|
- **worker2** (Worker) — 6 doc(s) → [2.0/apps/worker2/INDEX.md](2.0/apps/worker2/INDEX.md)
|
|
19
|
-
- **api2** (API) —
|
|
19
|
+
- **api2** (API) — 3 doc(s) → [2.0/apps/api2/INDEX.md](2.0/apps/api2/INDEX.md)
|
|
20
20
|
- **dbchanges2** (Database Changes) _(framework core)_ — 1 doc(s) → [2.0/apps/dbchanges2/INDEX.md](2.0/apps/dbchanges2/INDEX.md)
|
|
21
21
|
- **toga2-supply** (TOGa Supply) — 2 doc(s) → [2.0/apps/toga2-supply/INDEX.md](2.0/apps/toga2-supply/INDEX.md)
|
|
22
22
|
- **saml** (SAML SSO Gateway) — 2 doc(s) → [2.0/apps/saml/INDEX.md](2.0/apps/saml/INDEX.md)
|
package/package.json
CHANGED