Hi I’m fairly new to Balena and dockers and all of this. I have been following the tutorial for train platform sign here it works a charm however i would like it to be specific to one operator.
I have looked up the API and noticed there is a parameter for Operator and after adding it to the ‘main’ services via terminal it seems to work fine… However after a period of time (not sure how long) it appears to overwrite with the original code again and take out the changes i have made.
How do i make my changes persistent? Am I missing a step?
Essentially the balena supervisor checks with the balenaCloud database to retrieve the current device state. Since the changes you made via terminal are not communicated to balenaCloud database, the supervisor has no idea about these. Consecutively, it undoes your changes as it applies the latest known state retrieved from the balaneCloud database.
Thanks for your reply. So I have added the variables under the balenaCloud dashboard Environment variables as this is where is set the other variables such as which station etc? is this not correct?
There is nothing under the Service Variables?
My other issue is once I put these variables under service variables how does the code know to use this when making the URL? how can i overwrite the ‘trains.py’ file in the project with my new updated version? or am i missing something
Hello,
Balena is much about managing many devices - possibly with multiple services in them. If you only have a single device with a single service it shouldn’t matter much, but generally, it works like this:
Application → Env Var: variables that are set for all devices and all services
Application → Services Vars: variables that are set for one service (aka one container) for all devices
Device → Env Var: variables that are set for all services for one device
Device → Service Var: variables that are set for one services for one device
remember that all of these DO NOT work if you are in local mode. Either don’t use local mode or add the variables to the Dockerfile with a ENV variable1=value1 kind of line.
Unfortunately we can’t support you with changes to the application code itself. But if you want to make changes in general, just download the source from GitHub do the changes locally and use our balena CLI to push the updates via balena push "myAppName"