Wednesday, 2018-10-24

*** bcoca has quit IRC00:11
*** Glandos has quit IRC04:54
*** Glandos has joined #ara04:54
*** sshnaidm|pto is now known as sshnaidm|ruck05:45
apollo13dmsimard: around :)06:56
*** apollo13 has quit IRC07:05
*** apollo13 has joined #ara07:08
*** gvincent has joined #ara07:30
*** themroc has joined #ara07:48
*** gvincent has quit IRC08:46
*** gvincent has joined #ara08:47
dmsimardapollo13: asleep :p11:37
apollo13awake :รพ11:38
dmsimardLet's catch up later11:38
*** jrist has quit IRC12:40
*** tbielawa has joined #ara13:06
*** larivee has joined #ara13:56
*** bcoca has joined #ara14:05
*** jrist has joined #ara14:06
*** jrist has quit IRC14:09
*** jrist has joined #ara14:10
*** jrist has quit IRC14:24
*** jrist has joined #ara14:41
*** tbielawa is now known as tbielawa|mtg14:44
dmsimardapollo13: ohai14:48
dmsimardso you proposed two different ways for configuration14:49
dmsimardwhich way do you prefer ? can we talk about the pros/cons of each ?14:49
apollo13dmsimard: sure, shoot; I prefer the newer one. Gonna ride home. be back in 30 mins or less14:50
*** themurph has joined #ara14:51
apollo13dmsimard: home15:17
dmsimardapollo13: ohai15:19
apollo13hi :)15:21
dmsimardI like the approach with everett but I'm not convinced about everett itself15:21
apollo13okay?15:22
dmsimardwhat bothers me about everett is that as far as I can see, it's not packaged for any distro and I don't know enough about the project in order to be able to tell if the amount of activity in github is representative of what we might expect if we have any issues with it15:24
apollo13it is MPL, we can just as well move the two files into ara itself ;)15:25
dmsimardI wear many hats15:25
dmsimardthe engineer hat says "sure"15:25
dmsimardthe packager/support hat says "hang on"15:25
dmsimarddo we want to maintain it, though ?15:25
dmsimardI guess that's what I mean by weighing the pros and cons15:26
apollo13want? no, but it's 1000 lines and not exactly rocket science15:26
apollo13that said, if you have a maintained alternative somewhere I am all ears15:26
dmsimardDo know that you're better than me at this so I'm relying on your experience while making sure I understand :D15:29
apollo13I mean everett is relatively simple python code and basically one file. if it were a C extension then the situation would be different15:29
dmsimardsure15:30
apollo13but maybe my google fu was to weak; but searching for python and configuration is not the best search term either15:30
dmsimardhaha, I bet15:30
apollo13there might be another fine lib out there, dunno15:30
dmsimardso let me ask you this then15:30
dmsimardwhat bothers you about the first approach ?15:30
apollo13that there is no support for config files15:30
apollo13which granted we could add everett to add that, but:15:31
apollo13we would then be in the weird situation where we'd still have DJANGO_SETTINGS_MODULE with multiple predefinitions + yet another possible override via ARA_CFG15:31
apollo13I am somewhat torn between the two approaches15:32
dmsimarddjango 100% relies on settings.py for everything ?15:32
dmsimardlike, out of the box there's nothing else ?15:32
apollo13yes15:32
apollo13which is okay imo because that gives the developer the option to do whatever they want as long as they can somehow fill settings.py15:33
apollo13ie it does not limit you in doing something15:33
apollo13and the downside of DJANGO_SETTINGS_MODULE is that it has to be in the python path, so you cannot just tell a user to put an ara_settings.py in ~/.config and be done with it or so15:34
apollo13also if we were to add everett to the first approach you are in the even weirder situation that ARA_CFG would behave differently on which DJANGO_SETTINGS_MODULE is currently active15:35
apollo13ie if DJANGO_SETTINGS_MODULE is set to dev and ARA_CFG specifies no debug, then it would be True by default, yet if you change DJANGO_SETTINGS_MODULE to prod the same ARA_CFG would result in debug=False15:36
apollo13which is all understandable but still weird imo15:36
apollo13that said, one thing speaks for a single settings file: parity between the environments15:36
apollo13so you do not get into a situation easily where your setup is completly different (like different INSTALLED_APPS because you forgot to change all involved files etc)15:37
apollo13granted to some extend that can also happen with cfg files15:37
apollo13as you can see I am torn, there are no perfect solutions; it's probably a matter of taste15:38
dmsimardapollo13: allowing myself to think outside the box for the sake of discussion for a moment15:41
apollo13sure, by all means15:41
dmsimardyou have every right to say it's a crazy idea15:41
*** themroc has quit IRC15:45
dmsimardcould we have a set of default settings which allows the API to work15:45
dmsimardand then configure the app through the API15:45
dmsimardbehind the scenes, the config could end up in a config file, a database or whatever15:45
apollo13in theory yes15:46
dmsimardI don't know where I'm going with this or how it would work in practice15:46
apollo13in practice this approach fails at least for django because settings are not mutable15:46
apollo13ie you'd have to restart the process to reload database settings15:46
dmsimardah15:46
apollo13which may or may not be easy depending on how you deploy15:46
apollo13but certainly not something you can easily do from inside the app15:47
apollo13also with my devops hat on: if I do not have a config file that I can deploy with ansible I will hate everything about ara :D15:47
dmsimarddevops++15:48
dmsimardso out of curiosity15:48
dmsimardI looked at horizon, the openstack dashboard project which uses django15:48
apollo13I like the idea, I just do not think that reconfiguration of the whole running app is doable in django easily (or most other web frameworks in python for that matter)15:48
dmsimardapparently they rely on a single local_settings and it's typically expected in, say, /etc/openstack-dashboard/local_settings15:49
dmsimardI'll keep looking just to see what people are doing15:49
apollo13so the local settings approach is something not like in the django community15:49
apollo13the reasoning is simple:15:49
apollo13generally it means you have a settings.py inside horizon itself which at some point has an "from local_settings import *"15:50
apollo13right?15:50
dmsimardI suppose15:50
apollo13ah okay they are doing it a bit more involved https://github.com/openstack/horizon/blob/62d90a49adf608034bd3f8ce94e950f2f30208e2/openstack_dashboard/settings.py#L37315:51
apollo13ah no https://github.com/openstack/horizon/blob/62d90a49adf608034bd3f8ce94e950f2f30208e2/openstack_dashboard/settings.py#L37615:51
dmsimardwell, I'm not saying they're doing the right thing15:51
dmsimardI'm saying that's what they're doing :p15:51
apollo13right, I am just trying to explain why it is not generally liked15:52
apollo13so basically what you have in local_settings overrides what you have in settings.py15:52
apollo13but (and this is usually the show stopper): it also means that local_settings cannot extend lists/dicts15:52
apollo13it can just override15:52
dmsimardah, because it's an import15:53
dmsimardmakes sense15:53
apollo13the django-native approach would be to set DJANGO_SETTINGS_MODULE to the local_settings (with the caveat of it being in the python path) and then local_settings can do "from base_settings import *" and then extend lists etc15:53
apollo13so basically inversion of control if you want to look at it like that15:53
*** tbielawa|mtg is now known as tbielawa16:47
*** tbielawa is now known as tbielawa|lunch17:02
*** irclogbot_0 has quit IRC17:08
dmsimardapollo13: do we really need a different config file for differentiating prod/dev ?17:22
*** tbielawa|lunch is now known as tbielawa|mtg17:59
*** ara-slack has joined #ara18:19
*** ChanServ sets mode: +v ara-slack18:19
*** tbielawa|mtg is now known as tbielawa18:20
dmsimardtest18:20
dmsimardtest18:22
*** ara-slack has quit IRC18:24
apollo13dmsimard: settings wise?18:35
dmsimardapollo13: ara wise :p18:35
apollo13imo yes18:35
apollo13secret_key needs to be secret18:35
apollo13you don't want to set it during dev though18:35
apollo13but I also do not want to set a default for prod for it because then users will not change it18:36
apollo13same goes for debug, it is a security risk in prod (albeit small) but during dev you most certainly want it to be true18:36
apollo13dmsimard: one option would be an ARA_ENVIRONMENT variable which basically set a few defaults, this way we could get rid of dev.cfg/integration.cfg and test.cfg18:40
apollo13I actually would like that :)18:40
apollo13ARA_CFG would still be evaluated, but ARA_ENVIRONMENT=prod|test|dev etc would set sensible defaults where allowed18:41
*** Naphtime has joined #ara18:41
apollo13dmsimard: if you were to let it be my choice I'd also add ARA_ENVIRONMENT to https://review.openstack.org/#/c/612446/ and go with that. but in the end I can live with whatever approach you like most18:44
apollo13bbl, dinner18:48
*** tbielawa has quit IRC18:48
*** Naphta has quit IRC18:48
*** tbielawa has joined #ara18:50
*** irclogbot_0 has joined #ara19:27
*** irclogbot_0 has quit IRC19:27
dmsimardapollo13: I need to prepare for an ansible meetup, I'll think about it19:32
*** irclogbot_0 has joined #ara19:32
*** tbielawa has quit IRC19:56
*** irclogbot_0 has quit IRC20:21
Xarothapollo13: django does not require a settings.py20:34
*** gvincent has quit IRC20:35
*** gvincent has joined #ara20:35
Xaroth`django.conf.settings.configure(**options)` does the function of what settings.py would20:36
Xarothyou have projects like https://github.com/simonw/djng that make django work for single-file applications (a-la flask)20:36
Xarothso you can easily prepare the configuration as required by django in your bootstrapper20:37
Xarothjust make sure that your code doesn't touch django until it has configured it20:38
*** irclogbot_0 has joined #ara20:43
*** irclogbot_0 has quit IRC20:43
*** irclogbot_0 has joined #ara20:48
*** irclogbot_0 has quit IRC20:48
*** openstack has quit IRC21:03
*** openstack has joined #ara21:05
*** ChanServ sets mode: +o openstack21:05
*** irclogbot_0 has joined #ara21:46
*** irclogbot_0 has quit IRC21:46
*** themurph has quit IRC21:48
*** irclogbot_0 has joined #ara21:48
*** irclogbot_0 has quit IRC21:50
*** irclogbot_0 has joined #ara21:58
*** irclogbot_0 has quit IRC21:58

Generated by irclog2html.py 2.15.3 by Marius Gedminas - find it at mg.pov.lt!