Node-RED: 4. Create the service
This documentation is part of the Automate with the CLI guide. View the full guide here: Start Node-RED, retrieve its credentials, and change its configuration programmatically with the Stackhero CLI.
Welcome to the Stackhero documentation
Stackhero provides a fully managed Node-RED cloud environment designed to get you building workflows quickly:
- Built-in MQTT server (Mosquitto) for seamless IoT integration.
- Full access to the Node-RED admin UI for managing flows and settings.
- Node-RED Dashboard included for real-time visualization.
- Dedicated SMTP email server included, with no limits on sending.
- Effortless one-click updates to keep your instance current.
- Custom domain names with automatic HTTPS: for example, https://node-red.your-company.com.
- High performance and strong security with private, dedicated infrastructure.
You can have a secure, production-ready Node-RED cloud hosting instance running in about 5 minutes. Stackhero handles setup, updates, and infrastructure so you can focus on building automations.
Here 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 running (this may take a couple of minutes)
stackhero service-wait-for --service="node-red"
# Retrieve the service configuration, including generated credentials
stackhero service-configuration-get --service="node-red" --format=json