Edit a Compose stack's file
PUT/stacks/:name
Required role: admin. Only an account or token with the admin role can call this operation.
curl --request PUT \
--header "Authorization: Bearer $HOSERVA_TOKEN" \
--header "Content-Type: application/json" \
--data @body.json \
"https://$HOSERVA_HOST:8008/api/v1/stacks/{name}"
Replaces the stack's docker-compose.yml text. The text is first checked with docker compose config against a copy of the stack's own .env, in a temporary directory, before anything is stored or written: a file that is empty or that docker compose config rejects is refused with 400 invalid_stack, carrying the compiler's message, and leaves the row and every file as they were. With dryRun a valid file is answered with applied false and the stored stack, and nothing is changed. Otherwise the row is updated (the new text, and manuallyEdited set so a template form never silently overwrites it) and the stack's docker-compose.yml is regenerated from it; if writing the file fails the row is put back as it was. Nothing is restarted: startStack makes the edit take effect. A stack whose .env cannot be opened (a restore without the backup passphrase) cannot be checked and is refused. An unknown stack is refused with 404 stack_not_found and a name that is not a valid stack name with 400 invalid_stack_name.
Request
Responses
- 200
- default
The text is valid.
An error response.