nodejs / node-red

Victor-Zorro

Cadet
Joined
Oct 30, 2020
Messages
9
Hi There,

I am testing truenas scale as a vm. I am planning to replace my existing Cent OS wit truenas scale.
Since I can delete a layer of os in my setup. I will run several vm's. I use Node-Red, to integrate into my home automation.
I am really happy so far with what I've seen of scale! Like the pass-through option of devices to vm's

Node red will start my workstation vm with the command "virsh start windows10"
and some ubuntu test vm's etc...

So far, I managed to install nodeJS:

sudo apt update
sudo apt install nodejs npm

and then node-red with:
npm install -g --unsafe-perm node-red

Witch is convenient! Because Now I can start stop vm's through my touch screen workspace control.
The control can also shutdown my server with ipmi tool. To save energy when I am not working.

Questions: will those packages be deleted after each update? and to what folder are packages installed? default debian is usr/bin but not here..
And. I noticed ha apt upgrade does work to, would this be harmful? Or will this be the way to also update Truenas?
 

ornias

Wizard
Joined
Mar 6, 2020
Messages
1,458
will those packages be deleted after each update?
Yes

and to what folder are packages installed?
No idea, you shouldn't install directly on the NAS anyway, not something like nodeJS for sure.
You can create a node-red contrainer and have it run a command on the host (for example ssh into the host with a private key and a limited user)

And. I noticed ha apt upgrade does work to, would this be harmful?
It might actually break stuff or create bugs

Or will this be the way to also update Truenas?
NO IT IS NOT AND WILL NEVER BE.
There is a nice big gui update button in the... gui ;-)
 

morganL

Captain Morgan
Administrator
Moderator
iXsystems
Joined
Mar 10, 2018
Messages
2,694
There are also APIs in TrueNAS SCALE to start and stop VMs. They would also let you do the same automation.
 

Victor-Zorro

Cadet
Joined
Oct 30, 2020
Messages
9
Hi!

Ok, how would that work? I tried the nod-red with ssh and rca key, that will work. Is there more information about those api's?
What i like about the node setup i use, is that I can pass through any vm name in an mqtt message. There are only two options. to start or to shutdown. So it is quiet safe.

For me as a not being programmer....
btw I will use a spare media server in the holidays to advance test the pass-through of graphics in scale and other things.... Is there any way I can help? reporting findings? testing things?
 

ornias

Wizard
Joined
Mar 6, 2020
Messages
1,458
If you ask on the slack I think a dev will give you the propper synthaxis within a day or two.
Not a fan of bothering them, but the API is not yet very well documented so they won't mind.^^

And if you are able to setup node-red with the ssh and rca tactic, you are already byond the average user in terms of skill. So don't worry too much about it :)
 

inman.turbo

Contributor
Joined
Aug 27, 2019
Messages
149
Ok, how would that work? I tried the nod-red with ssh and rca key, that will work. Is there more information about those api's?
If you go to settings cog in upper right>api keys> docs you will see that your truenas SCALE api is running swagger, and you should be able to find everything you need in there.
 

Victor-Zorro

Cadet
Joined
Oct 30, 2020
Messages
9
Thanks! This works, I got it working in node-red in 5 minutes using the curl command.
To use the swagger I need to figure out how to authenticate. (in node-red) But I Already can move on!
Thanks a lot! I look forward to start with the beta...
 

inman.turbo

Contributor
Joined
Aug 27, 2019
Messages
149
Not a fan of bothering them, but the API is not yet very well documented so they won't mind
The there is documentation running right on the host. It is running swagger! :grin::grin:. Absolutely love it! It's a dev's dream.
 
Last edited:
Top