How to safely update configuration?
readeral opened this issue · 3 comments
Hi @mKeRix, thanks so much for room-assistant, it's great!
I'm using this ansible setup to deploy 5 pis (a 3B+, a 3B, and 3 zero Ws), but I'm wondering the best/right way to update my config, say, once I've determined I need to individually tune RSSI values etc.
How best to disseminate the newly updated YAML to my pis?
I tried simply just running the ansible-playbook command again (as per your documentation) but running it results in errors from any number of the Pis (changes each time), with the upshot being that the mdns gets mucked up (in my most recent effort, two Pis decided they couldn't find the mdns module) and as a result, my cluster isn't created automatically.
So of course I've gone in to fix each instance (uninstalled and reinstalled room-assistant manually) but it would be great to be able to simply update the globally defined params and restart the service on each device.
Is there a smart way to do this? (See below for an error log of not finding mdns if it's at all relevant or interesting)
`pi@zero-dining:~ $ room-assistant -v
[Nest] 2910 - 22/04/2020, 20:39:39 [ClusterService] Cannot find module 'mdns'
Require stack:
- /usr/local/lib/node_modules/room-assistant/dist/cluster/cluster.service.js
- /usr/local/lib/node_modules/room-assistant/dist/entities/entities.service.js
- /usr/local/lib/node_modules/room-assistant/dist/entities/entities.module.js
- /usr/local/lib/node_modules/room-assistant/dist/app.module.js
- /usr/local/lib/node_modules/room-assistant/dist/main.js
- /usr/local/lib/node_modules/room-assistant/bin/room-assistant.js
Error: Cannot find module 'mdns'
Require stack: - /usr/local/lib/node_modules/room-assistant/dist/cluster/cluster.service.js
- /usr/local/lib/node_modules/room-assistant/dist/entities/entities.service.js
- /usr/local/lib/node_modules/room-assistant/dist/entities/entities.module.js
- /usr/local/lib/node_modules/room-assistant/dist/app.module.js
- /usr/local/lib/node_modules/room-assistant/dist/main.js
- /usr/local/lib/node_modules/room-assistant/bin/room-assistant.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:952:15)
at Function.Module._load (internal/modules/cjs/loader.js:835:27)
at Module.require (internal/modules/cjs/loader.js:1012:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (/usr/local/lib/node_modules/room-assistant/dist/cluster/cluster.service.js:32:12)
at Module._compile (internal/modules/cjs/loader.js:1123:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
at Module.load (internal/modules/cjs/loader.js:972:32)
at Function.Module._load (internal/modules/cjs/loader.js:872:14)
at Module.require (internal/modules/cjs/loader.js:1012:19)
22/04/2020, 20:39:41 - info - IntegrationsModule: Loading integrations: none
22/04/2020, 20:39:43 - info - NestFactory: Starting Nest application...
22/04/2020, 20:39:44 - info - InstanceLoader: AppModule dependencies initialized
22/04/2020, 20:39:44 - info - InstanceLoader: ConfigModule dependencies initialized
22/04/2020, 20:39:44 - info - InstanceLoader: NestEmitterModule dependencies initialized
22/04/2020, 20:39:44 - info - InstanceLoader: IntegrationsModule dependencies initialized
22/04/2020, 20:39:44 - info - InstanceLoader: DiscoveryModule dependencies initialized
22/04/2020, 20:39:44 - info - InstanceLoader: ClusterModule dependencies initialized
22/04/2020, 20:39:44 - info - InstanceLoader: ScheduleModule dependencies initialized
22/04/2020, 20:39:44 - info - InstanceLoader: EntitiesModule dependencies initialized
22/04/2020, 20:39:44 - info - RoutesResolver: EntitiesController {/entities}:
22/04/2020, 20:39:44 - info - RouterExplorer: Mapped {/, GET} route
22/04/2020, 20:39:44 - info - ConfigService: Loading configuration from /usr/local/lib/node_modules/room-assistant/dist/config/definitions/default.js
22/04/2020, 20:39:44 - warn - ConfigService: No configuration found in /home/pi/config
22/04/2020, 20:39:44 - warn - ClusterService: Dependency "mdns" was not found, automatic discovery has been disabled. You will have to provide the addresses of other room-assistant nodes manually in the config.
22/04/2020, 20:39:44 - info - NestApplication: Nest application successfully started
22/04/2020, 20:39:46 - info - ClusterService: zero-dining has been elected as leader
22/04/2020, 20:39:46 - info - EntitiesService: Refreshing entity states`
The way that you're doing it is actually the way that it is meant to be done - I haven't run into issues regarding packet install just yet. Do you see any specific errors while executing the playbook or only once room-assistant started?
Apart from that, you can use the --limit
option of ansible-playbook
to only execute changes on a subset of nodes if you're changing individual configs. It takes a pattern as the argument - in theory just providing the hostname should do the trick.
So I think your answer on my issue on room-assistant package shed enough light on this issue. It seems that it must've simply been the network requests issue that caused various parts of the re-deployment to fail, seemingly at random. What I needed to do was ssh into each of my pis and turn off the room-assistant.service before then running the playbook.
I suspect I won't be the only one caught by this.