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 scenarios where containerized applications or services are deployed across distributed 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.

Practical examples:

  • Updating a running edge stack to deploy a new version of your application by changing the Docker Compose file.
  • Changing which edge groups receive the stack deployment.
  • Adding or modifying environment variables used by containers in the stack.
  • Enabling pre-pull of images to speed up deployment or enabling retry logic to improve reliability.

This node is beneficial for DevOps teams managing distributed container workloads at the edge, enabling automated updates and management through workflows.

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 containers.

Output

The node outputs the JSON response from the Portainer API after updating the edge stack. This typically includes details about the updated stack resource, such as its ID, name, deployment status, and configuration metadata.

If the API returns binary data (not typical for this operation), it would represent raw response content, but generally, the output is structured JSON describing the updated edge stack.

Dependencies

  • Requires access to a Portainer instance with API enabled.
  • Requires an API key credential configured in n8n to authenticate requests to the Portainer API.
  • The base URL of the Portainer API must be provided in the credentials.
  • Network connectivity to the Portainer server.

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.
  • Permission Denied: Ensure the API key has sufficient permissions to update edge stacks.
  • Edge Group IDs Format: The edge group IDs must be comma-separated integers. Incorrect formatting may cause request failures.
  • API Connectivity Issues: Check network connectivity and that the Portainer API endpoint is reachable.
  • Retry Deploy Flag: Setting retryDeploy to true enables automatic retries on deployment failure; however, persistent failures may require manual intervention.

Links and References

Discussion