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 in an edge computing environment. Specifically, the Create operation for the Edge Stack resource allows users to create a new edge stack deployment by specifying its configuration and deployment parameters.

Typical use cases include automating the deployment of containerized applications or services across multiple edge groups managed by Portainer. For example, you might use this node to deploy a Docker Compose stack to several edge locations simultaneously, ensuring consistent application delivery at the network edge.

Practical examples:

  • Deploying a web server stack (e.g., Nginx) to multiple edge groups for content delivery.
  • Rolling out IoT data processing services using Kubernetes manifests across distributed edge nodes.
  • Automating updates of edge stacks with environment-specific variables and retry logic on failure.

Properties

Name Meaning
Edge Stack Name The name of the edge stack to be created.
Edge Group IDs Comma-separated list of IDs representing the edge groups where the stack will be deployed.
Deployment Type The type of deployment platform:
- Docker Compose
- Docker Swarm
- Kubernetes
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 stack file (e.g., docker-compose.yml or Kubernetes manifest) defining the stack.
Environment Variables A collection of environment variables (name-value pairs) to be passed to the edge stack during deployment.

Output

The node outputs the JSON response from the Portainer API after creating the edge stack. This typically includes details about the newly created edge stack such as its ID, name, deployment status, and associated edge groups.

If the API returns binary data (not typical for this operation), it would represent raw response content, but this operation primarily deals with JSON data.

Dependencies

  • Requires access to a Portainer instance with API enabled.
  • Needs an API key credential configured in n8n to authenticate requests to the Portainer API.
  • The base URL of the Portainer API must be set in the credentials.
  • The node sends HTTP POST requests to the /edge_stacks endpoint of the Portainer API.

Troubleshooting

  • Invalid Edge Group IDs: If the provided edge group IDs are incorrect or do not exist, the API may return an error. Verify that the IDs are valid and accessible.
  • Authentication Errors: Ensure the API key credential is correct and has sufficient permissions to create edge stacks.
  • Malformed Stack File Content: The stack file content must be valid YAML or JSON depending on the deployment type. Invalid syntax will cause deployment failures.
  • Deployment Type Mismatch: Selecting an unsupported deployment type or providing incompatible stack file content can lead to errors.
  • Network Issues: Connectivity problems between n8n and the Portainer API will prevent successful creation.
  • API Rate Limits or Quotas: Excessive requests may be throttled; check Portainer API limits.

Common error messages usually come directly from the Portainer API and should be interpreted according to their HTTP status codes and message bodies.

Links and References


This summary is based on static analysis of the node's properties and routing configuration for the "Edge Stack" resource and "Create" operation within the bundled source code.

Discussion