Portainer icon

Portainer

Trabalhe com dados da API do Portainer para gerenciar Docker

Overview

This node integrates with the Portainer API to manage Edge Stacks, specifically allowing you to update an existing Edge Stack configuration. Edge Stacks are used in edge computing environments to deploy containerized applications across multiple edge groups (clusters of edge devices or endpoints).

The "Update" operation for Edge Stack lets you modify the stack's deployment details such as the Docker Compose or stack file content, target edge groups, environment variables, and deployment options like pre-pulling images or retrying deployments on failure.

Common scenarios:

  • Updating the application services running on edge devices by changing the Docker Compose stack file.
  • Changing which edge groups receive the stack deployment.
  • Adjusting environment variables for the stack without redeploying manually.
  • Enabling pre-pull of images to speed up deployment or enabling retry logic to improve reliability.

Practical example:
You have a web service deployed via an Edge Stack to several edge groups. You want to update the service image version and add new environment variables. Using this node, you provide the updated stack file content, specify the edge group IDs, and set the environment variables. The node sends the update request to Portainer, which applies the changes across the specified edge groups.


Properties

Name Meaning
Edge Stack ID The unique identifier of the Edge Stack to update.
Edge Group IDs Comma-separated list of IDs of edge groups where the stack will be deployed.
Pre Pull Image Boolean flag indicating whether to pre-pull container images before deployment.
Retry Deploy Boolean flag indicating whether to retry deployment if it fails.
Stack File Content The content of the Docker Compose or stack file defining the services and configurations.
Environment Variables A collection of environment variables (name-value pairs) to set for the Edge Stack deployment.

Output

The node outputs the JSON response from the Portainer API after attempting to update the Edge Stack. This typically includes details about the updated stack resource, such as its ID, name, deployment status, and other metadata returned by the API.

No binary data output is involved in this operation.


Dependencies

  • Requires an active connection to a Portainer instance with API access.
  • Needs an API key credential configured in n8n to authenticate requests to the Portainer API.
  • The base URL of the Portainer API must be configured in the credentials.

Troubleshooting

  • Invalid Edge Stack ID: If the provided Edge Stack ID does not exist or is incorrect, the API will return an error. Verify the ID is correct.
  • Malformed Stack File Content: Errors can occur if the Docker Compose or stack file content is invalid YAML or contains unsupported configurations. Validate the stack file syntax before updating.
  • Edge Group IDs Format: Ensure the edge group IDs are provided as comma-separated integers without extra spaces or invalid characters.
  • Authentication Errors: If the API key is missing or invalid, authentication will fail. Confirm the API key credential is correctly set up.
  • Network Issues: Connectivity problems to the Portainer API endpoint will cause request failures. Check network access and firewall settings.
  • Permission Denied: The API user must have sufficient permissions to update Edge Stacks. Lack of permissions will result in authorization errors.

Links and References

Discussion