Create, update or delete Services or Volumes belonging to a Stack
PATCH/stacks/ {stackId}/
v2
PATCH
container-update-stack
Request
Responses
Usage examples
- cURL
- JavaScript SDK
- PHP SDK
$ curl \
--fail \
--location \
-X PATCH \
-d '{"services":{"string":{"command":["mysqld"],"description":"MySQL DB","entrypoint":["docker-entrypoint.sh"],"envs":{"MYSQL_DATABASE":"my_db","MYSQL_PASSWORD":"my_password","MYSQL_ROOT_PASSWORD":"my_root_password","MYSQL_USER":"my_user"},"image":"mysql","ports":["3306:3306/tcp"],"volumes":["data:/var/lib/mysql"]}},"volumes":{"string":{"name":"mysql-volume"}}}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/stacks/f0f86186-0a5a-45b2-aa33-502777496347
import { MittwaldAPIV2Client } from "@mittwald/api-client";
import { assertStatus } from "@mittwald/api-client-commons";
const client = MittwaldAPIClient.newWithToken(process.env.MITTWALD_API_TOKEN);
const response = await client.container.updateStack({
"stackId": "f0f86186-0a5a-45b2-aa33-502777496347",
"data": {
"services": {
"string": {
"command": [
"mysqld"
],
"description": "MySQL DB",
"entrypoint": [
"docker-entrypoint.sh"
],
"envs": {
"MYSQL_DATABASE": "my_db",
"MYSQL_PASSWORD": "my_password",
"MYSQL_ROOT_PASSWORD": "my_root_password",
"MYSQL_USER": "my_user"
},
"image": "mysql",
"ports": [
"3306:3306/tcp"
],
"volumes": [
"data:/var/lib/mysql"
]
}
},
"volumes": {
"string": {
"name": "mysql-volume"
}
}
}
});
assertStatus(response, 200);
use \Mittwald\ApiClient\Generated\V2\Clients\Container\UpdateStack\UpdateStackRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\Container\UpdateStack\UpdateStackRequestBody;
$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));
// TODO: Please consult the properties and constructor signature of
// UpdateStackRequestBody to learn how to construct a valid instance
$body = new UpdateStackRequestBody(/* TODO: ... */);
$request = (new UpdateStackRequest(
stackId: "f0f86186-0a5a-45b2-aa33-502777496347",
body: $body
));
$response = $client->container()->updateStack($request);
var_dump($response->getBody();