Node-RED: 4. Create the service
This documentation is part of the Automate with the CLI guide. You can view the complete guide here: Start Node-RED, retrieve its credentials, and modify its configuration programmatically using the Stackhero CLI.
Welcome to the Stackhero documentation
Stackhero offers a fully managed Node-RED cloud environment designed to help you build workflows quickly:
- Integrated MQTT server (Mosquitto) for seamless IoT integration.
- Full access to the Node-RED admin interface for managing your flows and settings.
- Node-RED Dashboard included for real-time visualization.
- Dedicated SMTP email server included, with no sending limits.
- Effortless one-click updates to easily keep your instance up to date.
- Custom domain names with automatic HTTPS: for example, https://node-red.your-company.com.
- High performance and enhanced security thanks to private, dedicated infrastructure.
You can have a secure, production-ready Node-RED cloud hosting instance up and running in about 5 minutes. Stackhero takes care of installation, updates, and infrastructure so you can focus on building your automations.
Below is a sample script that creates a stack, adds your Node-RED service to it, waits for it to start, retrieves its configuration (including generated credentials), and then applies a new configuration.
#!/bin/bash
set -e
export STACKHERO_TOKEN="usr-xxxxxx:your-token"
serviceStore="node-red" # The Node-RED service store name (see step 2)
instance="..." # An instance size from step 3
region="europe" # A region name from step 3
# Create a stack for your service (uses your default organization; add --organization if needed)
stackId=$(stackhero --format=script stack-create \
--name="My Node-RED stack")
echo "Stack created: ${stackId}"
# Add Node-RED to the stack (names are resolved automatically)
serviceId=$(stackhero --format=script service-add \
--stack="My Node-RED stack" \
--service-store="${serviceStore}" \
--instance="${instance}" \
--region="${region}")
echo "Service added: node-red"
# Wait for the service to be fully operational (this may take a few minutes)
stackhero service-wait-for --service="node-red"
# Retrieve the service configuration, including generated credentials
stackhero service-configuration-get --service="node-red" --format=json