Let's say that I have a Django app, and I've offloaded environment variable storage to etcd. When I deploy a new server, the app can read from etcd, write the vars into (for example) a Python file that can be conditionally loaded on the app boot. This much is acceptable.
When the configuration changes, however, I have no way of knowing. Afaik, etcd doesn't broadcast changes. Do I need to set up a daemon that polls and then reloads my app on value changes? Should I query etcd whenever I need to use one of these parameters? How do people handle this?
You can use ETCD as a settings backend, but in order for Django to pick-up configuration changes during runtime (i.e. without restart/reload), you need to setup a background mechanism to keep reading the settings.
The package django-etcd-settings does it by starting a daemon thread which will then setup a long-polling connection in order to read the keys from ETCD and keep the settings up-to-date.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With