I see some long stacktraces coming from balena-engine (docker) in the journal logs. We will follow up with more information soon on that.
Thanks,
Zahari
I see some long stacktraces coming from balena-engine (docker) in the journal logs. We will follow up with more information soon on that.
Thanks,
Zahari
The device eventually switched to the new release. Your container produces the following error now:
root@f8c5a2f:~# cat /mnt/data/docker/overlay2/b812bfa6508c57fb057a07217b02fbc0b6c18abfa122f15cd933fea5ae3c1e10/diff/root/.npm/_logs/2019-10-01T11_59_06_704Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm@6.10.0
3 info using node@v12.7.0
4 verbose stack Error: missing script: start
4 verbose stack at run (/usr/local/lib/node_modules/npm/lib/run-script.js:155:19)
4 verbose stack at /usr/local/lib/node_modules/npm/lib/run-script.js:63:5
4 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:115:5
4 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:418:5
4 verbose stack at checkBinReferences_ (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:373:45)
4 verbose stack at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:416:3)
4 verbose stack at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:160:5)
4 verbose stack at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:364:12
4 verbose stack at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:90:16
4 verbose stack at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:61:3)
5 verbose cwd /usr/src/app
6 verbose Linux 4.19.66
7 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
8 verbose node v12.7.0
9 verbose npm v6.10.0
10 error missing script: start
11 verbose exit [ 1, true ]
Yeah, I tried switching off the delta updates as I thought that could be why it kept reverting. The reason the error changed is because I tried changing the CMD line from
CMD ["bash", "/usr/src/app/start.sh"]
to
CMD ["npm", "start"]
as this is the CMD line shown in this article.
I’ve run the diagnostics tool on the dashboard and it says “slow disk writes detected”. That would explain the problems with delta downloads as it looks like there are issues with the SD card (not uncommon). In general we recommend using SD cards like SanDisk Extreme Pro, since a lot of the cheaper ones are not very reliable. What is the model you are using?
It is a kingston 16gb Micro SDHC
I have a few of those as well and never experienced issues, but it happens. Do you have another SD card to try out?
As for the nodejs error, I think the scripts
/start
entry in your config.json needs adjustment - to point to the proper JS file.
Sorry, in package.json
is what I meant.
Okay, this is my current package.json:
{
"name": "MSAT-EC-Twinfan",
"description": "A Node-RED Project",
"version": "0.0.1",
"dependencies": {
"node-red-contrib-azure-iot-hub": "0.4.0",
"node-red-contrib-frequency-meter": "0.0.1",
"node-red-contrib-ibm-watson-iot": "0.2.8",
"node-red-contrib-os": "0.1.7",
"node-red-dashboard": "2.16.3",
"node-red-contrib-simpletime": "2.7.0"
},
"node-red": {
"settings": {
"flowFile": "flows_MSAT-Master_EC-Twinfan.json",
"credentialsFile": "flows_MSAT-Master_EC-Twinfan_cred.json"
}
}
}
What should I add to this?
The only startup script I have is the one copied from here
I think you need to revert to the old behavior with executing bash
instead of npm
. The problem as I saw earlier on was that the node-red
launcher was not found on the filesystem path. If you re-push the older dockerfile that was executing bash at the end, I can check why it was not exactly running.
Okay I’ll add that back in justnow.
It appears to have started the node-red successfully this time, but as far as I can tell it isn’t running my flows.
My flow file is called flows_MSAT-Master_EC-Twinfan.json. This is where it sits in the local git Repo on my master device:
This is my current start.sh script:
#!/bin/bash
# Make the default flows available in the user library
mkdir -p /data/node-red/user/lib/flows || true
cp /usr/src/app/* /data/node-red/user/lib/flows/
# Start app
DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket node-red --settings
/usr/src/app/settings.js
I’m not sure what to change to get it to use my flows file.
I tried changing the cp /usr/src/app/*
to usr/src/app/flows_MSAT-Master_EC-Twinfan.json
but it doesn’t appear to have worked.
Hi,
I’m not an expert in node-red, but it seems like the user directory is set to be /root/.node-red
, but this should be overwritten in the settings.js
. So there might be something wrong with how node is started or how settings.js is provided.
Is there anyway that I can auto copy my flows to this file? Or would this be more difficult as its using the hostname in the filename?
It looks like those need to be specified in the settings.js
file that is passed as an argument to node-red
.
Okay, in the settings.js file I’ve set flowFile: 'flows_MSAT-Master_EC-Twinfan.json'
and userDir: '/usr/src/app/'
This seems to have changed the flow file, but it’s now saying this:
Do you know if /usr/src/app is the right path? I don’t know where my flow files are sitting on the container. How do I check? I assume they are transferred over as part of the dockerfiles process?
In the Dockerfile of the application you are probably setting WORKDIR /usr/src/app
. This changes the working directory to that folder, so that later on when you execute node-red
down below, it is executed from that folder location. I think this looks alright and it is executed from the right location.
Now I am not 100% sure the right approach would be to change userDir. Maybe it is better to copy the flow file into the default location - $HOME/.node-red
, which should be /root/.node-red
, but I guess both are fine as long as everything is running well.
I see in your logs that node-red UI is run on 127.0.0.1, where most probably it needs to be run on 0.0.0.0 if you want to access it from another computer on the same network.
FYI
The branch issue_23
of my github repository https://github.com/janvda/balena-pulseaudio/tree/issue_23 covers a very recent balena installation of Node-RED.
It is using the very latest image (node-red version 1.0.0) which is not more than a day old (I think).
The 3 files that matter for node-red installation:
Take care that this is work in progress - so the respective files will be updated in the future.
Thanks for sharing @janvda!
Hi @majorz, I think I’m already copying the flow files over to the working directory with COPY . ./
I don’t need access to the node-red on the remote devices as they are running in remote locations.
I tried to add in the missing items to my Dockerfile and it appeared to be working - I was doing one at a time to see if they would disappear. However, I tried pushing an update this morning and it keeps downloading and reverting over and over. What do I to fix this?
Thanks,
Gregor
Thanks for the links to your Repo, my main question is to do with the directory set up. My node-red projects has created the flows etc in the root directory folder as seen in the screenshot above. Whereas you have other sub-directories such as Node-red, pulseaudio-client-test etc. I also can’t seem to find your node-red flow files?