Portainer icon

Portainer

Trabalhe com dados da API do Portainer para gerenciar Docker

Overview

This node integrates with the Portainer API to manage edge computing stacks ("Edge Stacks"). Specifically, the Create operation for the Edge Stack resource allows users to create a new edge stack deployment. Edge stacks are collections of containerized services deployed across one or more edge groups (clusters of edge devices or endpoints).

Typical use cases include:

  • Deploying containerized applications to distributed edge environments.
  • Managing deployments using different orchestrators like Docker Compose, Docker Swarm, or Kubernetes.
  • Automating edge stack creation as part of CI/CD pipelines or infrastructure provisioning workflows.

For example, you can create an edge stack named "MyEdgeApp" that deploys a Docker Compose file to edge groups with IDs 1, 2, and 3, specifying environment variables and deployment preferences such as pre-pulling images or retrying failed deployments.

Properties

Name Meaning
Edge Stack Name The name of the edge stack to be created.
Edge Group IDs Comma-separated list of IDs of edge groups where the stack will be deployed (e.g., "1,2,3").
Deployment Type The type of deployment orchestrator to use. Options: 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) defining the services and configuration.
Environment Variables A collection of environment variables (name-value pairs) to set for 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 configuration metadata.

No binary data output is involved in this operation.

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.
  • The node sends HTTP POST requests to the /edge_stacks endpoint of the Portainer API.

Troubleshooting

  • Invalid or missing API key: Ensure the API key credential is correctly configured and has sufficient permissions to create edge stacks.
  • Malformed stack file content: The stackFileContent must be valid YAML/Compose format; invalid syntax may cause API errors.
  • Incorrect edge group IDs: Provide valid numeric IDs separated by commas; invalid or non-existent IDs will cause deployment failure.
  • Deployment type mismatch: Use one of the supported deployment types (Docker Compose, Docker Swarm, Kubernetes). Using unsupported values may result in errors.
  • Network connectivity issues: Verify that n8n can reach the Portainer API endpoint.
  • API rate limits or server errors: If the Portainer API returns errors, check logs and retry if necessary.

Common error messages usually come directly from the Portainer API and should be interpreted accordingly.

Links and References

Discussion