5 ms·
I have a pet peeve about this attitude. These methods are being used for decades and well understood with all their advantages and disadvantages. One day, some
by bayindirh 6y ago
I have a pet peeve about this attitude. These methods are being used for decades and well understood with all their advantages and disadvantages.
One day, someone comes and tells that it's bad and considered harmful, and happily tells the only right way to do it. A flame war ensues then.
I'm all for moving things forward and evolution, but can't we take a milder stance and move forward in a more peaceful way? Attacking something so well established because of personal reasons feels so wrong from my PoV.
That thing wouldn't be a de-facto standard if it was too bad, right? I think we shouldn't play with the foundation that much.
- q3k 6y ago> That thing wouldn't be a de-facto standard if it was too bad, right? I disagree. Very often, the 'easiest' option wins, not the one that necessarily is the 'best', especially in the long term. Environment variables for configurations are fast and easy, and work well on the happy path - but break down quite fast when dealing with more complex cases (eg. more complex types than strings). They have a treacherous way of seeming the simplest and most pragmatic solution at first, but becoming a an untyped, underdocumented hairball after some time in more complex software. Furthermore, as long as environments have existed in UNIX and UNIX-like derivatives, their usage to configure the bulk of the behaviour of most services/programs are relatively new. The more old-school the service you deploy somewhere, the more likely it has a file-driven config. Indeed, sometimes it seems like 90% of the Docker code out there is converting environment variables into configuration files.
- emodendroket 6y agoSure, but everyone understands that option and knows the pitfalls. This is kind of the core of the “worse is better” mindset, which somehow seems to have disappeared from the collective consciousness even though Unix is bigger than ever.
- bayindirh 6y ago> I disagree. Very often, the 'easiest' option wins, not the one that necessarily is the 'best', especially in the long term. Thank you for your disagreement and discussion, honestly. Actually, I think using environment variables are a burden. Needs more documentation, more explicit warnings, a lot of handling, etc. So, environment variables are not the easiest way out there. Especially when almost any programming language has nice config file libraries out of the box. Instead these variables are added as a convenience feature for some frequent scenarios where tool needs to adapt itself to the environment it needs to run in, just before starting or needs to be run repeatedly with small, transient changes to the config. > Furthermore, as long as environments have existed in UNIX and UNIX-like derivatives, their usage to configure the bulk of the behaviour of a service/program are relatively new. This is not what I see in my career. Bulk of the applications we installed and ran used some forms of environment variables for runtime configuration of the tool/application. The reason for that the variable had a great deal of effect in the behavior of the program (which was generally scientific) and making multiple runs without modifying a file very effective. You need these runs to conduct research BTW, and you're on a cluster and jobs run long and whatnot. TBH, most of these applications also had configuration files or "sensible defaults" and they either created their default files if there was none. And if there was a file, the environment variable was acting as an override. So I had experimental software, fixed most of the parameters in the file and tried some other things by overriding some parameter(s) with an environment variable. Nothing was abused or misused. > Indeed, sometimes it seems like 90% of the Docker code out there is converting environment variables into configuration files. I've never seen it TBH, and if that's not documented well, it would be a big bag of fun for the users of that code.
- q3k 6y ago> This is not what I see in my career. Bulk of the applications we installed and ran used some forms of environment variables for runtime configuration of the tool/application. I think we might have different backgrounds and considerations as to what counts as 'oldschool'? Maybe I shouldn't have extrapolated this to pre-2000... So, my experience comes from working with the following 'mood' of services: Postfix, Exim, qmail, slapd, PostgreSQL, MySQL, FreeRADIUS, Apache, Nginx, ... All of which have their own config file/files, format, etc. All of these system-wide services, not user applications. And I think that's the main difference? I tend to deal with software that is deployed in isolated environments, be it by root users on production server, or by whoever in a containerized environment. And not deployed on an interactive systems, to then be started/reconfigured by users running on the same system. > I've never seen it TBH, and if that's not documented well, it would be a big bag of fun for the users of that code. Check out the list above on Dockerhub. I'm not sure all of them are dockerized in this way, but at least a handful of them are.
- bayindirh 6y agoI've further clarified my PoV here [0], but it won't hurt to reiterate. I'd be happy in fact. > I think we might have different backgrounds and considerations as to what counts as 'oldschool'? Most probably. All of the software you mentioned (maybe except Exim4) is actively used in our environments, quite a few of them are in very vanilla configs, and some of them are customized to the point of abuse. However, it's worth mentioning that all of the software you mentioned are in support roles in our scenario, they're the so-called side dish which we configure once and leave alone for a very long time. > Maybe I shouldn't have extrapolated this to pre-2000... I've started with a C64, please. :) > All of these system-wide services, not user applications. And I think that's the main difference? Yes, the tools I've talked about are userspace programs, and are not daemons 99.999% of the time. So you need to run it many times with small differences, and reconfiguring/regenerating file is a lot of work, but as I said, they all have configs and env variables are convenience overrides most of the time. > Check out the list above on Dockerhub. Will take a look, thanks. Wanted to learn docker in depth for a long time, but had no notable project to force me to use it. Maybe someday. [0]: https://news.ycombinator.com/item?id=26660409 https://news.ycombinator.com/item?id=26660409
- ekimekim 6y ago> Indeed, sometimes it seems like 90% of the Docker code out there is converting environment variables into configuration files. This is a consequence of Docker's choice of the "image" as an abstraction layer. It's not trivial to say "run this image but with this config file added" (yes you could bind mount one in, or create a new derived image, but those are both harder and come with more pitfalls). In most common docker usage, there are exactly two ways to influence the operation of the program contained within the image: Environment variables, and command line arguments.
- GoblinSlayer 6y agoFor automation you will store them in a file anyway, but then how is it different from a bind mount?
- KptMarchewa 6y agoMore usually, in k8s configmap.
- zabzonk 6y ago> These methods are being used for decades and well understood with all their advantages and disadvantages. Just because something has been used for decades does not make it good - for example, avoidable mutable state. And it certainly does not make it well-understood - as a consultant the number of brain frying environment variable configurations I've had to deal with which no permies could tell me anything about defies belief. > someone comes and tells that it's bad and considered harmful, Yes, some things are bad and are actively harmful. Famously, unstructured programming using gotos. Would you like to go back to that? Believe me, you would not. But perhaps you are not a programmer? > That thing wouldn't be a de-facto standard if it was too bad, right? It's not a "de-facto standard", it's simply bad.
- bayindirh 6y ago> Just because something has been used for decades does not make it good. I'm not calling this is good with the persistence of the original author. I tell that it's one of the realities that we have, and instead of burning it with torches, why not build better conventions around it with better attitude and language? Maybe we can try: "Instead of burying all config under environment variables, why not try doing it like this?", and slowly build something better, step by step. Nothing is inherently good or bad, but can be abused. So the abuse of environment variables as a shortcut needs to stop, one may say and I'd agree, and may also volunteer to help to build a better thing. But, shunning it with anger and shouting "I'm the one who knows all right things!" sure creates backlash, like here. All in all, I'm against the attitude, not the idea of improving a situation. > Yes, some things are bad and are actively harmful. It might be, but even your solution might not be right. Why the attitude? > unstructured programming using gotos. Would you like to go back to that? Did that on some older, limited hardware, and it was fun. It was not OK by today's standards, but I had to. I'll do it again if it's the only thing I can do to work on that particular hardware again. > But perhaps you are not a programmer? I just design algorithms and develop scientific applications which run on HPC clusters, nothing fancy. > It's not a "de-facto standard", it's simply bad. I didn't say it's good. I say it's a fact. I'm not disagreeing on its bad sides. I'm not OK with the attitude.
- 6y ago
- hjek 6y ago> Attacking something so well established because of personal reasons feels so wrong from my PoV. That is a mischaracterization of the post. The author is making a clear technical point about how environmental variables are global mutable state. Labeling that as an "attack because of personal reasons" is just plain misleading. > That thing wouldn't be a de-facto standard if it was too bad, right? How much of the post did you read? Your point is almost exactly the same as the 3rd listed in the post: > It's the same old trifecta of why things are bad and broken: > 1. Envvars are easy to add > 2. There are existing processes that only work via envvars > 3. "This is the way we have always done it so it must be correct!"
- bayindirh 6y ago> That is a mischaracterization of the post. I don't think so. First of all, as I detailed in [0] and [1], my central point of disagreement is the tone and attitude of the post, not the usage of environment variables itself. There are a lot of scenarios where environment variables makes a lot of sense, and scenarios where using them is absolute madness as we discussed with q3k in [1]. > How much of the post did you read? All of it. BTW, please remember asking this question is directly against guidelines [2] (sec: In comments, guideline 8). > Your point is almost exactly the same as the 3rd listed in the post: 3. "This is the way we have always done it so it must be correct!" As I said in my other comments, I do not directly support the exact opposite of the author's stance. My disagreement is in the tone and rigidity of viewpoint. To quote myself: I'm not calling this is good with the persistence of the original author. I tell that it's one of the realities that we have, and instead of burning it with torches, why not build better conventions around it with better attitude and language? Please see [0] and [1] for further clarification. [0]: https://news.ycombinator.com/item?id=26660409 https://news.ycombinator.com/item?id=26660409 [1]: https://news.ycombinator.com/item?id=26660553 https://news.ycombinator.com/item?id=26660553 [2]: https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html
- one2three4 6y agoAgree. Also I don't see any proposal put forth. Did I miss it? The gist I got was "env vars are bad and if we don't use something else (what?) we're hung up in the past".