Changes made to project not staying

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?

Hi @timhannah1988, first of all welcome to the balena community :smiley:

What you observe is expected. Please use balenaCloud dashboard, API or CLI to edit the service variables. Here’s our documentation explaining these: Environment and service variables - Balena Documentation

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.

Let us know if these help or not. Happy hacking.


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 ‘’ file in the project with my new updated version? or am i missing something

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.

The supported env vars are listed here: GitHub - balenalabs/uk-train-departure-display: A balenaCloud Raspberry Pi app to display replica near real-time UK railway station departure data on SSD1322 screens.

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"

Hope this helps!