NebraLtd / hm-gatewayrs

Light Hotspot (gateway-rs) Container for Helium
MIT License
5 stars 9 forks source link

helium_gateway info region outputs settings.toml or environment parameter which causes issues when freq/region changes #52

Closed shawaj closed 1 year ago

shawaj commented 1 year ago

In this file https://github.com/NebraLtd/hm-gatewayrs/blob/main/gen-region.sh we use helium_gateway info region which outputs the region from the region config oracle service.

However, we have inadvertently misunderstood the functionality of this command as being the same as it was in pre-gateway-rs helium miner. This was not a problem with the old hm-miner container, as the region check command on the old miner only ever returned the asserted region plan, and never something configured in a settings file. Hence why this only started happening after the move to hm-gatewayrs container.

If there is a region set in the settings.toml file or using a GW_REGION environment variable this command will output the contents of the file/envvar until it gets the region directly from the config service. As we are running this check before we run the helium_gateway server at startup (and only once), this means that the region file never gets correctly updated with the correct frequency.

This is a problem in certain circumstances:

The only way to fix this currently is a factory reset (it will never resolve itself otherwise).

The way to solve this is to periodicially run the region-checker script (that populates the region file at /var/pktfwd/region) and if an updated one is found then restart the packet-forwarder container.