Resin Staging Env Env


#1

Is there a proper place to discuss items related to staging?

(for example it seems that currently once you add a device level env variable in staging, it “disappears” from the interface. It’s still active, but no longer shows in the interface and thus cannot be removed or changed")

[P.S. if we don’t report staging issues - because, well it’s staging - that’s cool too, just let me know]


#2

Hey, is that a variable starting with RESIN_? If so, it should go to the Fleet Configuration or Device Configuration section. It’s a known “quirk”, that we are working on.

The Environment Variables and Configurations are two similar things, but they have some differences in behaviour that we need to either make less surprising or communicate better.

The Configurations modify the device’s behaviour, some trigger restart (such as the RESIN_HOST_CONFIG variables to change Raspberry Pi’s config.txt), some doesn’t change anything when added, just later (such as RESIN_SUPERVISOR_DELTA, and they affect the device, not the application, hence they are in their own section.

Environment Variables are just that, env vars for your application, and they always trigger restart of the application (but not the device).

This is definitely an area to improve on. :pencil2:

And yeah, can drop in staging stuff right in this category. :v:


#3

Hey there - no, it’s not a RESIN_ variable, it’s just a device specific ENV variable. For example:

(This is the same is Safari, Chrome, and Firefox) Here is the ENV page of one of my devices:

Yet this is what the environment actually is (from that same device):

I think this is just a JS webpage issue, I can see the REST call the front-end is making to get the ENV variables (https://api.resinstaging.io/environment?appId=…). It respond correctly:

{
	"RESIN_HOST_CONFIG_dtoverlay": "pi3-miniuart-bt",
	"droneId_mongo": "584adc6aaebc030004a68a8e",
	"droneId_mongo2": "584adc6aaebc030004a68a8e",
	"RESIN_DEVICE_RESTART": "1981295337117177"
}

It just doesn’t show on the page. You’re not seeing this as well in staging?


#4

Thanks for the detailed feedback, really appreciate it! I’ve just tried, and don’t see it happen myself (on Chrome / Linux).

What operating system are you on? Do you see any similar issues on production? Since it’s staging, it is indeed not guaranteed to work at any given time, but we are checking whether this is a known issue, or a regression.

@Eugene, do you have any idea what might happen here, or any suggestions how’s the best to debug this?


#5

That sounds strange. The most logical explanation would be that it’s actually an app-level var (the /environment endpoint returns the merged vars) and that’s why it’s not visible in the device env vars list.

Can we have a link to the app and device dashboard pages on staging? You share it here or in the Intercom chat session @mtwomey.


#6

Yep - I agree, it’s strange indeed. It’s not an app level var though. Here’s the app:

https://dashboard.resinstaging.io/apps/15984/devices

Here’s the device:

https://dashboard.resinstaging.io/apps/15984/devices/52160/summary

Edit: Just for good measure, I just went to an entirely different computer (PC this time) and I’m seeing the same thing. To extra clarify, this only happens on the staging env.


#7

Thanks, we’ll check and get back to you


#8

So I’ve checked and the https://api.resinstaging.io/environment?appId=15984&deviceId=52160 request returns an empty object returned by the API, not the thing that you’ve displayed above.
Which makes me think the UI is probably OK and we need to dig deeper. @imrehg can you please report it and ask someone to look into the API/DB part of this, as well as the device side (to see how actually these variables are being set, and if they are retrieved properly by the supervisor from the API).

Right now my guess is that the changes done some time ago to the env vars management may have permission issues that work well with the device API key but not with the UI’s session token. If that’s the case @Page is the man to talk to.

But it’s just a guess.

@mtwomey we may need to SSH into your device — is it OK?


#9

Yes - please go ahead and ssh in.

That’s strange that you got an empty response. I just made a video for you 2 minutes ago (just finished uploading it to Youtube). You can see here - at the end of the video I look at the request directly and can see the response:


#10

So we’ve sorted it out, it’s because I was using my account that can see the page but does not have permissions to fetch your env vars. So let me check it again now.


#11

Yeah that was my mistake, I can now see this. So scratch my previous comment, it should be the UI issue indeed.


#12

Ok cool thanks! One more tiny piece of information I meant to include in the earlier video. When I try to go and add one of the variables that’s already been defined, I get ‘Data is referenced by device_env_var_name.’ which makes sense, since it’s actually already there:


#13

Yeah, the latter is expected.
So I can confirm that this is indeed a purely UI issue, we will fix it soon.
Thanks again for reporting!


#14

Sure thing, thanks for being so responsive!!


#15

I caused a bug, my apologies. It should now be resolved on staging, and the originally intended improvements be making their way out to production soon.
Andrew.


#16

Woot! Awesome, thank you! Hey bugs… this is how progress is made, thanks again for your help :slight_smile: