Test livepush change

Hello everyone,

I was a bit trying the livepush function and I created the dockerfile, the javascript file and the package.json based on the getting started of the balenaOS (link).

The moment in the main.js file I have the simple print with “console.log” and I go to modify the print on video, the livepush detects the change in the file but then in the stream log of the push it results the printing but not altered, like if I had not actually modified anything.

Is it normal or wrong for me to do something?

Thanks in advance.

Hi @mordred,

I’m not sure I follow exactly what you are seeing. Are you pushing the “a simple hello world webserver”, outlined here: https://www.balena.io/os/docs/raspberrypi3/getting-started/#Creating-a-Project-from-Scratch ? If not, can you please paste some examples of what you’re seeing that you believe is incorrect?

Hi @xginn8,

Sorry for my somewhat crude explanation, I try to explain myself a little better.

Initially I followed the tutorial you linked.
The moment I just get to the main.js file with only the “console.log ()” line in it, I simply tried to change the writing inside and realized that the “livepush” feature exists because the process of log showed that he had detected changes in the project files.

Then I read some of the livepush function from the link https://www.balena.io/blog/living-on-the-edge-with-livepush-and-other-cli-improvements/.

At this point, trying to better understand how this feature works, I realized that even if I modified the writing inside console.log the process detected the changes, but did not change the writing then output on the log stream with the new modification.

I wanted to understand if it was a normal thing that the process once the changes in the text of the console.log () function were detected did not show the new text in the log stream. And consequently if it needs a following project push.

Hey @mordred it’s entirely possible that you’re hitting a bug in livepush, but it’s hard to say without seeing your code. Could you paste the Dockerfile and app.js you mentioned please?

Hi @CameronDiver,

Of course

Dockerfile:

FROM balenalib/raspberrypi3-alpine-node
WORKDIR /usr/src/app
COPY package.json package.json
RUN npm install
COPY . .
CMD ["node", "main.js"]

main.js:

console.log("Hey… ");

If I modify console.log() the process notices the change (as seen from the log stream) and when the container restarts the text inside console.log () is the one before the change.

@mordred I tested the code that you sent and it worked with one minor change - because livepush works with a running container, things break if the container has stopped, so once the main.js file finishes executing, livepush has problems updating it:

[Live]    Detected changes for container main, updating...
[Logs]    [2019-9-9 15:21:35] Service exited 'main sha256:d297aa67ffb30a2613b4fffcc197b51a2b6e02f31962112df00937d0d804e0cd'
[Error]   An error occured whilst trying to perform a livepush: 
[Error]      (HTTP code 409) unexpected - Container 085e7c594f67e9f04d2378acb189382bc3f052f696d49fcd8161c91306e312ae is restarting, wait until the container is running 

I changed the main.js code to

setInterval(() => console.log("Hello"), 1000);

And changing when changing that file, the changes are correctly synced across and the container restarts with the new source. If this isn’t the problem for you, could you paste the output of balena push for me please?

@CameronDiver, I adjusted the console.log to yours. Pushing everything ok. The moment I go to change “Hello” into “Hello There” I get the following log stream:

[Logs]    [2019-9-10 10:29:09] [main] Hello
[Live]    Detected changes for container main, updating...
[Logs]    [2019-9-10 10:29:10] [main] Hello
[Error]   An error occured whilst trying to perform a livepush: 
[Error]      ENOENT: no such file or directory, lstat '.goutputstream-4LFQ7Z'
[Logs]    [2019-9-10 10:29:11] [main] Hello
[Logs]    [2019-9-10 10:29:12] [main] Hello
[Logs]    [2019-9-10 10:29:13] [main] Hello
[Logs]    [2019-9-10 10:29:14] [main] Hello

It seems that something is creating temporary files in your project directory, which livepush tries to sync and they are removed before that occurs.

This thread seems to imply that they are created in your home directory: https://askubuntu.com/questions/151101/why-are-goutputstream-xxxxx-files-created-in-home-folder - is this where you’re pushing from?

I’ve created an issue to track this on the livepush repository https://github.com/balena-io-modules/livepush/issues/48, hopefully we can find a way to fix this more generally.

You should be able to avoid this by being more selective with your copy steps, for example instead of
COPY . . you could do COPY main.js . or COPY src/ . or COPY *.js . as you add more javascript files.

1 Like