Node-RED Projects Feature Setup¶
Problem: Projects Feature Not Showing in UI¶
The Node-RED Projects feature was not appearing in the UI because of a fundamental conflict between two deployment approaches:
Conflicting Approaches¶
- Ansible Git Deployment (was enabled):
- Clones Git repository directly into
~/.node-red/ - Manages the entire directory as a Git repo
-
Controlled by
node_red_project_enabled: truein ansible -
Node-RED Projects UI (what we want):
- Node-RED manages Git repos in
~/.node-red/projects/<project-name> - Users create/clone projects via the UI
- Enabled by
editorTheme.projects.enabled: truein settings.js
These two approaches cannot coexist! When ~/.node-red is already a Git repository, Node-RED's Projects UI won't work properly.
Solution¶
1. Configuration Changes Made¶
a) Settings.js - Enable Projects Feature¶
Added to node-red/settings.js:
editorTheme: {
projects: {
enabled: true,
workflow: {
mode: "auto"
}
}
}
b) Environment Variable - Enable Projects¶
Added to ansible/roles/node_red/templates/nodered-env.j2:
NODE_RED_ENABLE_PROJECTS=true
c) Disable Ansible Git Deployment¶
Changed in ansible/roles/node_red/defaults/main.yml:
node_red_project_enabled: false # Was: true
2. Deploy the Changes¶
# Deploy to a test device first
task deploy-device DEVICE=rpi-dev-001 PLAYBOOK=provision.yml
# Or update just Node-RED config
ansible-playbook ansible/playbooks/provision.yml -i ansible/inventory/production/hosts.yml --limit rpi-dev-001 --tags node_red
3. Clean Up Existing Git Repository (if needed)¶
If a device already has ~/.node-red as a Git repo, you'll need to clean it up:
# SSH to the device
task ssh DEVICE=rpi-dev-001
# On the device:
cd ~/.node-red
# Remove git repository (keep the files)
rm -rf .git
# Remove git-related files
rm -f .gitignore .gitattributes
# Restart Node-RED
sudo systemctl restart nodered
4. Using Node-RED Projects UI¶
Once deployed and cleaned up, access the Node-RED editor:
- Open:
https://rpi-dev-001-nodered.tagai.uk - You should see a welcome screen to create your first project
- Click "Create a project" and follow the wizard:
- Set your Git username and email
- Name your project (e.g., "gaisro-technika-flows")
- Choose to create new or clone existing repository
- Set encryption key for credentials file
Clone Your Existing Repository¶
To use your existing gaisro-technika-nodered repository:
- In Projects UI, select "Clone Repository"
- Use SSH URL:
ssh://git@github.com/mbTagai/gaisro-technika-nodered - Note: GitHub SSH URLs need
ssh://prefix for Node-RED - Select your SSH key:
/home/pi/.ssh/id_rsa - The project will be cloned to
~/.node-red/projects/gaisro-technika-nodered
Requirements¶
The Projects feature needs these tools (already installed by ansible):
- ✅ git - version control
- ✅ ssh-keygen - SSH key management
- ✅ SSH keys configured (~/.ssh/id_rsa)
Features You Get¶
With Projects enabled:
- 📦 Version Control - Git integration built into the UI
- 🔄 Commit & Push - Manage changes via the editor
- 🌿 Branch Management - Switch branches, create new ones
- 📜 History View - See commit log and diffs
- 🔐 Credential Encryption - Secure your credentials with a key
- 📚 Dependencies - Manage
package.jsonvia UI - 🚀 Multiple Projects - Switch between different projects
Deployment Workflows¶
Option A: Use Projects UI (Recommended)¶
Pros: - Users can manage flows via Git in the UI - No ansible deployment needed for flow updates - Full Git workflow (commit, branch, push/pull)
Cons: - Each device manages its own repository - Need to clone the project on each device - No centralized ansible-controlled deployment
Option B: Use Ansible Git Deployment¶
Pros: - Centralized control via ansible - One command deploys to all devices - Consistent versions across fleet
Cons: - Projects UI won't work - Users can't use Git features in the editor - Manual git operations only
Option C: Hybrid Approach¶
Use ansible to deploy base settings.js and certificates, but let users manage flows via Projects UI:
# In ansible/roles/node_red/defaults/main.yml
node_red_project_enabled: false # Don't manage flows via ansible
# In ansible playbooks:
# - Deploy settings.js (with projects enabled)
# - Deploy MQTT certificates
# - Install dependencies
# - Users manage flows via Projects UI
Troubleshooting¶
Projects Menu Not Showing¶
- Check settings.js has
editorTheme.projects.enabled: true - Check environment has
NODE_RED_ENABLE_PROJECTS=true - Restart Node-RED:
sudo systemctl restart nodered - Clear browser cache and reload
"Not a Git Repository" Error¶
This happens if ~/.node-red is already a Git repo:
cd ~/.node-red
rm -rf .git
sudo systemctl restart nodered
Can't Clone Repository¶
Check SSH key authentication:
ssh -T git@github.com
# Should say: "Hi mbTagai! You've successfully authenticated"
Projects Directory Structure¶
Correct structure when using Projects:
~/.node-red/
├── settings.js # Node-RED settings
├── package.json # Base dependencies
├── environment # Environment variables
├── mqtt/ # MQTT certificates
│ ├── ca.crt
│ ├── client.crt
│ └── client.key
└── projects/ # Projects managed by Node-RED
└── gaisro-technika-nodered/ # Your project
├── .git/
├── flows.json
├── flows_cred.json
├── package.json
└── README.md
Migration Strategy¶
For existing devices with ansible-managed Git deployment:
-
Backup current flows:
task ssh DEVICE=rpi-001 cp ~/.node-red/flows.json ~/flows.json.backup -
Clean up Git repository:
cd ~/.node-red rm -rf .git .gitignore -
Redeploy with new settings:
task deploy-device DEVICE=rpi-001 PLAYBOOK=provision.yml -
Create project in UI:
- Clone your repository via Projects UI
-
Or copy flows manually to new project
-
Verify:
- Check Projects menu appears
- Test Git operations in UI
- Confirm MQTT connectivity still works