Actions72
- Image Actions
- Network Actions
- Node Actions
- Registry Actions
- Secret Actions
- Service Actions
- Stack Actions
- Team Actions
- Template Actions
- User Actions
- Volume Actions
- Webhook Actions
- Config Actions
- Container Actions
- Edge Group Actions
- Edge Stack Actions
Overview
This node integrates with the Portainer API to manage Docker Swarm services, specifically allowing users to scale an existing service. The "Scale" operation adjusts the number of replicas for a given Docker Swarm service, enabling dynamic scaling of containerized applications.
Common scenarios where this node is beneficial include:
- Automatically increasing or decreasing the number of service instances based on load.
- Managing resource allocation by scaling services up or down.
- Integrating scaling actions into automated workflows or CI/CD pipelines.
For example, you could use this node to scale a web service from 2 to 5 replicas during peak traffic hours and then scale back down during off-peak times.
Properties
| Name | Meaning |
|---|---|
| Environment ID | The ID of the Portainer environment/endpoint where the Docker service is running. |
| Service ID | The unique identifier of the Docker Swarm service to be scaled. |
| Replicas | The desired number of replicas (instances) for the service after scaling. |
| Version | The current version number of the service object, required for update concurrency control. |
Output
The node outputs JSON data representing the response from the Portainer API after attempting to scale the service. This typically includes details about the updated service state, such as its new replica count and metadata confirming the successful update.
No binary data output is involved in this operation.
Dependencies
- Requires a valid connection to a Portainer instance with API access.
- An API key credential must be configured in n8n to authenticate requests to the Portainer API.
- The Portainer environment/endpoint must be accessible and properly identified by the Environment ID.
Troubleshooting
- Version Mismatch Error: If the provided
Versionparameter does not match the current version of the service in Portainer, the API will reject the update. To fix this, retrieve the latest service version before scaling. - Invalid Service ID: Providing an incorrect or non-existent Service ID will result in a "not found" error. Verify the Service ID is correct.
- Insufficient Permissions: Ensure the API key used has permissions to update services in the specified environment.
- Network Issues: Connectivity problems between n8n and the Portainer API endpoint can cause request failures. Check network accessibility and firewall settings.