This project contains a Docker Compose configuration file and documentation for setting up a Node-RED based project in a container. It is setup to create a Node-Red app in production and additionally, a Mosquitto container in development.
To get started with this project, follow the steps below:
- Install Docker on your machine if you haven't already.
- Clone this repository to your local machine.
- Navigate to the project directory.
Once the container is started, you can access the NodeRed environment on localHost:1880/
. If in development mode, you can access the MQTT broker on localHost:1883
To start the environment in development mode run the following command:
docker-compose up -d --build
This command will start the NodeRed and Mosquitto containers in detached mode, allowing it to run in the background.
To start the enviroment in production mode run the following command, where XXXX is the desired port to access node-red in production (this assumes it is being run in a linux environment):
NODE_RED_PORT=XXXX docker-compose -f "docker-compose.yml" up -d --build
$env:NODE_RED_PORT="XXXX"; docker-compose up -d
This command will start only the NodeRed container in detached mode.
We want to avoid ports for common protocols (0-1023) and stay in the user ports section (1024-49151), however, many of the "user ports" have been attached to common services (node-red: 1880, mqtt: 1883). According to this stackoverflow, the range 29170-29998 has the most open ports in sequence
Once the container is running, you can access the Node-RED interface by opening a web browser and navigating to http://localhost:1880
.
To stop the Node-RED container, run the following command:
docker-compose down
This command will stop and remove the container.
The Docker Compose configuration file docker-compose.yml
defines the services, networks, and volumes for the Docker project. Here is an overview of the configuration:
version: '3'
services:
node-red:
image: nodered/node-red
ports:
- 1880:1880
volumes:
- ./data:/data
The node-red
service uses the nodered/node-red
image and exposes port 1880
. It also creates a volume named data
that maps to the ./data
directory in the project.
This project is currently unlicensed.