Hello, I’m using the wifi-repeater app since quite some time now on a very little fleet of mine and I wanted to make more use of my rpis so I tried to add another app to the fleet. I was able to directly push the app with balena push and to my surprise now both wifi-repeater and the other app are running on the device, except that the new app is running on its own container and the wifi-repeater service is running in the balena supervisor container as shown by balena-engine stats:
$ balena-engine stats
ONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
3c22b6500955 main_6942521_2666576_f14f346cec9dff5c4dd0232b431e2237 0.00% 52.46MiB / 961.5MiB 5.46% 0B / 0B 0B / 0B 2
fc348f42ca16 balena_supervisor 0.04% 57.6MiB / 961.5MiB 5.99% 0B / 0B 0B / 0B 12
(I don’t know how to give a name to my app when pushing it directly so it’s named main for now)
As you can see there is plenty of space for other apps to run there.
Then I tried to clean up all of this so I published my app’s source code to github and created an app on balena cloud. The CI/CD works fine and every commit gets pushed. But this app can’t be deployed to the fleet, but this seems to be an incoming feature.
Nonetheless I then discovered balena blocks and from what I understood here is how I could clean up my setup with them:
Instead of running 2 apps where for some reason one is running in the supervisor and the other is running it its own container, I could create one single app for my fleet (of the same name let’s say), add one block for the wifi-repeater service and other blocks for all the other services I would want to add.
This sounds like a much better setup to me in terms of modularity.
But the caveats are that
- the wifi-repeater service is an app and not a block
- if I deploy this new all-in-one app with the incoming deploy-to-fleet feature, will it remove the already running services or will it stack itself on top of the others as the main app I manually pushed did ?
So my questions are:
- why some services run in the supervisor and others on their own container.
- why pushing an app manually adds it on top of the others instead of replacing the old one
- can I easily convert the wifi-repeater app to a block ?
- if not how to achieve this modular goal with a clear declarative configuration ?
Hi, can you please share the exact command you used to push the wifi-repeater app to your device/fleet? From my understanding, pushing an app to a device/fleet should “replace” the old one (I say “replace” because it genuinely replaces when pushing to a device in local mode, but on the fleet level it should create a new release, enabling you to switch/choose between the two, the old release doesn’t really get replaced). I’ve not heard of a release getting pushed to the supervisor container so I would really like to know what exact command you were using (please also provide a link to instructions you were following if any).
Regarding converting apps to blocks, I personally do not have experience with this subject but I will reach out to my colleagues to see if anyone can provide you with some direction or examples
Regarding converting apps to blocks:
First off, there is no existing feature to literally convert an app to a block. However, if the app’s compose file has only one service/container in it and you have the code for the release you want, you could push that code as a new release to a block. Note that the app’s and block’s slugs must each be unique.
At the time I followed this tutorial and deployed everything from the browser which means that I probably used this link.
Thank you for sharing the link you referenced when pushing the app.
both wifi-repeater and the other app are running on the device
Earlier you mentioned this ^. Could you please explain how you can tell that both the wifi-repeat and the other app are running on the device? From what I can see in the balena-engine stats
output you shared above, and from what I know about how pushing works, the entire app should have been replaced by the new app so the output you shared above implies that the device is running the new app and only the new app. (balena-supervisor is a service that should be running on any balena device and main
would be the container/service from the new app you pushed). Is there any sort of evidence that wifi-repeater was still operating after pushing the new app? Or was this a misunderstanding?
The project has indeed only one service: https://github.com/balena-labs-projects/wifi-repeater/blob/master/docker-compose.yml, I’ll try that.
Great, please let us know how it goes. Once you have successfully pushed the code to a block of your own, you should be able to add it to your app by updating your app’s compose file to include the wifi-repeater block container via bh.cr
(which you should be able to find on your block’s dashboard page).
Once you have successfully pushed the code to a block of your own, you should be able to add it to your app by updating your app’s compose file to include the wifi-repeater block container via bh.cr (which you should be able to find on your block’s dashboard page).
To be clear, once you have updated your app’s compose file to include the wifi-repeater block container via bh.cr
, you will need to push the app again to your fleet
I’m currently connected through this access point so I’m pretty sure the service is still running. My guess is that when pushing the main service, since I don’t provide any docker-compose file, it automatically creates one that includes both my service and the previous one.
But isn’t this push-to-fleet feature under development ? In my dashboard the button is disabled and reads “coming soon”.
But isn’t this push-to-fleet feature under development ? In my dashboard the button is disabled and reads “coming soon”.
Pushing an app to a fleet is indeed under development. However, you are able to push the code from an app to a fleet. Doing so behaves exactly the same way as pushing any other code/release to a fleet. Currently the purpose served by apps is to enable users to share code and push it to their fleets (as you are doing with that link you found in the blog post). However the goal which we are working towards is establish a connection between apps and fleets and allow users to deploy the former to the latter. This is a work in progress which you can track via the following roadmap post: Enable apps (single and multiple) to be installed on a fleet (multi-app) · Balena Roadmap
I’m currently connected through this access point so I’m pretty sure the service is still running. My guess is that when pushing the main service, since I don’t provide any docker-compose file, it automatically creates one that includes both my service and the previous one.
We suspect that this is the result of wifi-repeater interfacing with dbus: the wifi-repeater app likely sets up some network manager files on the host that are not removed when the app is removed so it still somewhat functions (awaiting confirmation from another colleague on this point)
While this may be the case, the wifi-repeater app should indeed no longer be running on the device once the device has successfully pulled/installed another release
Pushing an app to a fleet is indeed under development. However, you are able to push the code from an app to a fleet.
Apologies, I just realized this potentially sounds confusing. I was trying to say that while there is not currently a feature for push code to an app and then the app to a fleet (i.e. code → app → fleet), you are able to push the code itself from an app to a fleet (i.e. code → fleet)
Ok, I have created this block the wifi-repeater-block and a test app that uses it alongside another block and it works !
$ balena stats
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
20c8c9ed0b2b wifi-repeater_6982246_2675125_22a2bb168e04c3c1c93b26719fed0cfe 0.00% 8.949MiB / 961.5MiB 0.93% 0B / 0B 0B / 0B 7
2137f70cc4b2 balena-fox-backup_6982247_2675125_22a2bb168e04c3c1c93b26719fed0cfe 0.00% 2.109MiB / 961.5MiB 0.22% 7.71kB / 0B 0B / 0B 2
fc348f42ca16 balena_supervisor 0.03% 94.73MiB / 961.5MiB 9.85% 0B / 0B 0B / 0B 12
Thanks for the much appreciated help !
Awesome! Glad to hear it worked out
Let us know if you have anymore questions or need anymore help