fix(deploy): match MIE Container Manager v1 request/response shapes#56
Merged
Conversation
After the /api/v1 base fix, the deploy reached the manager but failed on the
redesigned v1 contract ("jq: Cannot iterate over null" on .sites[]). Verified
the real v1 shapes against the live API and the manager's own web client, and
remapped every call:
- Responses are wrapped in a {"data": ...} envelope:
- GET /sites -> .data[].id
- GET .../containers/new -> .data.externalDomains[] (id, name)
- GET .../containers -> .data[].id / .data[].status / .data[].httpEntries[0].externalUrl
- GET /jobs/{id} -> .data.status (success value is "success")
- Create body: `template` (not `template_name`); `services` is an ARRAY of flat
objects ({type, internalPort, externalHostname, externalDomainId, authRequired}),
matching what the manager UI POSTs; environmentVars stays an array of {key,value}.
- Create response job id read tolerantly: .data.jobId // .data.creationJobId // .data.id.
Verified read-only against the live manager API: site 1 resolves, os.mieweb.org
domain id = 1, existing twh-api container id = 380, status = running, url =
https://twh-api.os.mieweb.org. bash -n passes. The create POST is the only
unexercised path; on any shape mismatch the manager returns a secret-free
validation error that the script logs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After PR #55 fixed the API base (
/api/v1), the deploy reached the manager but failed on the redesigned v1 contract:The v1 API wraps every response in a
{ "data": ... }envelope and restructured the container payloads, so the old.sites[]/.containers[]/template_name/.jobIdpaths no longer resolve.What I verified
Probed the live manager API (
/api/openapi.json+ real responses) and read the manager's own SPA submit code to get the exact shapes:GET /sites.data[].idGET /sites/{id}/containers/new.data.externalDomains[](id,name) —/external-domainsis admin-onlyGET /sites/{id}/containers.data[].id,.data[].status("running"),.data[].httpEntries[0].externalUrlGET /jobs/{id}.data.status(success value ="success")POST /sites/{id}/containersbodytemplate:<image>(nottemplate_name);servicesis an array of flat objects{type,internalPort,externalHostname,externalDomainId,authRequired};environmentVarsarray of{key,value}.data.jobId(tolerant fallbacks)Verification
Read-only checks against the live manager API all pass:
1resolves;os.mieweb.orgdomain id =1; existingtwh-apicontainer id =380;status = running; url =https://twh-api.os.mieweb.org.bash -npasses; create payload renders exactly like the manager UI's POST body.The create
POSTis the only path that can't be exercised without an actual deploy; it's grounded in the manager's own client code, and on any residual mismatch the manager returns a secret-free validation error that the script logs (no env vars are printed).Merging this to
mainre-triggers the deploy. No secret change required.🤖 Generated with Claude Code