-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Frequency check to check for device tag as well as FREQ env var #444
Comments
@KevinWassermann94 this one is in relation to merging 470, 868 and 915 units into a single fleet |
@shawaj I'll discuss this with the team tomorrow |
FYI I've already bulk tagged all the fleets with tags of their frequency. We could also run a script to add the environment variables individually to each device on a device variable level. Or maybe do both as a "belt and braces" type of approach |
@MuratUrsavas Will add more details in a moment, but we figured tags are not an option for us. They require pre-registering devices, which would completetly break our manufacturing process, as it would create individual images for every single unit which is unacceptable. We have a potential solution that would add the env var to the docker compose file. Murat will add more details |
Interested to hear the docker compose idea. But don't see how that will work when the devices are all in a single fleet. The other thing could be to just start them in manufacturing in a frequency based fleet and then tag them and move them to the main fleet automatically. The other thought I had was using the nebra.json and just pulling the frequency into the environment by reading that using a helper method in hm-pyhelper? |
Iirc we plan to use an env var in the docker compose. We only need the frequency at manufacturing and don't need it to be persistent. In theory we could even use the dashboard to call the Balena API to set the env var on device level If we had them in seperate fleets during manufacturing those probably needed to be OpenFleets as well. That wouldn't really help us, as for a standard fleet they would be considered for billing afaik We are unsure about the state of nebra.json and there were some complications in actually injecting the frequency into it. It's definetly merged, but there were some complexities |
It would be useful to have the frequency persist if possible. But presumably with the docker-compose way, it would persist in our dashboard for our own devices? If this is the case, I think that's sufficient. As you so we can always tag in Balena as well if we want to using that data |
For a moment I thought that Docker Compose is a good idea, but the main problem is, the updates. For manufacturing, we can create an individual file per frequency-variant and have that device carry it. But after putting them in a single fleet and update it, what will the docker compose will carry? It will eventually update all the devices with the same info, hence that's out of option. I'm into a simple file, like: How about that @shawaj @KevinWassermann94? |
Of course we have to remove all of the Balena fleet and device references, because I don't know which one has the priority. Probably would be the docker one, but it's better to get rid of them all at once. |
And I've found a way how to do that. 👍 |
Sounds good to me! |
So we will just inject a different file per frequency? |
Yep, as the production images already carry that information. We'll have a file, like |
So essentially what we were trying to do with nebra.json, just a little bit simpler? Nice 👌 |
Yep. Not even trying to put some fancy curly braces 😄 |
@MuratUrsavas - I'd recommend that we leave the option open to use this file for more than just frequency in the future. Perhaps we call it something like @KevinWassermann94 @shawaj - Frequency also gets stored with the device at dashboard during registration. So even if we lose it from the device we have a way to read it from dashboard and set as device variable if we want. Perhaps upon registration we can create a celery task to set the frequency using balena API as a device variable? |
I'm seeing a pattern here 😄 Let's do that an ini file. => Hey why not a YAML? => Let's make it JSON as it's better. => * nebra.json rises again from its ashes * :D |
I'd recommend to keep it simple, and make it more complex if ever needed. |
@kashifpk I agree, we might as well set an env var in Balena during registration in the manufacturing process |
And I've found a way to keep it simple, yet flexible what @kashifpk wants. Will create Yea, you got it right. More files, more environment variables. file name is the ENV variable, contents is the value. This way we can do simple operations even in bash. |
@MuratUrsavas - if we can keep it a single file with multiple env variables (one one called File contents for:
as these can be readily read by most languages. For hm-diag python's |
I was thinking in plain bash, without needing any kind of language, including Python. If that need would arise later, we can use |
Even integrate current |
The
|
Yep, I'm convinced 🏳️ 😄 Will do that so. |
@MuratUrsavas @kashifpk nice. This is really handy and allows us to persist the env variable in both Balena and dashboard. Perfect 🥰 |
@MuratUrsavas @kashifpk for existing devices, if I merge into a single fleet, will this cause any issues right now. Or we should wait until the celery task thing is implemented? Already they have tags in Balena but not device environment variables |
@shawaj Please don't move devices into a single fleet right now. The problem is not FREQ, it's VARIANT. Without it, the devices will start to fail. So we need two things to make this move happen:
The first one will make all devices work with correct setup in single fleet. Second one will make sure the device would work after a purge. |
@MuratUrsavas sorry for confusion on my side. I didn't mean a single fleet. I meant:
So only thing removed would be the frequency |
@shawaj No worries 😄 It's OK then, but do we really need it? Because every fleet move has a device loss potential, and the rate is not negligible. Maybe we should do that after implementing those two things? Otherwise, it's OK. I'm not expecting a functionality loss. |
It was more for ease of support for the open fleets. As then it's not frequency specific and they can just download a new SD card image as and when they need |
We should wait at the very least for a task to set device environment variables based on the frequency we have in the database. We can then run that task after moving to the new fleet. So if there are issues during moving to the new fleet we can at least set the env variables afterwards. |
Good idea @kashifpk makes sense to me |
I've good news. I was able to put some information in the data partition of a new and never booted image (like our production images) and track it through the first run and partition expansion. Data stays intact and outlives an OS update (tested). So we're good to put anything we want. Just need to find a good place to mount it as a named volume in our containers. I'm also planning to put |
@MuratUrsavas so this is done by creating a new volume? or it uses some pre-existing balena volume? Sounds great though! |
@shawaj We'll be creating a new named volume folder under exact location with our other named volumes. That'll be automatically accessible by our containers. It would be a little bit easier with bind mount, but Balena doesn't allow bind mounts. That's why we'll be doing that with named volumes, even it is adding little bit of complexity. I was going to finish this task today, but Balena-Staging started acting weird and now refuses to build new updates. Need to wait for start of the week. |
@MuratUrsavas what I meant was how do we create it in the production images? Also, you can probably just test with one of the test fleets in the main Balena dashboard instead of on their staging dashboard? As staging is really only needed for non-released boards like Radxa Zero and Rock CM3 |
@shawaj It will be injected at the same time of
Yea, I know that. But it was easier for me to test both Light Hotspots and this task. Guilty as charged 😄 |
Haha fair enough 🤪 And yeah that's great on the file injection - nice work. So we will essentially take the Balena base image and preload it as we do now but we will add an extra data partition to that image where we will put these files? (Also just FYI https://github.com/NebraLtd/hotspot-production-images/issues/57) |
@shawaj Most of it is correct, we just don't add a new partition. It's already there, but we were not mounting it. It's basically empty and the file structure is getting created in the first run. So we'll be creating the same folder structure before the first run. That was the missing information I was after. Couldn't get much info from Balena but I've found my way with poking some patterns into the file system 😄 |
@KevinWassermann94 @MuratUrsavas is this implemented now? Can we close this? |
Having spoken to balena, they have informed us that there is no easy way to add device variables in bulk - either to the preloaded image or via the dashboard.
They have suggested we use tags instead:
I then replied with:
@NebraLtd/developers what are your thoughts on this?
An alternative / additional check could be reading the FREQ key out of nebra.json file? @kashifpk does this exist now?
The text was updated successfully, but these errors were encountered: