NebraLtd / hm-diag

Helium Miner Diagnostics
https://nebra.io/hnt
MIT License
21 stars 25 forks source link

Facilitate quicker off-line development on balena images #246

Open kashifpk opened 2 years ago

kashifpk commented 2 years ago

For helium miner software components like hm-diag, development and testing the code on the balena machines is a slow process. Currently the flow is something like:

This means every small change entails a waiting period of upto 10 minutes before being able to see the results on test devices. And if Balena is down then we're stuck too. This really is a productivity killer.

Instead we need to develop a way to directly push code to local test device via ssh or something similar. I was able to get local ssh working (without the balena image for local development) so that can be used as a base to quickly update stuff.

Ideally something like a remote mount of the code base plus facility to restart the effected container should work nicely. This should make development much faster on all the helium-miner-software components.

Code changes made to the container can be preserved via docker commit (or balena-engine commit in our case) and then we can stop the existing container and start the new container containing the changes.

This way devs can change code, push it locally to the device and restart the container (hopefully taking less than a minute) and don't have to worry about Balena being down or waiting for images to be built and then pushed to devices.

shawaj commented 2 years ago

balena have a local mode, not sure if that will be helpful here - https://www.balena.io/docs/learn/develop/local-mode/

kashifpk commented 2 years ago

Yes but our miner balena images are not built with local mode support. Plus I was told that local mode deployment is quite slow as it builds and pushes the images locally. Also looking at the "Local mode caveats" section of the provided link it looks like it's quite a departure from what we use for production. No logs, can't set env vars from the cloud etc.

The current image itself is fine as any dev work would require to update the latest working image. I've seen bash scripts that gzip code and transfer it to and from dev machine to balena machine host os or a specific container. For host os we can just use plain scp too but updating files inside a container is another issue.

Overall this definitely looks do-able. Just might not be top priority right now. Though it should definitely boost productivity.